Hatch plugin for versioning from a package.json file
Project description
hatch-nodejs-version
This provides a version source plugin for Hatch that reads/writes the package version from the version
field of the NodeJS 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 NodeJS 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 fields to take from the generated metadata object. |
contributors-as-maintainers |
bool |
True |
Whether contributors in package.json should be considered maintainers (otherwise, treat them as authors) |
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
File details
Details for the file hatch_nodejs_version-0.2.1.post2.tar.gz
.
File metadata
- Download URL: hatch_nodejs_version-0.2.1.post2.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fa60740bc0318368aa365ed6cb44754cc310ef7c679b410b788664360aa15eb |
|
MD5 | 42e5d6fd6cd6c996015925bda4a881c6 |
|
BLAKE2b-256 | 467a6134e200730b7c0a2ad27607e184ed8e77b5232c0a99289eccbf764d4443 |
File details
Details for the file hatch_nodejs_version-0.2.1.post2-py3-none-any.whl
.
File metadata
- Download URL: hatch_nodejs_version-0.2.1.post2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d91d714f28dbdd577e8d9be382352e64baf0149692d63bf8da0d37faa4b61373 |
|
MD5 | 8b4ebe3e06821a09d656bd4209658389 |
|
BLAKE2b-256 | d1106a11a6063e0a454c751ca68c98422d98500b6cf2bcfe5296266d8f667150 |