Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Hatch #1166

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- pip
- build
- wheel
- jupyterlab~=4.0
- jupyter-packaging~=0.12
Expand Down
2 changes: 1 addition & 1 deletion ipyleaflet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

import sys
from ._version import version_info, __version__ # noqa
from ._version import __version__ # noqa

from .leaflet import * # noqa
from .basemaps import basemaps # noqa
Expand Down
6 changes: 1 addition & 5 deletions ipyleaflet/_version.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
#

version_info = (0, 18, 1)

__version__ = "%s.%s.%s" % (version_info[0], version_info[1], version_info[2])

EXTENSION_VERSION = "^0.18"
__version__ = "0.18.1"
1 change: 0 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"build:lib": "tsc",
"build:nbextension": "webpack --no-devtool",
"build:labextension": "jupyter labextension build .",
"build:extensions": "yarn run build && yarn run build:labextension",
"clean": "yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension",
"clean:lib": "rimraf lib",
"clean:nbextension": "rimraf ../ipyleaflet/nbextension/index.js",
Expand Down
74 changes: 71 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,75 @@
[build-system]
# avoid 3.6 so we don't need the rust buildchain
requires = ["jupyter_packaging~=0.12", "jupyterlab~=4.0.8", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = [
"hatchling",
"jupyterlab==4.*",
]
build-backend = "hatchling.build"

[project]
name = "ipyleaflet"
version = "0.18.1"
description = "A Jupyter widget for dynamic Leaflet maps"
readme = "README.md"
authors = [
{ name = "Project Jupyter", email = "[email protected]" },
]
keywords = [
"ipython", "jupyter", "widgets", "graphics", "GIS",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Multimedia :: Graphics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"ipywidgets>=7.6.0,<9",
"traittypes>=0.2.1,<3",
"xyzservices>=2021.8.1",
"branca>=0.5.0",
]

[project.urls]
Homepage = "https://github.com/jupyter-widgets/ipyleaflet"

[tool.hatch.build]
artifacts = [
"ipyleaflet/nbextension/index.*",
"ipyleaflet/labextension",
]

[tool.hatch.build.targets.wheel.shared-data]
"ipyleaflet/nbextension" = "share/jupyter/nbextensions/jupyter-leaflet"
"ipyleaflet/labextension" = "share/jupyter/labextensions/jupyter-leaflet"
"jupyter-leaflet.json" = "etc/jupyter/nbconfig/notebook.d/jupyter-leaflet.json"

[tool.hatch.build.targets.sdist]
exclude = [
".github",
]

[tool.hatch.build.hooks.jupyter-builder]
ensured-targets = [
"ipyleaflet/nbextension/index.js",
"ipyleaflet/labextension/package.json",
]
dependencies = [
"hatch-jupyter-builder>=0.8.1",
]
build-function = "hatch_jupyter_builder.npm_builder"

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
path = "./js"
build_cmd = "build"
npm = [
"jlpm",
]

[tool.ruff]
extend-include = ["*.ipynb"]
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

87 changes: 2 additions & 85 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,85 +1,2 @@
# -*- coding: utf-8 -*-

import os
from setuptools import setup, find_packages

from jupyter_packaging import (
create_cmdclass,
install_npm,
ensure_targets,
combine_commands,
get_version,
skip_if_exists,
)

# the name of the package
name = "ipyleaflet"
long_description = "A Jupyter widget for dynamic Leaflet maps"

here = os.path.dirname(os.path.abspath(__file__))

# Get ipyleaflet version
version = get_version(os.path.join(name, "_version.py"))

js_dir = os.path.join(here, "js")

# Representative files that should exist after a successful build
jstargets = [
os.path.join("ipyleaflet/nbextension", "index.js"),
os.path.join("ipyleaflet/labextension", "package.json"),
]

data_files_spec = [
("share/jupyter/nbextensions/jupyter-leaflet", "ipyleaflet/nbextension", "*.*"),
("share/jupyter/labextensions/jupyter-leaflet", "ipyleaflet/labextension", "**"),
("etc/jupyter/nbconfig/notebook.d", ".", "jupyter-leaflet.json"),
]

cmdclass = create_cmdclass("jsdeps", data_files_spec=data_files_spec)
js_command = combine_commands(
install_npm(js_dir, npm=["yarn"], build_cmd="build"),
ensure_targets(jstargets),
)

is_repo = os.path.exists(os.path.join(here, ".git"))
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)

setup_args = dict(
name=name,
version=version,
description="A Jupyter widget for dynamic Leaflet maps",
long_description=long_description,
license="MIT License",
python_requires=">=3.7",
include_package_data=True,
install_requires=[
"ipywidgets>=7.6.0,<9",
"traittypes>=0.2.1,<3",
"xyzservices>=2021.8.1",
"branca>=0.5.0",
],
packages=find_packages(),
zip_safe=False,
cmdclass=cmdclass,
author="Project Jupyter",
author_email="[email protected]",
url="https://github.com/jupyter-widgets/ipyleaflet",
keywords=["ipython", "jupyter", "widgets", "graphics", "GIS"],
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Multimedia :: Graphics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
)

setup(**setup_args)
# Copyright (c) Jupyter Development Team.
__import__("setuptools").setup()
Loading