A GitHub Action for building executables with PyInstaller with ability to compile Cython modules.
Cythinst 64 helps you automate the process of building executables from Python applications using PyInstaller. To build your application, specify the location of your source code using the path
argument (default: src
). Your source code directory should include a .spec
file that PyInstaller generates. If you don't have a .spec
file, run PyInstaller locally to generate one. You can also specify a custom .spec
file using spec: <YOUR_SPEC_FILE_NAME>
if needed.
If your source folder contains a requirements.txt
file, any specified packages will be installed into the environment before running PyInstaller. Alternatively, you can specify a different file via the requirements
argument.
To use a custom package mirror, you can set the pypi_url
and/or pypi_index_url
arguments. The default values are:
pypi_url
=https://pypi.python.org/
pypi_index_url
=https://pypi.python.org/simple
Note: If you are using the default Python
.gitignore
file, remember to remove.spec
from it.
This action uses Wine to emulate Windows inside Docker, which is needed to package Windows-compatible executables and to compile Cython modules.
Add the following code to your .github/workflows/main.yaml
to create a GitHub Actions workflow that:
- Packages an application with PyInstaller.
- Uploads the packaged executable as an artifact.
yaml
name: Package Application with PyInstaller
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Package Application
uses: PlohnenSoftware/Cythinst64@main
with:
path: src
- name: Upload Packaged Executable
uses: actions/upload-artifact@v4
with:
name: packaged-artifact
path: src/dist/windows
Ensure that your path
argument is correctly set. The default value is src
.
This is experimental software. Use it at your own risk; there is no warranty.
To push new images up to Docker Hub for your container (zamkorus/cythinst64:latest
):
-
Login to Docker Hub:
docker login
-
Build the Docker Image:
docker build -f Dockerfile -t zamkorus/cythinst64:latest .
-
Push the Docker Image to Docker Hub:
docker push zamkorus/cythinst64:latest
These steps will ensure that your updated image is properly built and pushed to Docker Hub.