python-distribution-example


Namepython-distribution-example JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryAn example of Python application distribution.
upload_time2024-04-15 01:59:10
maintainerNone
docs_urlNone
authorJP Hutchins
requires_python<3.13,>=3.10
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Distribution Example

This repository demonstrates one way of creating a portable Python application
that can be installed and run without any external dependencies.  This is
useful for distributing Python applications to users without a Python
environment, or for distributing a Python application via a package
manager.

## Setup

> These steps only need to be completed on first-time setup.

### Install Dependencies

- Python >=3.10, <3.13
- [Poetry](https://python-poetry.org/docs/): I recommend installing `pipx`
  first and then using `pipx` to install `poetry`.

> Refer to [release.yaml](.github/workflows/release.yaml) for platform-specific
  installer dependencies.  The installer builds for Windows, Linux, and MacOS
  run on GitHub runners, so you don't need to install the requirements unless
  you are troubleshooting a platform-specific installer build script.

### Clone this Repository

> If you'd like to track your own changes in GitHub, then you should
  [fork](https://github.com/JPHutchins/python-distribution-example/fork) this
  repository, and then clone your fork.

```
git clone git@github.com:JPHutchins/python-distribution-example.git
```

### Install the Python venv

- change directory to the root of the cloned repository:
  ```
  cd python-distribution-example
  ```
- install the venv with poetry
  ```
  poetry install
  ```
  > The venv is installed to `/.venv`

## Build

> Make sure to complete the [setup](#setup) first.

### Activate the Development Environment

> This step is required before running or building the app.

```
. ./envr.ps1
```

Now you can run the app within the Python venv:

```
yourapp --help
```

### Build the `sdist` and `wheel`

```
poetry build
```

The build output is at `dist/`.

### Build the Portable App for Your Host Platform

```
python -m distribution.portable
```

The build output is at `dist/yourapp-<version>-<platform>-<arch>`, e.g.
`dist/yourapp-1.0.0-windows-amd64`, as well is in a ZIP archive of the same name.

## Tools Used

- [GitHub Actions](https://github.com/features/actions): automate the build and
  release of the application on GitHub runners
- [envr](https://github.com/JPhutchins/envr): manage environment variables,
  PATH, and Python venv
- [poetry](https://python-poetry.org/): manage Python dependencies and build
- [PyInstaller](https://github.com/pyinstaller/pyinstaller): create a "one-dir"
  portable "executable" of the Python application
- [WiX v4](https://wixtoolset.org/): create a Windows installer, `*.msi`, that
  creates a double-clickable version of the app, adds the app to the system
  PATH, adds an app folder to the Start Menu, and optionally adds a shortcut to
  the desktop
- [FPM](https://github.com/jordansissel/fpm): create `*.deb` and `*.rpm` Linux
  packages that install the app to `/usr/share/` and add a symlink to
  `/usr/bin/*`.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-distribution-example",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "JP Hutchins",
    "author_email": "jphutchins@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/da/5a/a75f59e1483d7f86fb7af706de6964653da3d0d8afe3e6fc50f19e6abf66/python_distribution_example-1.0.0.tar.gz",
    "platform": null,
    "description": "# Python Distribution Example\n\nThis repository demonstrates one way of creating a portable Python application\nthat can be installed and run without any external dependencies.  This is\nuseful for distributing Python applications to users without a Python\nenvironment, or for distributing a Python application via a package\nmanager.\n\n## Setup\n\n> These steps only need to be completed on first-time setup.\n\n### Install Dependencies\n\n- Python >=3.10, <3.13\n- [Poetry](https://python-poetry.org/docs/): I recommend installing `pipx`\n  first and then using `pipx` to install `poetry`.\n\n> Refer to [release.yaml](.github/workflows/release.yaml) for platform-specific\n  installer dependencies.  The installer builds for Windows, Linux, and MacOS\n  run on GitHub runners, so you don't need to install the requirements unless\n  you are troubleshooting a platform-specific installer build script.\n\n### Clone this Repository\n\n> If you'd like to track your own changes in GitHub, then you should\n  [fork](https://github.com/JPHutchins/python-distribution-example/fork) this\n  repository, and then clone your fork.\n\n```\ngit clone git@github.com:JPHutchins/python-distribution-example.git\n```\n\n### Install the Python venv\n\n- change directory to the root of the cloned repository:\n  ```\n  cd python-distribution-example\n  ```\n- install the venv with poetry\n  ```\n  poetry install\n  ```\n  > The venv is installed to `/.venv`\n\n## Build\n\n> Make sure to complete the [setup](#setup) first.\n\n### Activate the Development Environment\n\n> This step is required before running or building the app.\n\n```\n. ./envr.ps1\n```\n\nNow you can run the app within the Python venv:\n\n```\nyourapp --help\n```\n\n### Build the `sdist` and `wheel`\n\n```\npoetry build\n```\n\nThe build output is at `dist/`.\n\n### Build the Portable App for Your Host Platform\n\n```\npython -m distribution.portable\n```\n\nThe build output is at `dist/yourapp-<version>-<platform>-<arch>`, e.g.\n`dist/yourapp-1.0.0-windows-amd64`, as well is in a ZIP archive of the same name.\n\n## Tools Used\n\n- [GitHub Actions](https://github.com/features/actions): automate the build and\n  release of the application on GitHub runners\n- [envr](https://github.com/JPhutchins/envr): manage environment variables,\n  PATH, and Python venv\n- [poetry](https://python-poetry.org/): manage Python dependencies and build\n- [PyInstaller](https://github.com/pyinstaller/pyinstaller): create a \"one-dir\"\n  portable \"executable\" of the Python application\n- [WiX v4](https://wixtoolset.org/): create a Windows installer, `*.msi`, that\n  creates a double-clickable version of the app, adds the app to the system\n  PATH, adds an app folder to the Start Menu, and optionally adds a shortcut to\n  the desktop\n- [FPM](https://github.com/jordansissel/fpm): create `*.deb` and `*.rpm` Linux\n  packages that install the app to `/usr/share/` and add a symlink to\n  `/usr/bin/*`.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "An example of Python application distribution.",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ee105ece89c527b86ce60ce27a28e51507ddc15856423f9b974869a067c1bd0",
                "md5": "98be210461b8e318623839665dacff9e",
                "sha256": "1bef9f4caba1f4fa4cff7601d08b37e8330dae1849f458794e29ca840a269991"
            },
            "downloads": -1,
            "filename": "python_distribution_example-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98be210461b8e318623839665dacff9e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.10",
            "size": 8116,
            "upload_time": "2024-04-15T01:59:09",
            "upload_time_iso_8601": "2024-04-15T01:59:09.038975Z",
            "url": "https://files.pythonhosted.org/packages/9e/e1/05ece89c527b86ce60ce27a28e51507ddc15856423f9b974869a067c1bd0/python_distribution_example-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da5aa75f59e1483d7f86fb7af706de6964653da3d0d8afe3e6fc50f19e6abf66",
                "md5": "9ba4ee9ac2acff93ed95b0c806fbcd7c",
                "sha256": "6a0aa235e486f40401821881942923e2d519c1aed02447286031c65ad98f6c6e"
            },
            "downloads": -1,
            "filename": "python_distribution_example-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9ba4ee9ac2acff93ed95b0c806fbcd7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.10",
            "size": 6523,
            "upload_time": "2024-04-15T01:59:10",
            "upload_time_iso_8601": "2024-04-15T01:59:10.447857Z",
            "url": "https://files.pythonhosted.org/packages/da/5a/a75f59e1483d7f86fb7af706de6964653da3d0d8afe3e6fc50f19e6abf66/python_distribution_example-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 01:59:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-distribution-example"
}
        
Elapsed time: 0.45918s