Skip to content

Commit d33ade5

Browse files
committed
Use hatch backend
add flake8 config add artifacts cleanup use tbump to get current version cleanup for new dep versions clean up workflows switch back to bumpversion fix verion fixup fixup fixup fixup
1 parent 6c6bd4b commit d33ade5

File tree

12 files changed

+116
-207
lines changed

12 files changed

+116
-207
lines changed

.bumpversion.cfg

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
[bumpversion]
2-
current_version = 7, 0, 0, "alpha", 3
2+
current_version = 7, 0, 0, "a", 3
33
commit = False
44
tag = False
55
parse = (?P<major>\d+)\,\ (?P<minor>\d+)\,\ (?P<patch>\d+)\,\ \"(?P<release>\S+)\"\,\ (?P<build>\d+)
6-
serialize =
7-
{major}, {minor}, {patch}, "{release}", {build}
6+
serialize =
7+
{major}, {minor}, {patch}, "{release}", {build}
88

99
[bumpversion:part:release]
1010
optional_value = final
11-
values =
12-
alpha
13-
beta
14-
candidate
15-
final
11+
values =
12+
a
13+
b
14+
rc
15+
final
1616

1717
[bumpversion:part:build]
1818

1919
[bumpversion:file:notebook/_version.py]
20+
21+
[bumpversion:file:pyproject.toml]
22+
serialize = {major}.{minor}.{patch}{release}{build}

.flake8

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
ignore = E501, W503, E402
3+
builtins = c, get_config
4+
exclude =
5+
.cache,
6+
.github,
7+
docs,
8+
enable-extensions = G
9+
extend-ignore =
10+
G001, G002, G004, G200, G201, G202,
11+
# black adds spaces around ':'
12+
E203,

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
- name: Install the package
4545
run: |
46-
python -m pip install ".[test]"
46+
python -m pip install ".[dev,test]"
4747
jlpm run build:test
4848
4949
- name: Unit tests

.github/workflows/buildutils.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Install dependencies
2727
run: |
28-
python -m pip install -U "jupyterlab>=4.0.0a24,<5" jupyter_packaging~=0.10
28+
python -m pip install -U "jupyterlab>=4.0.0a24,<5"
2929
jlpm
3030
jlpm run build
3131
@@ -80,6 +80,6 @@ jobs:
8080

8181
- name: Install dependencies
8282
run: |
83-
python -m pip install -U "jupyterlab>=4.0.0a24,<5" jupyter_packaging~=0.10 pip
83+
python -m pip install -U "jupyterlab>=4.0.0a24,<5" pip
8484
jlpm
8585
jlpm run build

.github/workflows/docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python_version: '3.7'
2121
- name: Install the Python dependencies
2222
run: |
23-
pip install -e .[test] codecov
23+
pip install -e .[dev,test] codecov
2424
pip install -r docs/doc-requirements.txt
2525
wget https://github.com/jgm/pandoc/releases/download/1.19.1/pandoc-1.19.1-1-amd64.deb && sudo dpkg -i pandoc-1.19.1-1-amd64.deb
2626
- name: List installed packages

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mamba create -n notebook -c conda-forge python nodejs -y
2222
mamba activate notebook
2323

2424
# Install package in development mode
25-
pip install -e .
25+
pip install -e ".[dev,test]"
2626

2727
# Link the notebook extension and @jupyter-notebook schemas
2828
jlpm develop
@@ -107,7 +107,7 @@ speeding up the review process.
107107
As long as your code is valid,
108108
the pre-commit hook should take care of how it should look.
109109
`pre-commit` and its associated hooks will automatically be installed when
110-
you run `pip install -e ".[test]"`
110+
you run `pip install -e ".[dev,test]"`
111111

112112
To install `pre-commit` manually, run the following:
113113

MANIFEST.in

-28
This file was deleted.

buildutils/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { run } from '@jupyterlab/buildutils';
44
* Get the current version of notebook
55
*/
66
export function getPythonVersion(): string {
7-
const cmd = 'python setup.py --version';
7+
const cmd = 'tbump current-version';
88
const lines = run(cmd, { stdio: 'pipe' }, true).split('\n');
99
return lines[lines.length - 1];
1010
}

notebook/_version.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
77

88
# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion
9-
version_info = VersionInfo(7, 0, 0, "alpha", 3)
10-
11-
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
9+
version_info = VersionInfo(7, 0, 0, "a", 3)
1210

1311
__version__ = "{}.{}.{}{}".format(
1412
version_info.major,
@@ -17,6 +15,6 @@
1715
(
1816
""
1917
if version_info.releaselevel == "final"
20-
else _specifier_[version_info.releaselevel] + str(version_info.serial)
18+
else str(version_info.releaselevel) + str(version_info.serial)
2119
),
2220
)

pyproject.toml

+84-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,99 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.10", "jupyterlab>=4.0.0a24,<5", "pre-commit"]
3-
build-backend = "jupyter_packaging.build_api"
2+
requires = ["hatchling>=1.0", "jupyterlab>=4.0.0a24,<5"]
3+
build-backend = "hatchling.build"
44

5-
[license]
6-
file="LICENSE"
5+
[project]
6+
name = "notebook"
7+
version = "7.0.0a3"
8+
description = "Jupyter Notebook - A web-based notebook environment for interactive computing"
9+
readme = "README.md"
10+
license = { file = "LICENSE" }
11+
requires-python = ">=3.7"
12+
authors = [
13+
{ name = "Jupyter Development Team", email = "[email protected]" },
14+
]
15+
keywords = [
16+
"Jupyter",
17+
"JupyterLab",
18+
"Notebook",
19+
]
20+
classifiers = [
21+
"Framework :: Jupyter",
22+
"Intended Audience :: Developers",
23+
"Intended Audience :: Science/Research",
24+
"Intended Audience :: System Administrators",
25+
"License :: OSI Approved :: BSD License",
26+
"Programming Language :: Python",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
]
32+
dependencies = [
33+
"jupyter_server>=1.16.0,<2",
34+
"jupyterlab>=4.0.0a24,<5",
35+
"jupyterlab_server>=2.13,<3",
36+
"notebook_shim>=0.1,<0.2",
37+
"tornado>=6.1.0",
38+
]
739

8-
[tool.jupyter-packaging.options]
9-
skip-if-exists = ["notebook/labextension/static/style.js", "notebook/static/bundle.js"]
10-
ensured-targets = ["notebook/labextension/static/style.js", "notebook/static/bundle.js"]
40+
[project.scripts]
41+
jupyter-notebook = "notebook.app:main"
1142

12-
[tool.jupyter-packaging.builder]
13-
factory = "jupyter_packaging.npm_builder"
43+
[project.urls]
44+
Documentation = "https://jupyter-notebook.readthedocs.io/"
45+
Homepage = "https://github.com/jupyter/notebook"
46+
Source = "https://github.com/jupyter/notebook"
47+
Tracker = "https://github.com/jupyter/notebook/issues"
1448

15-
[tool.jupyter-packaging.build-args]
16-
build_cmd = "build:prod"
17-
npm = ["jlpm"]
49+
[project.optional-dependencies]
50+
test = [
51+
"coverage",
52+
"nbval",
53+
"pytest>=6.0",
54+
"pytest-cov",
55+
"requests",
56+
"pytest-tornasync",
57+
"pytest-timeout",
58+
"pytest-console-scripts",
59+
"ipykernel",
60+
"jupyterlab_server[test]>=2.13,<3",
61+
]
62+
dev = [
63+
"pre-commit",
64+
"bump2version"
65+
]
1866

19-
[tool.check-manifest]
20-
ignore = ["app/**", "binder/**", "buildutils/**", "docs/**", "packages/**", "codecov.yml", "*.json", "yarn.lock", "readthedocs.yml", ".bumpversion.cfg", ".*", "lint-staged.config.js", "*.svg", "notebook/labextension/**", "notebook/schemas/**", "notebook/static/**", "notebook/template/**", "ui-tests/**"]
67+
[tool.hatch.build.targets.wheel.shared-data]
68+
"notebook/labextension" = "share/jupyter/labextensions/@jupyter-notebook/lab-extension"
69+
"notebook/schemas" = "share/jupyter/lab/schemas/@jupyter-notebook/schemas"
70+
"install.json" = "share/jupyter/labextensions/@jupyter-notebook/lab-extension/install.json"
71+
"jupyter-config/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"
72+
73+
74+
[tool.hatch.build]
75+
artifacts = ["notebook/labextension", "notebook/static"]
76+
77+
[tool.hatch.build.hooks.jupyter-builder]
78+
dependencies = ["hatch-jupyter-builder>=0.2"]
79+
build-function = "hatch_jupyter_builder.npm_builder"
80+
ensured-targets = [
81+
"notebook/labextension/static/style.js",
82+
"notebook/static/bundle.js"
83+
]
84+
install-pre-commit-hook = true
85+
86+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
87+
build_cmd = "build:prod"
88+
editable_build_cmd = "build"
89+
npm = "jlpm"
2190

2291
[tool.pytest.ini_options]
2392
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
2493
testpaths = [
25-
"tests/"
94+
"tests/",
2695
]
2796
timeout = 300
28-
# Restore this setting to debug failures
29-
# timeout_method = "thread"
3097
filterwarnings = [
3198
"error",
3299
"ignore:There is no current event loop:DeprecationWarning",

setup.cfg

-77
This file was deleted.

0 commit comments

Comments
 (0)