Skip to content

Commit

Permalink
Merge pull request #931 from blink1073/use-hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored May 20, 2022
2 parents d02f437 + 0e57c3e commit 5817d29
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 151 deletions.
8 changes: 0 additions & 8 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@

[bdist_wheel]
universal=0

[metadata]
license_file = COPYING.md
version = attr: ipykernel._version.__version__

[flake8]
ignore = E501, W503, E402
builtins = c, get_config
Expand Down
25 changes: 25 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import shutil
import sys

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomHook(BuildHookInterface):
def initialize(self, version, build_data):
here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, here)
from ipykernel.kernelspec import make_ipkernel_cmd, write_kernel_spec

# When building a standard wheel, the executable specified in the kernelspec is simply 'python'.
if version == "standard":
argv = make_ipkernel_cmd(executable="python")

# When installing an editable wheel, the full `sys.executable` can be used.
else:
argv = make_ipkernel_cmd()

dest = os.path.join(here, "data_kernelspec")
if os.path.exists(dest):
shutil.rmtree(dest)
write_kernel_spec(dest, overrides={"argv": argv})
5 changes: 4 additions & 1 deletion ipykernel/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from jupyter_client.kernelspec import KernelSpecManager
from traitlets import Unicode

from .debugger import _is_debugpy_available
try:
from .debugger import _is_debugpy_available
except ImportError:
_is_debugpy_available = False

pjoin = os.path.join

Expand Down
67 changes: 57 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,60 @@
[build-system]
build-backend = "setuptools.build_meta"
requires=[
"setuptools",
"wheel",
"debugpy",
"ipython>=5",
"jupyter_core>=4.2",
"jupyter_client",
requires = ["hatchling>=0.25", "jupyter_client>=6"]
build-backend = "hatchling.build"

[project]
name = "ipykernel"
version = "6.13.0"
authors = [{name = "IPython Development Team", email = "[email protected]"}]
license = {file = "COPYING.md"}
readme = "README.md"
description = "IPython Kernel for Jupyter"
keywords = ["Interactive", "Interpreter", "Shell", "Web"]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
urls = {Homepage = "https://ipython.org"}
requires-python = ">=3.7"
dependencies = [
"debugpy>=1.0",
"ipython>=7.23.1",
"traitlets>=5.1.0",
"jupyter_client>=6.1.12",
"tornado>=6.1",
"matplotlib-inline>=0.1",
'appnope;platform_system=="Darwin"',
"psutil",
"nest_asyncio",
"packaging",
]

[project.optional-dependencies]
test = [
"pytest>=6.0",
"pytest-cov",
"flaky",
"ipyparallel",
"pre-commit",
"pytest-timeout",
]

[tool.check-manifest]
ignore = []
# Used to call hatch_build.py
[tool.hatch.build.hooks.custom]

[tool.hatch.build.targets.wheel.shared-data]
"data_kernelspec" = "share/jupyter/kernels/python3"

[tool.hatch.build]
artifacts = ["ipykernel_launcher.py"]

[tool.jupyter-releaser]
skip = ["check-links"]
Expand All @@ -29,6 +73,9 @@ tag_template = "v{new_version}"
[[tool.tbump.file]]
src = "ipykernel/_version.py"

[[tool.tbump.file]]
src = "pyproject.toml"

[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
Expand Down
132 changes: 0 additions & 132 deletions setup.py

This file was deleted.

0 comments on commit 5817d29

Please sign in to comment.