pep517


Namepep517 JSON
Version 0.13.1 PyPI version JSON
download
home_pagehttps://github.com/pypa/pep517
SummaryWrappers to build Python packages using PEP 517 hooks
upload_time2023-11-08 11:27:34
maintainerNone
docs_urlNone
authorThomas Kluyver
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            API to call PEP 517 hooks
=========================

.. warning::

   The core of this package has been renamed to
   `pyproject-hooks <https://pyproject-hooks.readthedocs.io/>`_. Please use that
   package (low level) or `build <https://pypa-build.readthedocs.io/en/stable/>`_
   (higher level) in place of ``pep517``.

`PEP 517 <https://www.python.org/dev/peps/pep-0517/>`_ specifies a standard
API for systems which build Python packages.

`PEP 660 <https://www.python.org/dev/peps/pep-0660/>`_ 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 <https://pypi.org/project/tox>`_.

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

.. code-block:: python

    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 <https://github.com/pypa/build>`_ 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:

.. code-block:: python

    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:

.. code-block:: 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:

.. code-block:: shell

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

All of this high-level functionality is deprecated.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pypa/pep517",
    "name": "pep517",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Thomas Kluyver",
    "author_email": "thomas@kluyver.me.uk",
    "download_url": "https://files.pythonhosted.org/packages/44/d7/8f5d2be1a5fed3b0b5ccd3e800153c0f4dd84c2a688d25bce0bb0cb1f87f/pep517-0.13.1.tar.gz",
    "platform": null,
    "description": "API to call PEP 517 hooks\n=========================\n\n.. warning::\n\n   The core of this package has been renamed to\n   `pyproject-hooks <https://pyproject-hooks.readthedocs.io/>`_. Please use that\n   package (low level) or `build <https://pypa-build.readthedocs.io/en/stable/>`_\n   (higher level) in place of ``pep517``.\n\n`PEP 517 <https://www.python.org/dev/peps/pep-0517/>`_ specifies a standard\nAPI for systems which build Python packages.\n\n`PEP 660 <https://www.python.org/dev/peps/pep-0660/>`_ extends it with a build\nmode that leads to editable installs.\n\nThis package contains wrappers around the hooks specified by PEP 517 and\nPEP 660. It provides:\n\n- A mechanism to call the hooks in a subprocess, so they are isolated from\n  the current process.\n- Fallbacks for the optional hooks, so that frontends can call the hooks without\n  checking which are defined.\n\nRun the tests with ``pytest`` or `tox <https://pypi.org/project/tox>`_.\n\nUsage\u2014you are responsible for ensuring build requirements are available:\n\n.. code-block:: python\n\n    import os\n    import tomli\n    from pep517.wrappers import Pep517HookCaller\n\n    src = 'path/to/source'  # Folder containing 'pyproject.toml'\n    with open(os.path.join(src, 'pyproject.toml'), 'rb') as f:\n        build_sys = tomli.load(f)['build-system']\n\n    print(build_sys['requires'])  # List of static requirements\n    # The caller is responsible for installing these and running the hooks in\n    # an environment where they are available.\n\n    hooks = Pep517HookCaller(\n        src,\n        build_backend=build_sys['build-backend'],\n        backend_path=build_sys.get('backend-path'),\n    )\n\n    config_options = {}   # Optional parameters for backend\n    # List of dynamic requirements:\n    print(hooks.get_requires_for_build_wheel(config_options))\n    # Again, the caller is responsible for installing these build requirements\n\n    destination = 'also/a/folder'\n    whl_filename = hooks.build_wheel(destination, config_options)\n    assert os.path.isfile(os.path.join(destination, whl_filename))\n\nDeprecated high-level\n---------------------\n\nFor now, ``pep517`` also contains higher-level functions which install the build\ndependencies into a temporary environment and build a wheel/sdist using them.\nThis is a rough implementation, e.g. it does not do proper build isolation.\nThe `PyPA build project <https://github.com/pypa/build>`_ is recommended as an\nalternative, although it's still quite young in October 2020.\nThis layer of functionality in ``pep517`` is now deprecated, but won't be\nremoved for some time, as there is code relying on it.\n\nHigh level usage, with build requirements handled:\n\n.. code-block:: python\n\n    import os\n    from pep517.envbuild import build_wheel, build_sdist\n\n    src = 'path/to/source'  # Folder containing 'pyproject.toml'\n    destination = 'also/a/folder'\n    whl_filename = build_wheel(src, destination)\n    assert os.path.isfile(os.path.join(destination, whl_filename))\n\n    targz_filename = build_sdist(src, destination)\n    assert os.path.isfile(os.path.join(destination, targz_filename))\n\nTo test the build backend for a project, run in a system shell:\n\n.. code-block:: shell\n\n    python3 -m pep517.check path/to/source  # source dir containing pyproject.toml\n\nTo build a backend into source and/or binary distributions, run in a shell:\n\n.. code-block:: shell\n\n    python -m pep517.build path/to/source  # source dir containing pyproject.toml\n\nAll of this high-level functionality is deprecated.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Wrappers to build Python packages using PEP 517 hooks",
    "version": "0.13.1",
    "project_urls": {
        "Homepage": "https://github.com/pypa/pep517"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "256eca4a5434eb0e502210f591b97537d322546e4833dcb4d470a48c375c5540",
                "md5": "821cedd12e73c015c0b02305b74e8c1a",
                "sha256": "31b206f67165b3536dd577c5c3f1518e8fbaf38cbc57efff8369a392feff1721"
            },
            "downloads": -1,
            "filename": "pep517-0.13.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "821cedd12e73c015c0b02305b74e8c1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 19072,
            "upload_time": "2023-11-08T11:27:33",
            "upload_time_iso_8601": "2023-11-08T11:27:33.049705Z",
            "url": "https://files.pythonhosted.org/packages/25/6e/ca4a5434eb0e502210f591b97537d322546e4833dcb4d470a48c375c5540/pep517-0.13.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "44d78f5d2be1a5fed3b0b5ccd3e800153c0f4dd84c2a688d25bce0bb0cb1f87f",
                "md5": "fcf81721b503ebaf63c8dccc576191f4",
                "sha256": "1b2fa2ffd3938bb4beffe5d6146cbcb2bda996a5a4da9f31abffd8b24e07b317"
            },
            "downloads": -1,
            "filename": "pep517-0.13.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fcf81721b503ebaf63c8dccc576191f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 26176,
            "upload_time": "2023-11-08T11:27:34",
            "upload_time_iso_8601": "2023-11-08T11:27:34.682645Z",
            "url": "https://files.pythonhosted.org/packages/44/d7/8f5d2be1a5fed3b0b5ccd3e800153c0f4dd84c2a688d25bce0bb0cb1f87f/pep517-0.13.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-08 11:27:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pypa",
    "github_project": "pep517",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pep517"
}
        
Elapsed time: 0.17602s