Skip to main content

Wrappers to build Python packages using PEP 517 hooks

Project description

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

This package contains wrappers around the hooks specified by PEP 517. 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.

  • Higher-level functions which install the build dependencies into a temporary environment and build a wheel/sdist using them.

Run the tests with py.test.

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))

Lower level usage—you are responsible for ensuring build requirements are available:

import os
from pep517.wrappers import Pep517HookCaller

src = 'path/to/source'  # Folder containing 'pyproject.toml'
hooks = Pep517HookCaller(src)
print(hooks.build_sys_requires)  # List of static requirements

config_options = {}   # Optional parameters for backend
# List of dynamic requirements:
print(hooks.get_requires_for_build_wheel(config_options))

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pep517-0.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pep517-0.1-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pep517-0.1.tar.gz.

File metadata

  • Download URL: pep517-0.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pep517-0.1.tar.gz
Algorithm Hash digest
SHA256 42cc693c19a2549f8782cbca45104a5109754682f4df0370524fcadf04ad6f33
MD5 bafedb7c1e0a84f84c286e6061c0e0b5
BLAKE2b-256 5522ff5f367b32bf7a4afa684a9915deef01f041779579a52336775bd61e8e63

See more details on using hashes here.

File details

Details for the file pep517-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pep517-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8c51de2a76c14ba67674bd6ebf6848047836650d4d0a30b227262a9912d2091f
MD5 fb924166826a293ff1779d45fb55c42d
BLAKE2b-256 79a20e86747d66c00790a183af0835e951f3900102c249be1932138a5c0d2aaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page