1.6 KiB
title
| title |
|---|
| Scott - Build From Source |
Scott - Build From Source
Open a terminal and change the active directory to the project root folder for Scott.
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 Scott into distributable artifacts.
Step 1: Create an isolated virtual environment.
python -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: Build Scott as a package
python -m build
By default the build process produces both a source distribution (.tar.gz sdist) and a
wheel (.whl) in the dist/ directory under the project root folder.
The resulting files in dist/ are what you'd upload to PyPI or install with pip install.