major changes
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
---
|
||||
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.__
|
||||
|
||||
```sh
|
||||
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.__
|
||||
|
||||
```sh
|
||||
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.__
|
||||
|
||||
```sh
|
||||
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.__
|
||||
|
||||
```sh
|
||||
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.
|
||||
|
||||
```sh
|
||||
pip install pyinstaller
|
||||
```
|
||||
|
||||
Then create the executable:
|
||||
|
||||
```sh
|
||||
pyinstaller unique.spec
|
||||
```
|
||||
|
||||
This creates an executable file named `unique` that is placed in `/dist` under project root folder.
|
||||
Reference in New Issue
Block a user