Skip to main content

py2win

PyPI CI codecov

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.

Installation

You need:

  • Python >= 3.6
  • Microsoft Visual Studio, compatible with your current Python installation

Then simply run:

pip install py2win

How to use

As a command in setup.py

  1. 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'],
    },
    ...
    )
  1. Run the bdist_windows command
python setup.py --command-packages py2win bdist_windows

As a separate script to create an embedded distribution

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)

Release notes

0.4.0

  • Fix issue with distribution zip where zip content included extra folders
  • Fix issue where compilation files/folders were not removed

0.3.0

  • Remove deprecation warning with distutils

0.2.0

  • Add support for arguments in console script (PR#1)
  • Use pathlib for paths
  • Use pytest for tests
  • Use black for formatting

0.1.0

  • First release

Contributors

License

The library is provided under the MIT license.

Copyright (c) 2017 - , Philippe Pinard

Metadata

Release files for py2win 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py2win 0.4.0
File Size Uploaded Provenance
py2win-0.4.0.tar.gz 12.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for py2win 0.4.0
File Interpreter ABI Platform
py2win-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / py2win-0.4.0.tar.gz

Download URL py2win-0.4.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a1fd11e6aa2aaa6b10aebddc12a7a243a34550d23e2228be033890ba3aa20f0
BLAKE2b-256 checksum
How to use checksums
396080d3aada2e97bfa55aee02d263d4f96d8006cb7847a8bcabcd6ed3d396b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / py2win-0.4.0-py3-none-any.whl

Download URL py2win-0.4.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b9c3db5008e638380ffdcbec78d1916ccfee575fe2aac033352759338c0f37f
BLAKE2b-256 checksum
How to use checksums
439878b5a3a50737a0d7ce760e2e44e2672f430e909891de0fe0b51ba1306e2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for py2win 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page