-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix bumping version * Improve linter configuration * Blacken * Install build dep * Fix bump version dep installation * Strip output * Correctly fix version
- Loading branch information
1 parent
89d0e43
commit 7b3146a
Showing
10 changed files
with
107 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ dist | |
coverage | ||
**/*.d.ts | ||
tests | ||
app/build | ||
|
||
**/__tests__ | ||
ui-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
**/lib | ||
**/package.json | ||
jupyterlab_rise | ||
app/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
import argparse | ||
import json | ||
import shlex | ||
import sys | ||
from pathlib import Path | ||
from subprocess import check_output, run | ||
|
||
from packaging.version import parse | ||
|
||
LERNA_CMD = "jlpm run lerna version --no-push --force-publish --no-git-tag-version" | ||
|
||
|
||
def bump(force: bool, spec: str) -> None: | ||
HERE = Path(__file__).parent.parent.resolve() | ||
output = check_output( | ||
shlex.split("git status --porcelain"), cwd=HERE, encoding="utf-8" | ||
) | ||
if len(output) > 0: | ||
raise Exception("Must be in a clean git state with no untracked files") | ||
|
||
curr = parse( | ||
# Output maybe multi-lines if build dependencies needs to be installed. | ||
check_output( | ||
[sys.executable, "-m", "hatch", "version"], cwd=HERE, encoding="utf-8" | ||
).strip("\n").split("\n")[-1] | ||
) | ||
if spec == "next": | ||
spec = f"{curr.major}.{curr.minor}." | ||
if curr.pre: | ||
p, x = curr.pre | ||
spec += f"{curr.micro}{p}{x + 1}" | ||
else: | ||
spec += f"{curr.micro + 1}" | ||
|
||
elif spec == "patch": | ||
spec = f"{curr.major}.{curr.minor}." | ||
if curr.pre: | ||
spec += f"{curr.micro}" | ||
else: | ||
spec += f"{curr.micro + 1}" | ||
|
||
version = parse(spec) | ||
|
||
# convert the Python version | ||
js_version = f"{version.major}.{version.minor}.{version.micro}" | ||
if version.pre is not None: | ||
p, x = version.pre | ||
p = p.replace("a", "alpha").replace("b", "beta") | ||
js_version += f"-{p}.{x}" | ||
|
||
# bump the JS packages | ||
lerna_cmd = f"{LERNA_CMD} {js_version}" | ||
if force: | ||
lerna_cmd += " --yes" | ||
run(shlex.split(lerna_cmd), cwd=HERE) | ||
|
||
path = HERE.joinpath("package.json") | ||
if path.exists(): | ||
with path.open(mode="r") as f: | ||
data = json.load(f) | ||
|
||
data["version"] = js_version | ||
|
||
with path.open(mode="w") as f: | ||
json.dump(data, f, indent=2) | ||
|
||
else: | ||
raise FileNotFoundError(f"Could not find package.json under dir {path!s}") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser("bump_version", "Bump package version") | ||
parser.add_argument("--force", action="store_true") | ||
parser.add_argument("spec") | ||
|
||
args = parser.parse_args() | ||
bump(args.force, args.spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__import__('setuptools').setup() | ||
__import__("setuptools").setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters