1.8 KiB
title
| title |
|---|
| Unique - Build from Source |
Unique - Build from Source
Open a terminal and change the active directory to the project root folder for unique.
Follow the given steps in order to create a clean Python sandbox, activate it, install the build
tool, and then use that tool to compile unique into distributable artifacts.
Step 1: Create an isolated virtual environment.
python3 -m venv .venv
The virtual environment is created in a folder called .venv under the project root folder. This
gives the project its own Python interpreter and package space, so dependencies don't conflict with
the system Python or other projects.
Step 2: Activate the virtual environment.
source .venv/bin/activate
Activation happens for the current shell session only. It prepends .venv/bin/ to your PATH, so
python and pip now resolve to the environment's copies. Your prompt typically changes to show
(.venv).
Step 3: Install (or upgrade) the build package.
pip install --upgrade build
The virtual environment now has the latest build package. build is the PyPA-recommended PEP 517
build frontend — it reads the project's pyproject.toml, sets up an isolated build environment, and
invokes the configured build backend (setuptools) to produce distribution artifacts.
Step 4: Install unique.
pip install -e .
This installs unique in editable mode. In the process, all required depedencies (scott and
uuid6) are also installed in the virtual environment.
Step 5: Create a binary distributable.
Firstly install pyinstaller in the virtual environment.
pip install pyinstaller
Then create the executable:
pyinstaller unique.spec
This creates an executable file named unique that is placed in /dist under project root folder.