Giter VIP home page Giter VIP logo

py2win's Introduction

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

py2win's People

Contributors

ppinard avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

trollfred

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.