Skip to main content

PEP 517 specifies a standard API for systems which build Python packages.

PEP 660 extends it with a build mode that leads to editable installs.

This package contains wrappers around the hooks specified by PEP 517 and PEP 660. It provides:

  • A mechanism to call the hooks in a subprocess, so they are isolated from the current process.

  • Fallbacks for the optional hooks, so that frontends can call the hooks without checking which are defined.

Run the tests with pytest or tox.

Usage—you are responsible for ensuring build requirements are available:

import os
import tomli
from pep517.wrappers import Pep517HookCaller

src = 'path/to/source'  # Folder containing 'pyproject.toml'
with open(os.path.join(src, 'pyproject.toml'), 'rb') as f:
    build_sys = tomli.load(f)['build-system']

print(build_sys['requires'])  # List of static requirements
# The caller is responsible for installing these and running the hooks in
# an environment where they are available.

hooks = Pep517HookCaller(
    src,
    build_backend=build_sys['build-backend'],
    backend_path=build_sys.get('backend-path'),
)

config_options = {}   # Optional parameters for backend
# List of dynamic requirements:
print(hooks.get_requires_for_build_wheel(config_options))
# Again, the caller is responsible for installing these build requirements

destination = 'also/a/folder'
whl_filename = hooks.build_wheel(destination, config_options)
assert os.path.isfile(os.path.join(destination, whl_filename))

Deprecated high-level

For now, pep517 also contains higher-level functions which install the build dependencies into a temporary environment and build a wheel/sdist using them. This is a rough implementation, e.g. it does not do proper build isolation. The PyPA build project is recommended as an alternative, although it’s still quite young in October 2020. This layer of functionality in pep517 is now deprecated, but won’t be removed for some time, as there is code relying on it.

High level usage, with build requirements handled:

import os
from pep517.envbuild import build_wheel, build_sdist

src = 'path/to/source'  # Folder containing 'pyproject.toml'
destination = 'also/a/folder'
whl_filename = build_wheel(src, destination)
assert os.path.isfile(os.path.join(destination, whl_filename))

targz_filename = build_sdist(src, destination)
assert os.path.isfile(os.path.join(destination, targz_filename))

To test the build backend for a project, run in a system shell:

python3 -m pep517.check path/to/source  # source dir containing pyproject.toml

To build a backend into source and/or binary distributions, run in a shell:

python -m pep517.build path/to/source  # source dir containing pyproject.toml

All of this high-level functionality is deprecated.

Metadata

Release files for pep517 0.13.1

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

Source distribution (sdist)

Source distribution for pep517 0.13.1
File Size Uploaded
pep517-0.13.1.tar.gz 26.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pep517 0.13.1
File Interpreter ABI Platform
pep517-0.13.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.2 kB

Release files / pep517-0.13.1.tar.gz

Download URL pep517-0.13.1.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1b2fa2ffd3938bb4beffe5d6146cbcb2bda996a5a4da9f31abffd8b24e07b317
BLAKE2b-256 checksum
How to use checksums
44d78f5d2be1a5fed3b0b5ccd3e800153c0f4dd84c2a688d25bce0bb0cb1f87f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / pep517-0.13.1-py3-none-any.whl

Download URL pep517-0.13.1-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31b206f67165b3536dd577c5c3f1518e8fbaf38cbc57efff8369a392feff1721
BLAKE2b-256 checksum
How to use checksums
256eca4a5434eb0e502210f591b97537d322546e4833dcb4d470a48c375c5540
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3

2 release files

0.2

2 release files

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