Skip to main content

A hatch plugin to help build Jupyter packages

Project description

hatch-jupyter-builder

PyPI - Version PyPI - Python Version


This provides a build hook plugin for Hatch that adds a build step for use with Jupyter packages.

Table of Contents

Installation

pip install hatch-jupyter-builder

License

hatch-jupyter-builder is distributed under the terms of the MIT license.

Usage and Configuration

The build hook plugin name is jupyter-builder.

  • pyproject.toml

    [tool.hatch.build.hooks.jupyter-builder]
    dependencies = ["hatch-jupyter-builder"]
    build-function = "hatch_jupyter_builder.npm_builder"
    ensured-targets = ["foo/generated.txt"]
    install-pre-commit-hook = true
    
    [tool.hatch.build.hooks.jupyter-builder.build-kwargs]
    build_cmd = "build:src"
    

Options

The only required fields are dependencies and build-function. The build function is defined as an importable string with a module and a function name, separated by a period. The function must accept a target_name (either "wheel" or "sdist"), and a version (either "standard" or "editable") as its only positional arguments. E.g.

  • builder.py

    def build_func(target_name, version):
        ...
    

Would be defined as build-function = "builder.build_func"

The optional ensured-targets is a list of expected file paths after building a "standard" version sdist or wheel.

The optional build-kwargs is a set of keyword arguments to pass to the build function.

You can also use editable-build-kwargs if the parameters should differ in editable mode. If only the build command is different, you can use editable_build_cmd in build-kwargs instead.

The optional install-pre-commit-hook boolean causes a pre-commit hook to be installed during an editable install.

Npm Builder Function

This library provides a convenenice npm_builder function which can be used to build npm assets as part of the build.

Local Development

To test this package locally with another package, use the following:

[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder@file://<path_to_this_repo>"]

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

hatch_jupyter_builder-0.3.3.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

hatch_jupyter_builder-0.3.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file hatch_jupyter_builder-0.3.3.tar.gz.

File metadata

  • Download URL: hatch_jupyter_builder-0.3.3.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for hatch_jupyter_builder-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e613f418b8c15a9c87dcd7977d0e3466a4c0dd51fb287d1d949b28d1aac8da44
MD5 afd61049c6f61f6d3b3e00dc9ec90278
BLAKE2b-256 92e647db12ab5adfa554ecbf68a1ec6ab4a1b9977c3a1cf6a5b3e1861a20a878

See more details on using hashes here.

File details

Details for the file hatch_jupyter_builder-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_jupyter_builder-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b7b1a7dbd945a2381ee2f749754fd43f1e24520f29dc86c1855db077d7b4e596
MD5 1d7d265e712c4ff1b956d642d351cf2d
BLAKE2b-256 5a615759771cf614c4c2c51fe380563682f58f6d28f4279c8c04fc410a7d3ce8

See more details on using hashes here.

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