Skip to content

Commit b4f4fa6

Browse files
authored
Merge pull request #389 from blink1073/update-packaging
Clean up packaging and add py312 support
2 parents d455f4e + 70302e0 commit b4f4fa6

File tree

14 files changed

+124
-252
lines changed

14 files changed

+124
-252
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,8 @@ on:
77
- main
88

99
jobs:
10-
check_duplicate_runs:
11-
name: Check for duplicate runs
12-
continue-on-error: true
13-
runs-on: ubuntu-latest
14-
outputs:
15-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
16-
steps:
17-
- id: skip_check
18-
uses: fkirc/skip-duplicate-actions@master
19-
with:
20-
concurrent_skipping: always
21-
cancel_others: true
22-
skip_after_successful_duplicate: true
23-
paths_ignore: '["**/README.md", "**/CHANGELOG.md", "**/LICENSE.md"]'
24-
do_not_skip: '["pull_request"]'
25-
2610
tests:
2711
name: Run tests (Python ${{matrix.python}})
28-
needs: check_duplicate_runs
29-
if: ${{ needs.check_duplicate_runs.outputs.should_skip != 'true' }}
3012

3113
strategy:
3214
matrix:
@@ -35,48 +17,29 @@ jobs:
3517
- "3.9"
3618
- "3.10"
3719
- "3.11"
20+
- "3.12"
3821

3922
runs-on: ubuntu-latest
40-
4123
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v2
44-
45-
- name: Set up Python
46-
uses: actions/setup-python@v2
47-
with:
48-
python-version: ${{ matrix.python }}
4924

50-
- name: Cache pip
51-
uses: actions/cache@v2
52-
with:
53-
path: ~/.cache/pip
54-
key: ${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}
55-
restore-keys: |
56-
${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}
57-
${{ runner.os }}-python-${{ matrix.python }}-pip-
58-
${{ runner.os }}-python
59-
${{ runner.os }}-
25+
- name: Checkout
26+
uses: actions/checkout@v4
6027

61-
- name: Upgrade pip
62-
run: python -m pip install --upgrade pip setuptools wheel
28+
- name: Base Setup
29+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
6330

6431
- name: Install dependencies
6532
run: |
66-
pip install --upgrade -r requirements.txt -r requirements-test.txt
6733
pip install -e .
6834
pip freeze
6935
7036
- name: Show help
7137
run: jupyter kernelgateway --help
7238

7339
- name: Run tests
74-
run: pytest -vv -W default --cov kernel_gateway --cov-branch --cov-report term-missing:skip-covered
40+
run: hatch run cov:test
7541
env:
7642
ASYNC_TEST_TIMEOUT: 10
7743

78-
- name: Upload coverage to Codecov
79-
uses: codecov/codecov-action@v1
80-
with:
81-
token: ${{ secrets.CODECOV_TOKEN }}
82-
fail_ci_if_error: true
44+
- name: Build docs
45+
run: hatch run docs:build

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ repos:
33
rev: v4.4.0
44
hooks:
55
- id: end-of-file-fixer
6+
7+
- repo: https://github.com/python-jsonschema/check-jsonschema
8+
rev: 0.27.3
9+
hooks:
10+
- id: check-github-workflows

Makefile

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

codecov.yml

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

docs/source/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"myst_parser"
3636
]
3737

38+
myst_enable_extensions = ["attrs_block", "attrs_inline"]
39+
3840
# Add any paths that contain templates here, relative to this directory.
3941
templates_path = ['_templates']
4042

@@ -71,7 +73,7 @@
7173
#
7274
# This is also used if you do content translation via gettext catalogs.
7375
# Usually you set "language" from the command line for these cases.
74-
language = None
76+
language = "en"
7577

7678
# There are two options for replacing |today|: either, you set today to some
7779
# non-false value, then it is used:
@@ -362,7 +364,7 @@
362364

363365

364366
# Example configuration for intersphinx: refer to the Python standard library.
365-
intersphinx_mapping = {'https://docs.python.org/3/': None}
367+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
366368

367369
# Read The Docs
368370
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org

docs/source/http-mode.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ The `REQUEST` object currently contains the following properties:
4646
* `path` - An object of key-value pairs representing path parameters and their values.
4747
* `headers` - An object of key-value pairs where a key is a HTTP header name and a value is the HTTP header value. If there are multiple values are specified for a header, the value will be an array.
4848

49+
{#request-content-type-and-request-body-processing}
50+
4951
### Request Content-Type and Request Body Processing
5052

5153
If the HTTP request to the kernel gateway has a `Content-Type` header the value of `REQUEST.body` may change. Below is the list of outcomes for various mime-types:

kernel_gateway/_version.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
# Copyright (c) Jupyter Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
version_info = (2, 6, 0, 'dev0')
6+
import re
7+
from typing import List
78

8-
__version__ = '.'.join(map(str, version_info))
9+
# Version string must appear intact for automatic versioning
10+
__version__ = "2.6.0.dev0"
11+
12+
# Build up version_info tuple for backwards compatibility
13+
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
14+
match = re.match(pattern, __version__)
15+
assert match is not None
16+
parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
17+
if match["rest"]:
18+
parts.append(match["rest"])
19+
version_info = tuple(parts)

kernel_gateway/gatewayapp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import ssl
1717
import threading
1818
from base64 import encodebytes
19-
from distutils.util import strtobool
2019

2120
import nbformat
2221
from jupyter_server.services.kernels.kernelmanager import MappingKernelManager
@@ -189,7 +188,7 @@ def expose_headers_default(self):
189188
)
190189
@default('trust_xheaders')
191190
def trust_xheaders_default(self):
192-
return strtobool(os.getenv(self.trust_xheaders_env, 'False'))
191+
return os.getenv(self.trust_xheaders_env, 'False').lower() == 'true'
193192

194193

195194
max_age_env = 'KG_MAX_AGE'

pyproject.toml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
[build-system]
2+
requires = ["hatchling>=1.5"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "jupyter-kernel-gateway"
7+
dynamic = ["version"]
8+
description = "A web server for spawning and communicating with Jupyter kernels"
9+
readme = "README.md"
10+
license = { file = "LICENSE.md" }
11+
requires-python = ">=3.8"
12+
authors = [
13+
{ name = "Jupyter Development Team", email = "[email protected]" },
14+
]
15+
keywords = [
16+
"Cloud",
17+
"Interactive",
18+
"Interpreter",
19+
"Kernel",
20+
"Web",
21+
]
22+
classifiers = [
23+
"Intended Audience :: Developers",
24+
"Intended Audience :: Science/Research",
25+
"Intended Audience :: System Administrators",
26+
"License :: OSI Approved :: BSD License",
27+
"Operating System :: OS Independent",
28+
"Programming Language :: Python",
29+
"Programming Language :: Python :: 3",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Python :: 3.11",
34+
]
35+
dependencies = [
36+
"jupyter_client>=7.4.4",
37+
"jupyter_core>=4.12,!=5.0.*",
38+
"jupyter_server>=2.0",
39+
"requests>=2.7,<3.0",
40+
"tornado>=6.2.0",
41+
"traitlets>=5.6.0",
42+
]
43+
44+
[project.scripts]
45+
jupyter-kernelgateway = "kernel_gateway:launch_instance"
46+
47+
[project.urls]
48+
Homepage = "http://github.com/jupyter-incubator/kernel_gateway"
49+
50+
[project.optional-dependencies]
51+
test = [
52+
"coverage",
53+
"pytest",
54+
"pytest-cov",
55+
"pytest_jupyter",
56+
"pytest-timeout",
57+
"ipykernel",
58+
]
59+
docs = [
60+
"sphinx_rtd_theme",
61+
"sphinx",
62+
"myst-parser",
63+
]
64+
65+
[tool.hatch.version]
66+
path = "kernel_gateway/_version.py"
67+
68+
[tool.hatch.build.targets.sdist]
69+
include = [
70+
"/kernel_gateway",
71+
]
72+
73+
[tool.hatch.build.targets.wheel]
74+
packages = ["kernel_gateway"]
75+
76+
[tool.hatch.envs.docs]
77+
features = ["docs"]
78+
[tool.hatch.envs.docs.scripts]
79+
build = "make -C docs html SPHINXOPTS='-W'"
80+
81+
[tool.hatch.envs.test]
82+
features = ["test"]
83+
[tool.hatch.envs.test.scripts]
84+
test = "python -m pytest -vv {args}"
85+
86+
[tool.hatch.envs.cov]
87+
features = ["test"]
88+
dependencies = ["coverage[toml]", "pytest-cov"]
89+
[tool.hatch.envs.cov.scripts]
90+
test = "python -m pytest -vv --cov kernel_gateway --cov-branch --cov-report term-missing:skip-covered {args}"

requirements-doc.txt

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

0 commit comments

Comments
 (0)