Skip to content

Commit 3c8c5d4

Browse files
committed
Clean up packaging and add py312 support
1 parent d455f4e commit 3c8c5d4

File tree

12 files changed

+114
-203
lines changed

12 files changed

+114
-203
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- "3.9"
3636
- "3.10"
3737
- "3.11"
38+
- "3.12"
3839

3940
runs-on: ubuntu-latest
4041

@@ -58,23 +59,22 @@ jobs:
5859
${{ runner.os }}-python
5960
${{ runner.os }}-
6061
61-
- name: Upgrade pip
62-
run: python -m pip install --upgrade pip setuptools wheel
63-
6462
- name: Install dependencies
6563
run: |
66-
pip install --upgrade -r requirements.txt -r requirements-test.txt
67-
pip install -e .
64+
pip install -e ".""
6865
pip freeze
6966
7067
- name: Show help
7168
run: jupyter kernelgateway --help
7269

7370
- name: Run tests
74-
run: pytest -vv -W default --cov kernel_gateway --cov-branch --cov-report term-missing:skip-covered
71+
run: hatch run cov:test
7572
env:
7673
ASYNC_TEST_TIMEOUT: 10
7774

75+
- name: Build docs
76+
run: hatch run docs:build
77+
7878
- name: Upload coverage to Codecov
7979
uses: codecov/codecov-action@v1
8080
with:

Makefile

Lines changed: 0 additions & 81 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: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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 = "BSD"
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.envs.docs]
74+
features = ["docs"]
75+
[tool.hatch.envs.docs.scripts]
76+
build = "make -C docs html SPHINXOPTS='-W'"
77+
78+
[tool.hatch.envs.test]
79+
features = ["test"]
80+
[tool.hatch.envs.test.scripts]
81+
test = "python -m pytest -vv {args}"
82+
83+
[tool.hatch.envs.cov]
84+
features = ["test"]
85+
dependencies = ["coverage[toml]", "pytest-cov"]
86+
[tool.hatch.envs.cov.scripts]
87+
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.

requirements-test.txt

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

requirements.txt

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

0 commit comments

Comments
 (0)