Utility to create a stand-alone distribution of a Python program, either a console or GUI program. py2win uses Python embedded distribution and pip to create the stand-alone distribution. Dependencies are therefore installed as they would be with a full Python distribution.
You need:
- Python >= 3.6
- Microsoft Visual Studio, compatible with your current Python installation
Then simply run:
pip install py2win
- Define at least one entry point in your
setup.py
.
setup(
...
entry_points={
'gui_scripts': ['sample-gui=sample.gui:main'],
'console_scripts': ['sample-console=sample.console:main'],
},
...
)
- Run the
bdist_windows
command
python setup.py --command-packages py2win bdist_windows
In a separate Python script (e.g. a release.py
file in the root directory), you can define the embed process using the EmbedPython
class and call the run
method.
from py2win.embed import EmbedPython
embed = EmbedPython('sample', '1.2.0')
embed.add_wheel(filepath_to_wheel_of_your_project)
embed.add_requirement('PyQt5')
embed.add_script(module='project.gui', method='main', executable_name='project-gui', console=False)
embed.run(destination_directory)
- Fix issue with distribution zip where zip content included extra folders
- Fix issue where compilation files/folders were not removed
- Remove deprecation warning with distutils
- Add support for arguments in console script (PR#1)
- Use pathlib for paths
- Use pytest for tests
- Use black for formatting
- First release
The library is provided under the MIT license.
Copyright (c) 2017 - , Philippe Pinard