Skip to content

Commit 9fad774

Browse files
authored
Migrate to Hatch (#1166)
* Migrate to Hatch * Remove extraneous build script * Fix a typo * Remove commented lines
1 parent 3baddd0 commit 9fad774

File tree

7 files changed

+76
-97
lines changed

7 files changed

+76
-97
lines changed

environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- conda-forge
44
dependencies:
55
- pip
6+
- build
67
- wheel
78
- jupyterlab~=4.0
89
- jupyter-packaging~=0.12

ipyleaflet/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
import sys
6-
from ._version import version_info, __version__ # noqa
6+
from ._version import __version__ # noqa
77

88
from .leaflet import * # noqa
99
from .basemaps import basemaps # noqa

ipyleaflet/_version.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
3-
#
4-
5-
version_info = (0, 18, 1)
6-
7-
__version__ = "%s.%s.%s" % (version_info[0], version_info[1], version_info[2])
83

94
EXTENSION_VERSION = "^0.18"
5+
__version__ = "0.18.1"

js/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"build:lib": "tsc",
2626
"build:nbextension": "webpack --no-devtool",
2727
"build:labextension": "jupyter labextension build .",
28-
"build:extensions": "yarn run build && yarn run build:labextension",
2928
"clean": "yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension",
3029
"clean:lib": "rimraf lib",
3130
"clean:nbextension": "rimraf ../ipyleaflet/nbextension/index.js",

pyproject.toml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,75 @@
11
[build-system]
2-
# avoid 3.6 so we don't need the rust buildchain
3-
requires = ["jupyter_packaging~=0.12", "jupyterlab~=4.0.8", "setuptools>=40.8.0", "wheel"]
4-
build-backend = "setuptools.build_meta"
2+
requires = [
3+
"hatchling",
4+
"jupyterlab==4.*",
5+
]
6+
build-backend = "hatchling.build"
7+
8+
[project]
9+
name = "ipyleaflet"
10+
version = "0.18.1"
11+
description = "A Jupyter widget for dynamic Leaflet maps"
12+
readme = "README.md"
13+
authors = [
14+
{ name = "Project Jupyter", email = "[email protected]" },
15+
]
16+
keywords = [
17+
"ipython", "jupyter", "widgets", "graphics", "GIS",
18+
]
19+
classifiers = [
20+
"Development Status :: 4 - Beta",
21+
"Intended Audience :: Developers",
22+
"Intended Audience :: Science/Research",
23+
"Topic :: Multimedia :: Graphics",
24+
"License :: OSI Approved :: MIT License",
25+
"Programming Language :: Python :: 3",
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+
"ipywidgets>=7.6.0,<9",
33+
"traittypes>=0.2.1,<3",
34+
"xyzservices>=2021.8.1",
35+
"branca>=0.5.0",
36+
]
37+
38+
[project.urls]
39+
Homepage = "https://github.com/jupyter-widgets/ipyleaflet"
40+
41+
[tool.hatch.build]
42+
artifacts = [
43+
"ipyleaflet/nbextension/index.*",
44+
"ipyleaflet/labextension",
45+
]
46+
47+
[tool.hatch.build.targets.wheel.shared-data]
48+
"ipyleaflet/nbextension" = "share/jupyter/nbextensions/jupyter-leaflet"
49+
"ipyleaflet/labextension" = "share/jupyter/labextensions/jupyter-leaflet"
50+
"jupyter-leaflet.json" = "etc/jupyter/nbconfig/notebook.d/jupyter-leaflet.json"
51+
52+
[tool.hatch.build.targets.sdist]
53+
exclude = [
54+
".github",
55+
]
56+
57+
[tool.hatch.build.hooks.jupyter-builder]
58+
ensured-targets = [
59+
"ipyleaflet/nbextension/index.js",
60+
"ipyleaflet/labextension/package.json",
61+
]
62+
dependencies = [
63+
"hatch-jupyter-builder>=0.8.1",
64+
]
65+
build-function = "hatch_jupyter_builder.npm_builder"
66+
67+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
68+
path = "./js"
69+
build_cmd = "build"
70+
npm = [
71+
"jlpm",
72+
]
573

674
[tool.ruff]
775
extend-include = ["*.ipynb"]

setup.cfg

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

setup.py

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,2 @@
1-
# -*- coding: utf-8 -*-
2-
3-
import os
4-
from setuptools import setup, find_packages
5-
6-
from jupyter_packaging import (
7-
create_cmdclass,
8-
install_npm,
9-
ensure_targets,
10-
combine_commands,
11-
get_version,
12-
skip_if_exists,
13-
)
14-
15-
# the name of the package
16-
name = "ipyleaflet"
17-
long_description = "A Jupyter widget for dynamic Leaflet maps"
18-
19-
here = os.path.dirname(os.path.abspath(__file__))
20-
21-
# Get ipyleaflet version
22-
version = get_version(os.path.join(name, "_version.py"))
23-
24-
js_dir = os.path.join(here, "js")
25-
26-
# Representative files that should exist after a successful build
27-
jstargets = [
28-
os.path.join("ipyleaflet/nbextension", "index.js"),
29-
os.path.join("ipyleaflet/labextension", "package.json"),
30-
]
31-
32-
data_files_spec = [
33-
("share/jupyter/nbextensions/jupyter-leaflet", "ipyleaflet/nbextension", "*.*"),
34-
("share/jupyter/labextensions/jupyter-leaflet", "ipyleaflet/labextension", "**"),
35-
("etc/jupyter/nbconfig/notebook.d", ".", "jupyter-leaflet.json"),
36-
]
37-
38-
cmdclass = create_cmdclass("jsdeps", data_files_spec=data_files_spec)
39-
js_command = combine_commands(
40-
install_npm(js_dir, npm=["yarn"], build_cmd="build"),
41-
ensure_targets(jstargets),
42-
)
43-
44-
is_repo = os.path.exists(os.path.join(here, ".git"))
45-
if is_repo:
46-
cmdclass["jsdeps"] = js_command
47-
else:
48-
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
49-
50-
setup_args = dict(
51-
name=name,
52-
version=version,
53-
description="A Jupyter widget for dynamic Leaflet maps",
54-
long_description=long_description,
55-
license="MIT License",
56-
python_requires=">=3.7",
57-
include_package_data=True,
58-
install_requires=[
59-
"ipywidgets>=7.6.0,<9",
60-
"traittypes>=0.2.1,<3",
61-
"xyzservices>=2021.8.1",
62-
"branca>=0.5.0",
63-
],
64-
packages=find_packages(),
65-
zip_safe=False,
66-
cmdclass=cmdclass,
67-
author="Project Jupyter",
68-
author_email="[email protected]",
69-
url="https://github.com/jupyter-widgets/ipyleaflet",
70-
keywords=["ipython", "jupyter", "widgets", "graphics", "GIS"],
71-
classifiers=[
72-
"Development Status :: 4 - Beta",
73-
"Intended Audience :: Developers",
74-
"Intended Audience :: Science/Research",
75-
"Topic :: Multimedia :: Graphics",
76-
"License :: OSI Approved :: MIT License",
77-
"Programming Language :: Python :: 3",
78-
"Programming Language :: Python :: 3.7",
79-
"Programming Language :: Python :: 3.8",
80-
"Programming Language :: Python :: 3.9",
81-
"Programming Language :: Python :: 3.10",
82-
],
83-
)
84-
85-
setup(**setup_args)
1+
# Copyright (c) Jupyter Development Team.
2+
__import__("setuptools").setup()

0 commit comments

Comments
 (0)