Hatch plugin for versioning from a package.json file
Project description
hatch-nodejs-version
This package provides two Hatch plugins:
- version source plugin that reads/writes the package version
from the
version
field of the Node.jspackage.json
file. - metadata hook plugin that reads PEP 621 metadata from the
Node.js
package.json
file.
Table of Contents
Global dependency
Ensure hatch-nodejs-version
is defined within the build-system.requires
field in your pyproject.toml
file.
[build-system]
requires = ["hatchling", "hatch-nodejs-version"]
build-backend = "hatchling.build"
Version source
The version source plugin name is nodejs
.
-
pyproject.toml
[tool.hatch.version] source = "nodejs"
-
hatch.toml
[version] source = "nodejs"
Semver
The semver specification defines the following version sections:
major
minor
patch
pre-release
build
Meanwhile, PEP 440 defines:
epoch
major
minor
patch
pre-release
post-release
dev-release
In order to ensure round-trip support, and ensure semantic consistency between Node.js and Python, this plugin only accepts the common version parts:
major
minor
patch
pre-release
e.g. 1.2.3-rc0
.
Version source options
Option | Type | Default | Description |
---|---|---|---|
path |
str |
package.json |
Relative path to the package.json file. |
Metadata hook
The metadata hook plugin name is nodejs
.
-
pyproject.toml
[tool.hatch.metadata.hooks.nodejs]
-
hatch.toml
[metadata.hooks.nodejs]
Metadata hook options
Option | Type | Default | Description |
---|---|---|---|
path |
str |
"package.json" |
Relative path to the package.json file. |
fields |
list of str |
None |
Optional list of pyproject.toml fields to take from their counterparts in package.json . If missing, take all of the available fields. |
contributors-as-maintainers |
bool |
True |
Whether contributors in package.json should be considered maintainers (otherwise, treat them as authors). |
bugs-label |
str |
"Bug Tracker" |
The key in the URLs table of pyproject.toml that is populated by the bugs field in package.json |
homepage-label |
str |
"Homepage" |
The key in the URLs table of pyproject.toml that is populated by the homepage field in package.json |
repository-label |
str |
"Repository" |
The key in the URLs table of pyproject.toml that is populated by the repository field in package.json |
License
hatch-nodejs-version
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hatch_nodejs_version-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e55fd713d92c5c1ccfee778efecaa780fd8bcd276d4ca7aff9f6791f6f76d9c |
|
MD5 | 6e5f9d5cfa442572637478cacaa8ea81 |
|
BLAKE2b-256 | 1af7e563b874c1ebd181e002b56801562516408fa1ff12bbba4f803faa4f433b |
Hashes for hatch_nodejs_version-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4570e00fe75a99075dd51d195352c9d7cc2f6186d4046ce58fd47da3a0583702 |
|
MD5 | 9c07b7ee04ba74c5c586dbba9a2bad2a |
|
BLAKE2b-256 | f35ba19a9262a2c0079685f43a961b400a280c6db1670c844093145edef902c5 |