switch to hatch for python version

Steven Silvester 3 years ago
parent 992956c72e
commit 697ba0fea8

@ -1,19 +0,0 @@
[bumpversion]
current_version = 7, 0, 0, "alpha", 5
commit = False
tag = False
parse = (?P<major>\d+)\,\ (?P<minor>\d+)\,\ (?P<patch>\d+)\,\ \"(?P<release>\S+)\"\,\ (?P<build>\d+)
serialize =
{major}, {minor}, {patch}, "{release}", {build}
[bumpversion:part:release]
optional_value = final
values =
alpha
beta
candidate
final
[bumpversion:part:build]
[bumpversion:file:notebook/_version.py]

@ -63,7 +63,6 @@ commander
// Handle dry runs.
if (opts.dryRun) {
utils.run(`bumpversion --dry-run --verbose ${spec}`);
return;
}
@ -71,7 +70,7 @@ commander
// just the Python version.
if (prev.indexOf('a') !== -1 && spec === 'major') {
// Bump the version.
utils.run(`bumpversion ${spec}`);
utils.run(`hatch run ${spec}`);
// Run the post-bump script.
postbump(commit);
@ -113,7 +112,7 @@ commander
}
// Bump the version.
utils.run(`bumpversion ${spec} --allow-dirty`);
utils.run(`hatch version ${spec}`);
// Run the post-bump script.
postbump(commit);

@ -33,10 +33,7 @@ commander
utils.prebump();
// Patch the python version
utils.run('bumpversion patch'); // switches to alpha
utils.run('bumpversion release --allow-dirty'); // switches to beta
utils.run('bumpversion release --allow-dirty'); // switches to rc.
utils.run('bumpversion release --allow-dirty'); // switches to final.
utils.run('hatch version patch');
// Version the changed
let cmd =

@ -4,7 +4,7 @@ import { run } from '@jupyterlab/buildutils';
* Get the current version of notebook
*/
export function getPythonVersion(): string {
const cmd = 'hatchling version';
const cmd = 'hatch version';
const lines = run(cmd, { stdio: 'pipe' }, true).split('\n');
return lines[lines.length - 1];
}

@ -1,22 +1,38 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import re
from collections import namedtuple
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
# Use "hatch version xx.yy.zz" to handle version changes
__version__ = "7.0.0a5"
# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion
version_info = VersionInfo(7, 0, 0, "alpha", 5)
# PEP440 version parser
_version_regex = re.compile(
r"""
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<micro>\d+)
(?P<releaselevel>((a|b|rc|\.dev)))?
(?P<serial>\d+)?
""",
re.VERBOSE,
)
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
_version_fields = _version_regex.match(__version__).groupdict() # type:ignore
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
__version__ = "{}.{}.{}{}".format(
version_info.major,
version_info.minor,
version_info.micro,
(
""
if version_info.releaselevel == "final"
else _specifier_[version_info.releaselevel] + str(version_info.serial)
),
version_info = VersionInfo(
*[
field
for field in (
int(_version_fields["major"]),
int(_version_fields["minor"]),
int(_version_fields["micro"]),
_version_fields["releaselevel"] or "",
_version_fields["serial"] or "",
)
]
)

@ -70,7 +70,7 @@
"before-build-python": [
"jlpm clean"
],
"before-bump-version": "python -m pip install bump2version"
"before-bump-version": "python -m pip install hatch"
},
"options": {
"version-cmd": [

@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling>=1.0", "jupyterlab>=4.0.0a25,<5", "ypy-websocket==0.2"]
requires = ["hatchling>=1.5", "jupyterlab>=4.0.0a25,<5", "ypy-websocket==0.2"]
build-backend = "hatchling.build"
[project]
@ -62,13 +62,11 @@ test = [
]
dev = [
"pre-commit",
"bump2version",
"hatchling"
"hatch"
]
[tool.hatch.version]
path = "notebook/_version.py"
source = "code"
[tool.hatch.build.targets.wheel.shared-data]
"notebook/labextension" = "share/jupyter/labextensions/@jupyter-notebook/lab-extension"

Loading…
Cancel
Save