SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
Deployment of
xlwings-powered spreadsheets
Felix Zumstein, 24 March 2020
Webinar
Agenda
1. But why?!
2. Quickstart & Configuration
3. ZIP, Python Package & Standalone Option
4. Frozen Executables
5. Shared Drive & DropBox etc.
6. xlwings PRO
2
1. But why?!
4
Can I deploy xlwings
workbooks without Python?
#1 Question
5
No.
Short Answer
2. Quickstart & Configuration
xlwings quickstart
7
A common misconception
• Quickstart is the beginning, not the end
• xlwings does not require the Python code in
the same directory as the Excel file nor
does it need to have the same name
• Reading the docs helps (although
improving the docs would, too ;-)
8
3 Levels of Configuration
1. Workbook: xlwings first checks for a sheet called
“xlwings.conf” (needs to be activated after
quickstart)
2. Directory: Then it checks for the file “xlwings.conf”
in the same directory as the Excel file
3. Global/add-in: Finally, it checks for the global
configuration in ~/.xlwings/xlwings.conf (This is
what you edit & see in the add-in!)
9
Move and Rename the Python file
10
• Move demo.py to Desktop
and call it demo1.py
• Settings (they accept Env
Variables like %APPDATA%!):
• Change SampleCall (Alt-F11):
Sub SampleCall()
RunPython "import demo1;demo1.main()"
End Sub
3. ZIP file, Python Package &
Standalone Option
ZIP files
A simple way to make deployment slightly easier if
you have more than 1 module.
12
import xlwings as xw
from utils import greeting
def main():
wb = xw.Book.caller()
wb.sheets[0].range("A1").value = greeting
demo.py
Installed Packages
• Create a package with your code
• You can upload it to an (internal) PyPI or to
a shared drive (or even install directly from
a Git repo url):
pip install shareddrivemypackge.tar.gz
• No need to change PYTHONPATH
13
Sample package
14
import os
from setuptools import setup
setup(name='demo',
version='1.0.0', # usually taken from source code
py_modules=['demo'])
python setup.py sdist
Create a setup.py file next to your demo.py:
This will create dist/demo-1.0.0.tar.gz that you can install like this:
pip install demo-1.0.0.tar.gz
Create the package:
Get rid of the add-in
15
xlwings quickstart demo --standalone
Once Python and package are installed, the Excel file
behaves like an ordinary xlsm file.
Or do File > Import File … and import xlwings.bas (from the xlwings
package location)
3. Frozen Executables
Freezers
• PyInstaller is the most popular option
• Note: It does not work with UDFs, only with
RunPython (macOS support pending)
• Advantages:
– Small size
– Source code is automatically compiled to pyc
and hidden away in the exe
17
RunFrozenPython
18
pyinstaller demo.pyFreeze it:
When adding unused packages to the excludes list in demo.spec,
you’ll end up with a bundle of only 20MB (uncompressed). Re-run:
pyinstaller demo.spec
Sub SampleCall()
RunFrozenPython ThisWorkbook.Path & "distdemodemo.exe"
End Sub
Place it somewhere and point RunFrozenPython to that path:
See: https://github.com/xlwings/xlwings-demo/tree/master/frozen
Code Obfuscation
• A lot of people seem to be obsessed with
code obfuscation
• Distributing pyc files instead of py files will
probably do the job most of the time
• The best option if that’s not enough is
probably a (commercial) package called
PyArmor: https://github.com/dashingsoft/pyarmor
19
5. Shared Drive & DropBox etc.
Shared Drives
• You can install Python on a shared drive
• Simply point the interpreter in the config to the
one on the shared drive
• “Server-like” experience that makes deployment
and updating a piece of 🍰
• Only works for internal distribution
• It’s slower than a local installation but it’s being
used in practice
21
DropBox, OneDrive etc.
• You can place a frozen executable on your
DropBox folder or even install Python there
• Make use of env vars in your xlwings config:
– %USERPROFILE%Dropbox
– %ONEDRIVE% or %ONEDRIVECOMMERCIAL%
22
6. xlwings PRO
Goal
24
• Zero Python knowledge required
• Zero configuration (installer & workbook)
• Works for both UDFs and RunPython
• Works for external distribution
• Easy way to deploy updates
• Cross-Platform (macOS coming soon…)
Embed Python code
xlwings PRO allows
you to ship your
Python code inside
the Excel file, much
like VBA.
This can be a huge
plus when rolling out
updates as end users
only have to replace
the Excel file.
25
Version control (Iteration 0)
26
Installer: Pipeline on GitHub
27
Optional: source code (if you don’t embed)
Dependencies like pandas etc.
Optional: Code sign certificate
Installer: 1 click release
28
Installer: User experience
29
• After running the installer, the
Excel file “just works”.
• It can be uninstalled via Apps &
Features
Summary: Zero config setup
30
• Installer:
– unzips the Python runtime with all dependencies into
%LOCALAPPDATA%project
• Excel file:
– embeded xlwings module
– embeded source code (PRO feature)
– config sheet pointing to %LOCALAPPDATA%project
Thank You
Let’s connect:
https://www.linkedin.com/in/felix-zumstein

Contenu connexe

Tendances

Tendances (20)

Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry Pi
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
 
GitHub Actions with Node.js
GitHub Actions with Node.jsGitHub Actions with Node.js
GitHub Actions with Node.js
 
Kubernetes & helm 활용
Kubernetes & helm 활용Kubernetes & helm 활용
Kubernetes & helm 활용
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
Bytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte BuddyBytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte Buddy
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
 
자바 직렬화 (Java serialization)
자바 직렬화 (Java serialization)자바 직렬화 (Java serialization)
자바 직렬화 (Java serialization)
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
Introduction to EasyBuild: Tutorial Part 1
Introduction to EasyBuild: Tutorial Part 1Introduction to EasyBuild: Tutorial Part 1
Introduction to EasyBuild: Tutorial Part 1
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Docker Networking Deep Dive
Docker Networking Deep DiveDocker Networking Deep Dive
Docker Networking Deep Dive
 
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
 
Security: Odoo Code Hardening
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker storage drivers by Jérôme Petazzoni
Docker storage drivers by Jérôme PetazzoniDocker storage drivers by Jérôme Petazzoni
Docker storage drivers by Jérôme Petazzoni
 

Similaire à Deployment of xlwings-powered spreadsheets (webinar)

LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
Luis Rodríguez Castromil
 

Similaire à Deployment of xlwings-powered spreadsheets (webinar) (20)

Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
Suse Studio: "How to create a live openSUSE image with OpenFOAM® and CFD tools"
Suse Studio: "How to create a live openSUSE image with  OpenFOAM® and CFD tools"Suse Studio: "How to create a live openSUSE image with  OpenFOAM® and CFD tools"
Suse Studio: "How to create a live openSUSE image with OpenFOAM® and CFD tools"
 
Installing Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for WindowsInstalling Hortonworks Hadoop for Windows
Installing Hortonworks Hadoop for Windows
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 
PaaSing Your Code Around
PaaSing Your Code AroundPaaSing Your Code Around
PaaSing Your Code Around
 
Pythonpresent
PythonpresentPythonpresent
Pythonpresent
 
Python Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txtPython Requirements File How to Create Python requirements.txt
Python Requirements File How to Create Python requirements.txt
 
Deployer
DeployerDeployer
Deployer
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
PyCourse - Self driving python course
PyCourse - Self driving python coursePyCourse - Self driving python course
PyCourse - Self driving python course
 
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and PrestoStorageQuery: federated querying on object stores, powered by Alluxio and Presto
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction to  Command LineChapter 1: Introduction to  Command Line
Chapter 1: Introduction to Command Line
 
PythonNotes1.pdf
PythonNotes1.pdfPythonNotes1.pdf
PythonNotes1.pdf
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction  to Command LineChapter 1: Introduction  to Command Line
Chapter 1: Introduction to Command Line
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
 
You can now use PVS-Studio with Visual Studio absent; just give it the prepro...
You can now use PVS-Studio with Visual Studio absent; just give it the prepro...You can now use PVS-Studio with Visual Studio absent; just give it the prepro...
You can now use PVS-Studio with Visual Studio absent; just give it the prepro...
 
Weblogic12 c installation guide
Weblogic12 c installation guideWeblogic12 c installation guide
Weblogic12 c installation guide
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 

Plus de xlwings

Open Source in Quant Finance - xlwings
Open Source in Quant Finance - xlwingsOpen Source in Quant Finance - xlwings
Open Source in Quant Finance - xlwings
xlwings
 

Plus de xlwings (19)

xlwings for Google Sheets
xlwings for Google Sheetsxlwings for Google Sheets
xlwings for Google Sheets
 
Cross-platform Spreadsheet Automation with Python
Cross-platform Spreadsheet Automation with PythonCross-platform Spreadsheet Automation with Python
Cross-platform Spreadsheet Automation with Python
 
Automate your PDF factsheets with xlwings Reports
Automate your PDF factsheets with xlwings ReportsAutomate your PDF factsheets with xlwings Reports
Automate your PDF factsheets with xlwings Reports
 
Tech3camp Meetup: Python for Excel
Tech3camp Meetup: Python for ExcelTech3camp Meetup: Python for Excel
Tech3camp Meetup: Python for Excel
 
Git for Excel (Webinar)
Git for Excel (Webinar)Git for Excel (Webinar)
Git for Excel (Webinar)
 
xlwings reports: Reporting with Excel & Python
xlwings reports: Reporting with Excel & Pythonxlwings reports: Reporting with Excel & Python
xlwings reports: Reporting with Excel & Python
 
Python and Excel in Finance (PyData meetup Zurich)
Python and Excel in Finance (PyData meetup Zurich)Python and Excel in Finance (PyData meetup Zurich)
Python and Excel in Finance (PyData meetup Zurich)
 
Automated testing of Excel Workbooks
Automated testing of Excel WorkbooksAutomated testing of Excel Workbooks
Automated testing of Excel Workbooks
 
Git for Excel
Git for ExcelGit for Excel
Git for Excel
 
Automated Testing of Excel Workbooks
Automated Testing of Excel WorkbooksAutomated Testing of Excel Workbooks
Automated Testing of Excel Workbooks
 
Git for Excel files webinar
Git for Excel files webinarGit for Excel files webinar
Git for Excel files webinar
 
xlwings Presentation (Excel & Python) Swiss FinteCH event
xlwings Presentation (Excel & Python) Swiss FinteCH eventxlwings Presentation (Excel & Python) Swiss FinteCH event
xlwings Presentation (Excel & Python) Swiss FinteCH event
 
Python. Finance. Excel. - The Thalesians
Python. Finance. Excel. - The ThalesiansPython. Finance. Excel. - The Thalesians
Python. Finance. Excel. - The Thalesians
 
For Python Quants Conference NYC 6th May 2016
For Python Quants Conference NYC 6th May 2016For Python Quants Conference NYC 6th May 2016
For Python Quants Conference NYC 6th May 2016
 
Open Source in Quant Finance - xlwings
Open Source in Quant Finance - xlwingsOpen Source in Quant Finance - xlwings
Open Source in Quant Finance - xlwings
 
Odsc presentation
Odsc presentationOdsc presentation
Odsc presentation
 
xlwings - For Python Quants Conference (London 2014)
xlwings - For Python Quants Conference (London 2014)xlwings - For Python Quants Conference (London 2014)
xlwings - For Python Quants Conference (London 2014)
 
xlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetupxlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetup
 
xlwings - Connecting Python with Excel
xlwings - Connecting Python with Excelxlwings - Connecting Python with Excel
xlwings - Connecting Python with Excel
 

Dernier

Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
drm1699
 

Dernier (20)

^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
What is a Recruitment Management Software?
What is a Recruitment Management Software?What is a Recruitment Management Software?
What is a Recruitment Management Software?
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
 

Deployment of xlwings-powered spreadsheets (webinar)

  • 1. Deployment of xlwings-powered spreadsheets Felix Zumstein, 24 March 2020 Webinar
  • 2. Agenda 1. But why?! 2. Quickstart & Configuration 3. ZIP, Python Package & Standalone Option 4. Frozen Executables 5. Shared Drive & DropBox etc. 6. xlwings PRO 2
  • 4. 4 Can I deploy xlwings workbooks without Python? #1 Question
  • 6. 2. Quickstart & Configuration
  • 8. A common misconception • Quickstart is the beginning, not the end • xlwings does not require the Python code in the same directory as the Excel file nor does it need to have the same name • Reading the docs helps (although improving the docs would, too ;-) 8
  • 9. 3 Levels of Configuration 1. Workbook: xlwings first checks for a sheet called “xlwings.conf” (needs to be activated after quickstart) 2. Directory: Then it checks for the file “xlwings.conf” in the same directory as the Excel file 3. Global/add-in: Finally, it checks for the global configuration in ~/.xlwings/xlwings.conf (This is what you edit & see in the add-in!) 9
  • 10. Move and Rename the Python file 10 • Move demo.py to Desktop and call it demo1.py • Settings (they accept Env Variables like %APPDATA%!): • Change SampleCall (Alt-F11): Sub SampleCall() RunPython "import demo1;demo1.main()" End Sub
  • 11. 3. ZIP file, Python Package & Standalone Option
  • 12. ZIP files A simple way to make deployment slightly easier if you have more than 1 module. 12 import xlwings as xw from utils import greeting def main(): wb = xw.Book.caller() wb.sheets[0].range("A1").value = greeting demo.py
  • 13. Installed Packages • Create a package with your code • You can upload it to an (internal) PyPI or to a shared drive (or even install directly from a Git repo url): pip install shareddrivemypackge.tar.gz • No need to change PYTHONPATH 13
  • 14. Sample package 14 import os from setuptools import setup setup(name='demo', version='1.0.0', # usually taken from source code py_modules=['demo']) python setup.py sdist Create a setup.py file next to your demo.py: This will create dist/demo-1.0.0.tar.gz that you can install like this: pip install demo-1.0.0.tar.gz Create the package:
  • 15. Get rid of the add-in 15 xlwings quickstart demo --standalone Once Python and package are installed, the Excel file behaves like an ordinary xlsm file. Or do File > Import File … and import xlwings.bas (from the xlwings package location)
  • 17. Freezers • PyInstaller is the most popular option • Note: It does not work with UDFs, only with RunPython (macOS support pending) • Advantages: – Small size – Source code is automatically compiled to pyc and hidden away in the exe 17
  • 18. RunFrozenPython 18 pyinstaller demo.pyFreeze it: When adding unused packages to the excludes list in demo.spec, you’ll end up with a bundle of only 20MB (uncompressed). Re-run: pyinstaller demo.spec Sub SampleCall() RunFrozenPython ThisWorkbook.Path & "distdemodemo.exe" End Sub Place it somewhere and point RunFrozenPython to that path: See: https://github.com/xlwings/xlwings-demo/tree/master/frozen
  • 19. Code Obfuscation • A lot of people seem to be obsessed with code obfuscation • Distributing pyc files instead of py files will probably do the job most of the time • The best option if that’s not enough is probably a (commercial) package called PyArmor: https://github.com/dashingsoft/pyarmor 19
  • 20. 5. Shared Drive & DropBox etc.
  • 21. Shared Drives • You can install Python on a shared drive • Simply point the interpreter in the config to the one on the shared drive • “Server-like” experience that makes deployment and updating a piece of 🍰 • Only works for internal distribution • It’s slower than a local installation but it’s being used in practice 21
  • 22. DropBox, OneDrive etc. • You can place a frozen executable on your DropBox folder or even install Python there • Make use of env vars in your xlwings config: – %USERPROFILE%Dropbox – %ONEDRIVE% or %ONEDRIVECOMMERCIAL% 22
  • 24. Goal 24 • Zero Python knowledge required • Zero configuration (installer & workbook) • Works for both UDFs and RunPython • Works for external distribution • Easy way to deploy updates • Cross-Platform (macOS coming soon…)
  • 25. Embed Python code xlwings PRO allows you to ship your Python code inside the Excel file, much like VBA. This can be a huge plus when rolling out updates as end users only have to replace the Excel file. 25
  • 27. Installer: Pipeline on GitHub 27 Optional: source code (if you don’t embed) Dependencies like pandas etc. Optional: Code sign certificate
  • 28. Installer: 1 click release 28
  • 29. Installer: User experience 29 • After running the installer, the Excel file “just works”. • It can be uninstalled via Apps & Features
  • 30. Summary: Zero config setup 30 • Installer: – unzips the Python runtime with all dependencies into %LOCALAPPDATA%project • Excel file: – embeded xlwings module – embeded source code (PRO feature) – config sheet pointing to %LOCALAPPDATA%project