52 lines
1.6 KiB
Markdown
52 lines
1.6 KiB
Markdown
---
|
|
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.__
|
|
|
|
```sh
|
|
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.__
|
|
|
|
```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: Build Scott as a package__
|
|
|
|
```sh
|
|
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`.
|