Skip to content

Commit cded2be

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 fix version check fixups try version handling again version cleanup fix typescript error undo bump2version changes include schemas and add build timeouts fix workflow syntax more workflow cleanup clean up config
1 parent 5952653 commit cded2be

13 files changed

+123
-206
lines changed

.bumpversion.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ current_version = 7, 0, 0, "alpha", 4
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 =
6+
serialize =
77
{major}, {minor}, {patch}, "{release}", {build}
88

99
[bumpversion:part:release]
1010
optional_value = final
11-
values =
11+
values =
1212
alpha
1313
beta
1414
candidate

.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

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232

3333
test:
3434
runs-on: ubuntu-latest
35+
timeout-minutes: 10
3536
steps:
3637
- name: Checkout
3738
uses: actions/checkout@v2
@@ -43,7 +44,7 @@ jobs:
4344

4445
- name: Install the package
4546
run: |
46-
python -m pip install ".[test]"
47+
python -m pip install ".[dev,test]"
4748
jlpm run build:test
4849
4950
- name: Unit tests
@@ -60,6 +61,7 @@ jobs:
6061
install:
6162
needs: [build]
6263
runs-on: ${{ matrix.os }}
64+
timeout-minutes: 10
6365
strategy:
6466
fail-fast: false
6567
matrix:

.github/workflows/buildutils.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ concurrency:
1616
jobs:
1717
versioning:
1818
runs-on: ubuntu-latest
19+
timeout-minutes: 10
1920
steps:
2021
- name: Checkout
2122
uses: actions/checkout@v2
@@ -25,7 +26,7 @@ jobs:
2526

2627
- name: Install dependencies
2728
run: |
28-
python -m pip install -U "jupyterlab>=4.0.0a25,<5" jupyter_packaging~=0.10
29+
python -m pip install -U "jupyterlab>=4.0.0a24,<5" hatch
2930
jlpm
3031
jlpm run build
3132
@@ -80,6 +81,6 @@ jobs:
8081

8182
- name: Install dependencies
8283
run: |
83-
python -m pip install -U "jupyterlab>=4.0.0a25,<5" jupyter_packaging~=0.10 pip
84+
python -m pip install -U "jupyterlab>=4.0.0a2t,<5" pip
8485
jlpm
8586
jlpm run build

.github/workflows/check-release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515
jobs:
1616
check_release:
1717
runs-on: ubuntu-latest
18+
timeout-minutes: 30
1819
strategy:
1920
matrix:
2021
group: [check_release, link_check]

.github/workflows/docs.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ concurrency:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
timeout-minutes: 10
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v2
@@ -20,7 +21,7 @@ jobs:
2021
python_version: '3.7'
2122
- name: Install the Python dependencies
2223
run: |
23-
pip install -e .[test] codecov
24+
pip install -e .[dev,test] codecov
2425
pip install -r docs/doc-requirements.txt
2526
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
2627
- name: List installed packages

.github/workflows/ui-tests.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
ui-tests:
2525
needs: [build]
2626
runs-on: ubuntu-latest
27+
timeout-minutes: 10
2728
strategy:
2829
fail-fast: false
2930
matrix:
@@ -32,21 +33,14 @@ jobs:
3233
- name: Checkout
3334
uses: actions/checkout@v2
3435

35-
- name: Install Python
36-
uses: actions/setup-python@v2
37-
with:
38-
python-version: '3.9'
39-
architecture: 'x64'
36+
- name: Base Setup
37+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
4038

4139
- uses: actions/download-artifact@v2
4240
with:
4341
name: notebook-dist-${{ github.run_number }}
4442
path: ./dist
4543

46-
- name: Install the prerequisites
47-
run: |
48-
python -m pip install pip wheel
49-
5044
- name: Install the package
5145
run: |
5246
cd dist

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 = 'hatchling version';
88
const lines = run(cmd, { stdio: 'pipe' }, true).split('\n');
99
return lines[lines.length - 1];
1010
}

pyproject.toml

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

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

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/**"]
72+
[tool.hatch.build.targets.wheel.shared-data]
73+
"notebook/labextension" = "share/jupyter/labextensions/@jupyter-notebook/lab-extension"
74+
"notebook/schemas/@jupyter-notebook" = "share/jupyter/lab/schemas/@jupyter-notebook"
75+
"jupyter-config/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"
76+
77+
78+
[tool.hatch.build]
79+
artifacts = [
80+
"notebook/labextension",
81+
"notebook/static",
82+
"notebook/schemas"
83+
]
84+
85+
[tool.hatch.build.hooks.jupyter-builder]
86+
dependencies = ["hatch-jupyter-builder>=0.2"]
87+
build-function = "hatch_jupyter_builder.npm_builder"
88+
ensured-targets = [
89+
"notebook/labextension/static/style.js",
90+
"notebook/static/bundle.js"
91+
]
92+
install-pre-commit-hook = true
93+
94+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
95+
build_cmd = "build:prod"
96+
editable_build_cmd = "build"
97+
source_dir = "packages"
98+
build_dir = "notebook/static"
99+
npm = "jlpm"
21100

22101
[tool.pytest.ini_options]
23102
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
24103
testpaths = [
25-
"tests/"
104+
"tests/",
26105
]
27106
timeout = 300
28-
# Restore this setting to debug failures
29-
# timeout_method = "thread"
30107
filterwarnings = [
31108
"error",
32109
"ignore:There is no current event loop:DeprecationWarning",

setup.cfg

-77
This file was deleted.

0 commit comments

Comments
 (0)