jupyter-packaging


Namejupyter-packaging JSON
Version 0.12.3 PyPI version JSON
download
home_page
SummaryJupyter Packaging Utilities.
upload_time2022-08-25 15:31:43
maintainer
docs_urlNone
author
requires_python>=3.7
licenseBSD 3-Clause License Copyright (c) 2017, Project Jupyter All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords ipython jupyter packaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Jupyter Packaging

Tools to help build and install Jupyter Python packages that require a pre-build step that may include JavaScript build steps.

## Install

`pip install jupyter-packaging`

## Usage

There are three ways to use `jupyter-packaging` in another package.
In general, you should not depend on `jupyter_packaging` as a runtime dependency, only as a build dependency.

### As a Build Requirement

Use a `pyproject.toml` file as outlined in [pep-518](https://www.python.org/dev/peps/pep-0518/).
An example:

```toml
[build-system]
requires = ["jupyter_packaging>=0.10,<2"]
build-backend = "setuptools.build_meta"
```

Below is an example `setup.py` using the above config.
It assumes the rest of your metadata is in [`setup.cfg`](https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html).
We wrap the import in a try/catch to allow the file to be run without `jupyter_packaging`
so that `python setup.py` can be run directly when not building.

```py
from setuptools import setup

try:
    from jupyter_packaging import wrap_installers, npm_builder
    builder = npm_builder()
    cmdclass = wrap_installers(pre_develop=builder, pre_dist=builder)
except ImportError:
    cmdclass = {}

setup(cmdclass=cmdclass))
```

### As a Build Backend

Use the `jupyter_packaging` build backend.
The pre-build command is specified as metadata in `pyproject.toml`:

```toml
[build-system]
requires = ["jupyter_packaging>=0.10,<2"]
build-backend = "jupyter_packaging.build_api"

[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
build_cmd = "build:src"
```

The corresponding `setup.py` would be greatly simplified:

```py
from setuptools import setup
setup()
```

The `tool.jupyter-packaging.builder` section expects a `func` value that points to an importable
module and a function with dot separators.  If not given, no pre-build function will run.

The optional `tool.jupyter-packaging.build-args` sections accepts a dict of keyword arguments to
give to the pre-build command.

The build backend does not handle the `develop` command (`pip install -e .`).
If desired, you can wrap just that command:

```py
import setuptools

try:
    from jupyter_packaging import wrap_installers, npm_builder
    builder = npm_builder(build_cmd="build:dev")
    cmdclass = wrap_installers(pre_develop=builder)
except ImportError:
    cmdclass = {}

setup(cmdclass=cmdclass))
```

The optional `tool.jupyter-packaging.options` section accepts the following options:

- `skip-if-exists`: A list of local files whose presence causes the prebuild to skip
- `ensured-targets`: A list of local file paths that should exist when the dist commands are run

### As a Vendored File

Vendor `setupbase.py` locally alongside `setup.py` and import the module directly.

```py
import setuptools
from setupbase import wrap_installers, npm_builder
func = npm_builder()
cmdclass = wrap_installers(post_develop=func, pre_dist=func)
setup(cmdclass=cmdclass)
```

## Usage Notes

- This package does not work with the deprecated `python setup.py bdist_wheel` or `python setup.py sdist` commands, PyPA recommends using the [build](https://pypa-build.readthedocs.io/en/latest/index.html) package (`pip install build && python -m build .`).
- We recommend using `include_package_data=True` and `MANIFEST.in` to control the assets included in the [package](https://setuptools.readthedocs.io/en/latest/userguide/datafiles.html).
- Tools like [`check-manifest`](https://github.com/mgedmin/check-manifest) or [`manifix`](https://github.com/vidartf/manifix) can be used to ensure the desired assets are included.
- Simple uses of `data_files` can be handled in `setup.cfg` or in `setup.py`.  If recursive directories are needed use `get_data_files()` from this package.
- Unfortunately `data_files` are not supported in `develop` mode (a limitation of `setuptools`).  You can work around it by doing a full install (`pip install .`) before the develop install (`pip install -e .`), or by adding a script to push the data files to `sys.base_prefix`.

## Development Install

```bash
git clone https://github.com/jupyter/jupyter-packaging.git
cd jupyter-packaging
pip install -e .[test]
pre-commit install
```

You can test changes locally by creating a `pyproject.toml` with the following, replacing the local path to the git checkout:

```toml
[build-system]
requires = ["jupyter_packaging@file://<path-to-git-checkout>"]
build-backend = "setuptools.build_meta"
```

Note: you need to run `pip cache remove jupyter_packaging` any time changes are made to prevent `pip` from using a cached version of the source.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jupyter-packaging",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "ipython,jupyter,packaging",
    "author": "",
    "author_email": "Jupyter Development Team <jupyter@googlegroups.com>",
    "download_url": "https://files.pythonhosted.org/packages/25/c5/b0e154e6403c6790bb1e66acddf9787296a8196f5b14f4bb9e4c92b6734e/jupyter_packaging-0.12.3.tar.gz",
    "platform": null,
    "description": "# Jupyter Packaging\n\nTools to help build and install Jupyter Python packages that require a pre-build step that may include JavaScript build steps.\n\n## Install\n\n`pip install jupyter-packaging`\n\n## Usage\n\nThere are three ways to use `jupyter-packaging` in another package.\nIn general, you should not depend on `jupyter_packaging` as a runtime dependency, only as a build dependency.\n\n### As a Build Requirement\n\nUse a `pyproject.toml` file as outlined in [pep-518](https://www.python.org/dev/peps/pep-0518/).\nAn example:\n\n```toml\n[build-system]\nrequires = [\"jupyter_packaging>=0.10,<2\"]\nbuild-backend = \"setuptools.build_meta\"\n```\n\nBelow is an example `setup.py` using the above config.\nIt assumes the rest of your metadata is in [`setup.cfg`](https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html).\nWe wrap the import in a try/catch to allow the file to be run without `jupyter_packaging`\nso that `python setup.py` can be run directly when not building.\n\n```py\nfrom setuptools import setup\n\ntry:\n    from jupyter_packaging import wrap_installers, npm_builder\n    builder = npm_builder()\n    cmdclass = wrap_installers(pre_develop=builder, pre_dist=builder)\nexcept ImportError:\n    cmdclass = {}\n\nsetup(cmdclass=cmdclass))\n```\n\n### As a Build Backend\n\nUse the `jupyter_packaging` build backend.\nThe pre-build command is specified as metadata in `pyproject.toml`:\n\n```toml\n[build-system]\nrequires = [\"jupyter_packaging>=0.10,<2\"]\nbuild-backend = \"jupyter_packaging.build_api\"\n\n[tool.jupyter-packaging.builder]\nfactory = \"jupyter_packaging.npm_builder\"\n\n[tool.jupyter-packaging.build-args]\nbuild_cmd = \"build:src\"\n```\n\nThe corresponding `setup.py` would be greatly simplified:\n\n```py\nfrom setuptools import setup\nsetup()\n```\n\nThe `tool.jupyter-packaging.builder` section expects a `func` value that points to an importable\nmodule and a function with dot separators.  If not given, no pre-build function will run.\n\nThe optional `tool.jupyter-packaging.build-args` sections accepts a dict of keyword arguments to\ngive to the pre-build command.\n\nThe build backend does not handle the `develop` command (`pip install -e .`).\nIf desired, you can wrap just that command:\n\n```py\nimport setuptools\n\ntry:\n    from jupyter_packaging import wrap_installers, npm_builder\n    builder = npm_builder(build_cmd=\"build:dev\")\n    cmdclass = wrap_installers(pre_develop=builder)\nexcept ImportError:\n    cmdclass = {}\n\nsetup(cmdclass=cmdclass))\n```\n\nThe optional `tool.jupyter-packaging.options` section accepts the following options:\n\n- `skip-if-exists`: A list of local files whose presence causes the prebuild to skip\n- `ensured-targets`: A list of local file paths that should exist when the dist commands are run\n\n### As a Vendored File\n\nVendor `setupbase.py` locally alongside `setup.py` and import the module directly.\n\n```py\nimport setuptools\nfrom setupbase import wrap_installers, npm_builder\nfunc = npm_builder()\ncmdclass = wrap_installers(post_develop=func, pre_dist=func)\nsetup(cmdclass=cmdclass)\n```\n\n## Usage Notes\n\n- This package does not work with the deprecated `python setup.py bdist_wheel` or `python setup.py sdist` commands, PyPA recommends using the [build](https://pypa-build.readthedocs.io/en/latest/index.html) package (`pip install build && python -m build .`).\n- We recommend using `include_package_data=True` and `MANIFEST.in` to control the assets included in the [package](https://setuptools.readthedocs.io/en/latest/userguide/datafiles.html).\n- Tools like [`check-manifest`](https://github.com/mgedmin/check-manifest) or [`manifix`](https://github.com/vidartf/manifix) can be used to ensure the desired assets are included.\n- Simple uses of `data_files` can be handled in `setup.cfg` or in `setup.py`.  If recursive directories are needed use `get_data_files()` from this package.\n- Unfortunately `data_files` are not supported in `develop` mode (a limitation of `setuptools`).  You can work around it by doing a full install (`pip install .`) before the develop install (`pip install -e .`), or by adding a script to push the data files to `sys.base_prefix`.\n\n## Development Install\n\n```bash\ngit clone https://github.com/jupyter/jupyter-packaging.git\ncd jupyter-packaging\npip install -e .[test]\npre-commit install\n```\n\nYou can test changes locally by creating a `pyproject.toml` with the following, replacing the local path to the git checkout:\n\n```toml\n[build-system]\nrequires = [\"jupyter_packaging@file://<path-to-git-checkout>\"]\nbuild-backend = \"setuptools.build_meta\"\n```\n\nNote: you need to run `pip cache remove jupyter_packaging` any time changes are made to prevent `pip` from using a cached version of the source.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2017, Project Jupyter All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "Jupyter Packaging Utilities.",
    "version": "0.12.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/jupyter/jupyter-packaging/issues",
        "Homepage": "http://jupyter.org",
        "Source": "https://github.com/jupyter/jupyter-packaging/"
    },
    "split_keywords": [
        "ipython",
        "jupyter",
        "packaging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddcb6c4c3e2219c2fe6fff6f9d4bda48da21951c3bd8f39b443a586f13173ea0",
                "md5": "5b9e4230a93928676aa5e17e5e7a8078",
                "sha256": "c1a376b23bcaced6dfc9ab0e924b015ce11552a1a5bccf783c6476957c538348"
            },
            "downloads": -1,
            "filename": "jupyter_packaging-0.12.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b9e4230a93928676aa5e17e5e7a8078",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15663,
            "upload_time": "2022-08-25T15:31:40",
            "upload_time_iso_8601": "2022-08-25T15:31:40.920976Z",
            "url": "https://files.pythonhosted.org/packages/dd/cb/6c4c3e2219c2fe6fff6f9d4bda48da21951c3bd8f39b443a586f13173ea0/jupyter_packaging-0.12.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25c5b0e154e6403c6790bb1e66acddf9787296a8196f5b14f4bb9e4c92b6734e",
                "md5": "9c6834023bd699bda5365ab7ed18bde2",
                "sha256": "9d9b2b63b97ffd67a8bc5391c32a421bc415b264a32c99e4d8d8dd31daae9cf4"
            },
            "downloads": -1,
            "filename": "jupyter_packaging-0.12.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9c6834023bd699bda5365ab7ed18bde2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 25350,
            "upload_time": "2022-08-25T15:31:43",
            "upload_time_iso_8601": "2022-08-25T15:31:43.440350Z",
            "url": "https://files.pythonhosted.org/packages/25/c5/b0e154e6403c6790bb1e66acddf9787296a8196f5b14f4bb9e4c92b6734e/jupyter_packaging-0.12.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-25 15:31:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jupyter",
    "github_project": "jupyter-packaging",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jupyter-packaging"
}
        
Elapsed time: 0.55795s