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

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

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.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

pep517-0.2-py2.py3-none-any.whl (31.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pep517-0.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for pep517-0.2.tar.gz
Algorithm Hash digest
SHA256 cf343531584a045bca38090c68d0c4e8efe71cfa2bcba217dc322a927141f75b
MD5 a7b63bad276b52d12b48bd0fb6679892
BLAKE2b-256 59b7773007e1da712f763fef0570d53a1d88398ea569f30a4cc9cef25d73f0f4

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: pep517-0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.19.1

File hashes

Hashes for pep517-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bddca66e4983092cdafdaac1e91a9a8f884fee0844cb1ec62a84386699f29c96
MD5 9bea453f148a49fd7305247cd319d4ab
BLAKE2b-256 0eacb2745cf5410e2d1b5eb4be31d236ed4cdc683d11e10c4797c555126050d6

See more details on using hashes here.

Provenance

Supported by

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