Skip to content

Commit ec0839c

Browse files
authored
Maintenance cleanup (#325)
1 parent f05a0d6 commit ec0839c

File tree

8 files changed

+112
-113
lines changed

8 files changed

+112
-113
lines changed

.flake8

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 44 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
schedule:
88
- cron: "0 8 * * *"
99

10+
defaults:
11+
run:
12+
shell: bash -eux {0}
13+
1014
jobs:
1115
test:
1216
name: ${{ matrix.os }} ${{ matrix.python-version }}
@@ -24,6 +28,8 @@ jobs:
2428
python-version: "3.9"
2529
- os: ubuntu-latest
2630
python-version: "pypy-3.7"
31+
- os: ubuntu-latest
32+
python-version: "3.11-dev"
2733
- os: macos-latest
2834
python-version: "3.8"
2935
steps:
@@ -37,59 +43,31 @@ jobs:
3743
- name: Run the tests
3844
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}
3945
run: |
40-
args="-vv -raXs --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered --durations 10 --color=yes --cov-fail-under 65"
41-
python -m pytest $args || python -m pytest $args --lf
46+
hatch run cov:test || hatch run test:test --lf
4247
- name: Run the tests on pypy and windows
4348
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
4449
run: |
45-
python -m pytest -vv -raXs || python -m pytest -vv -raXs --lf
50+
hatch run test:test || hatch run test:test --lf
4651
- name: Upload coverage
4752
run: |
53+
pip install codecov
4854
codecov
4955
50-
pre-commit:
51-
name: Run pre-commit hook
56+
pre_commit:
5257
runs-on: ubuntu-latest
5358
timeout-minutes: 5
5459
steps:
5560
- name: Checkout
5661
uses: actions/checkout@v3
5762
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
58-
- name: Run pre-commit
59-
uses: pre-commit/[email protected]
60-
- name: Help message if pre-commit fail
61-
if: ${{ failure() }}
62-
run: |
63-
echo "You can install pre-commit hooks to automatically run formatting"
64-
echo "on each commit with:"
65-
echo " pre-commit install"
66-
echo "or you can run by hand on staged files with"
67-
echo " pre-commit run"
68-
echo "or after-the-fact on already committed files with"
69-
echo " pre-commit run --all-files --hook-stage=manual"
63+
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1
7064

7165
docs:
72-
name: Docs Build
7366
runs-on: ubuntu-latest
7467
steps:
75-
- name: Checkout
76-
uses: actions/checkout@v3
77-
- name: Base Setup
78-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
79-
- uses: conda-incubator/setup-miniconda@v2
80-
with:
81-
auto-update-conda: true
82-
activate-environment: jupyterlab_server_documentation
83-
environment-file: docs/environment.yml
84-
- name: Install lib
85-
shell: bash -l {0}
86-
run: |
87-
pip install .
88-
- name: Build docs
89-
shell: bash -l {0}
90-
run: |
91-
pushd docs
92-
make html SPHINXOPTS="-W"
68+
- uses: actions/checkout@v3
69+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
70+
- run: hatch run docs:build
9371

9472
check_release:
9573
runs-on: ubuntu-latest
@@ -119,7 +97,7 @@ jobs:
11997
- name: Install miniumum versions
12098
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
12199
- name: Run the unit tests
122-
run: python -m pytest -vv -raXs -W default || python -m pytest -vv -raXs -W default --lf
100+
run: pytest -vv -W default || pytest -vv -W default --lf
123101

124102
test_prereleases:
125103
name: Test Prereleases
@@ -138,47 +116,29 @@ jobs:
138116
pip freeze
139117
pip check
140118
- name: Run the tests
141-
run: python -m pytest -vv -raXs -W default || python -m pytest -vv -raXs -W default --lf
119+
run: pytest -W default || pytest -W default --lf
142120

143121
make_sdist:
144122
name: Make SDist
145123
runs-on: ubuntu-latest
146-
timeout-minutes: 20
124+
timeout-minutes: 10
147125
steps:
148-
- uses: actions/checkout@v3
149-
- name: Base Setup
150-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
151-
- name: Build SDist
152-
run: |
153-
pip install build
154-
python -m build --sdist
155-
- uses: actions/upload-artifact@v3
156-
with:
157-
name: "sdist"
158-
path: dist/*.tar.gz
126+
- uses: actions/checkout@v2
127+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
128+
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1
159129

160130
test_sdist:
161131
runs-on: ubuntu-latest
162132
needs: [make_sdist]
163133
name: Install from SDist and Test
164134
timeout-minutes: 20
165135
steps:
166-
- name: Base Setup
167-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
168-
- name: Download sdist
169-
uses: actions/download-artifact@v3
170-
- name: Install From SDist
171-
run: |
172-
set -ex
173-
cd sdist
174-
mkdir test
175-
tar --strip-components=1 -zxvf *.tar.gz -C ./test
176-
cd test
177-
pip install .[test]
178-
- name: Run Test
179-
run: |
180-
cd sdist/test
181-
python -m pytest -vv -raXs || python -m pytest -vv -raXs --lf
136+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
137+
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
138+
with:
139+
package_spec: .
140+
test_command: hatch run test:test || hatch run test:test --lf
141+
- run:
182142
# Ensure that the pytest plugin is importable.
183143
python -c "from jupyterlab_server import pytest_plugin"
184144

@@ -189,3 +149,21 @@ jobs:
189149
- uses: actions/checkout@v3
190150
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
191151
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
152+
153+
tests_check: # This job does nothing and is only used for the branch protection
154+
if: always()
155+
needs:
156+
- test
157+
- pre_commit
158+
- check_links
159+
- docs
160+
- check_release
161+
- test_miniumum_verisons
162+
- test_prereleases
163+
- test_sdist
164+
runs-on: ubuntu-latest
165+
steps:
166+
- name: Decide whether the needed jobs succeeded or failed
167+
uses: re-actors/alls-green@release/v1
168+
with:
169+
jobs: ${{ toJSON(needs) }}

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ repos:
5252
args: [--max-line-length=200]
5353
stages: [manual]
5454

55-
- repo: https://github.com/pycqa/flake8
56-
rev: 5.0.4
55+
- repo: https://github.com/john-hen/Flake8-pyproject
56+
rev: 1.0.1
5757
hooks:
58-
- id: flake8
58+
- id: Flake8-pyproject
59+
alias: flake8
5960
additional_dependencies:
6061
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
6162
stages: [manual]

.readthedocs.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
sphinx:
3+
configuration: docs/source/conf.py
4+
python:
5+
version: 3.8
6+
install:
7+
# install itself with pip install .
8+
- method: pip
9+
path: .
10+
extra_requirements:
11+
- docs

docs/environment.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# sys.path.insert(0, os.path.abspath('.'))
1616
import os.path as osp
1717
import shutil
18+
import sys
1819

1920
HERE = osp.abspath(osp.dirname(__file__))
21+
sys.path.insert(0, osp.join(HERE, "..", ".."))
2022

2123
# -- Project information -----------------------------------------------------
2224

@@ -43,7 +45,6 @@
4345
# ones.
4446
extensions = [
4547
"myst_parser",
46-
"numpydoc",
4748
"autodoc_traits",
4849
"sphinx.ext.autodoc",
4950
"sphinx.ext.intersphinx",

pyproject.toml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ Source = "https://github.com/jupyterlab/jupyterlab_server"
4949
Tracker = "https://github.com/jupyterlab/jupyterlab_server/issues"
5050

5151
[project.optional-dependencies]
52+
docs = [
53+
"autodoc-traits",
54+
"docutils<0.19",
55+
"pydata_sphinx_theme",
56+
"sphinx",
57+
"sphinx-copybutton",
58+
"sphinxcontrib-openapi",
59+
"myst-parser",
60+
"mistune<1",
61+
"jinja2<3.1.0"
62+
]
5263
openapi = [
5364
"openapi_core>=0.14.2",
5465
"ruamel.yaml",
@@ -69,9 +80,26 @@ test = [
6980

7081
[tool.hatch.version]
7182
path = "jupyterlab_server/_version.py"
83+
validate-bump = false
84+
85+
[tool.hatch.envs.docs]
86+
features = ["docs"]
87+
[tool.hatch.envs.docs.scripts]
88+
build = "make -C docs html SPHINXOPTS='-W'"
7289

73-
[tool.jupyter-releaser]
74-
skip = ["check-links"]
90+
[tool.hatch.envs.test]
91+
features = ["test"]
92+
[tool.hatch.envs.test.scripts]
93+
test = "python -m pytest -vv {args}"
94+
nowarn = "python -m pytest -vv -W default {args}"
95+
96+
[tool.hatch.envs.cov]
97+
features = ["test"]
98+
dependencies = ["coverage", "pytest-cov"]
99+
[tool.hatch.envs.cov.env-vars]
100+
ARGS = "-vv --cov jupyterlab_server --cov-branch --cov-report term-missing:skip-covered"
101+
[tool.hatch.envs.cov.scripts]
102+
test = "python -m pytest $ARGS --cov-fail-under 65 {args}"
75103

76104
[tool.pytest.ini_options]
77105
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
@@ -89,3 +117,24 @@ filterwarnings = [
89117
"ignore:Passing a schema to Validator.iter_errors:DeprecationWarning",
90118
"module:Subclassing validator classes is not intended to be part of their public API:DeprecationWarning"
91119
]
120+
121+
[tool.flake8]
122+
ignore = "E501, W503, E402"
123+
builtins = "c, get_config"
124+
exclude = [
125+
".cache",
126+
".github",
127+
"docs",
128+
"setup.py",
129+
]
130+
enable-extensions = "G"
131+
extend-ignore = [
132+
"G001", "G002", "G004", "G200", "G201", "G202",
133+
# black adds spaces around ':'
134+
"E203",
135+
]
136+
per-file-ignores = [
137+
# B011: Do not call assert False since python -O removes these calls
138+
# F841 local variable 'foo' is assigned to but never used
139+
"tests/*: B011", "F841",
140+
]

readthedocs.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)