Skip to main content

simple-build

A simple build-backend for Python.

The package implements the build backend interface, defined in https://peps.python.org/pep-0517, and https://peps.python.org/pep-0660.

It is very similar to flit and hatch, but it has one key additional feature I required: pre-write hooks. This is bit similar to hatch's build hook, but offers a lot more freedom to modify the packaged files.

Usage

Simply add the following to your pyproject.toml:

[build-system]
requires = ["simple-build"]
build-backend = "simple_build.backend"

Features

modules in src folder

The module will be found by the project name (normalising - to _), and supports packages in the common src folder layout, or at the root of the package.

[project]
name = "my-project"
pyproject.toml
src/
    my_project/
        __init__.py

Dynamic project metadata

The following fields can be set as dynamic values:

[project]
dynamic = ["version", "description", "authors"]

The values are then read from the root file of the package (__init__.py or the single module file):

"""My project description."""
__version__ = "0.1.0"
__author__ = "John Doe"
__email__ = "johndoe@email.com"

Git integration

By default the packaging will respect the .gitignore file, and exclude all files listed in it.

You can also configure this in the pyproject.toml:

[tool.build.sdist]
use_git = true
include = ["my_file.txt", ...]
exclude = ["my_file.txt", ...]

pre-write hooks

In your pyproject.toml you can define a list of hooks that can modify the files before they are written to the sdist or wheel:

[tool.build]
pre_write_hooks = ["my_hook.py"]

A hook file should contain a function with the following signature:

from pathlib import Path
from typing import Literal
from simple_build.analyse import PackageAnalysis

def pre_write_hook(
    type: Literal["sdist", "wheel"], src: Path, module: str | None, analysis: PackageAnalysis
) -> None:
    """A pre-write hook, to modify files before writing them to the sdist or wheel.

    :param path: The path to the temporary folder containing the files that will be written to the sdist/wheel.
        This can be modified in place, including deleting files and adding new ones.
    :param module: The name of the module.
    :param package: The package analysis.
    """

Release files for simple-build 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-build 0.0.3
File Size Uploaded
simple_build-0.0.3.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-build 0.0.3
File Interpreter ABI Platform
simple_build-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 46.4 kB

Release files / simple_build-0.0.3.tar.gz

Download URL simple_build-0.0.3.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
564070024b25f5e3a112475b2c7ffbc61fe78ee2e2da79452debce614ae7ea7f
BLAKE2b-256 checksum
How to use checksums
69e2d063f2aea16a4f399a57d14392f02540c32db26efc70beba8d3d916a1311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / simple_build-0.0.3-py3-none-any.whl

Download URL simple_build-0.0.3-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e6dfe0d5f24e7531d7859951deb850446f90110f1b631ea94500b4d92258db0
BLAKE2b-256 checksum
How to use checksums
ba527a758050955368485fb24b60e0ee74b83934cc238f79558be3419ec5de42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page