Skip to content

Commit 6b2e7b0

Browse files
authored
Hatch migration (#298)
* Hatch migration * Fix build step * Debug * Meh
1 parent c86d2a7 commit 6b2e7b0

File tree

8 files changed

+113
-153
lines changed

8 files changed

+113
-153
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363

6464
- name: Build packages
6565
run: |
66-
python setup.py sdist bdist_wheel
66+
python -m build
6767
cd dist
6868
sha256sum * | tee SHA256SUMS
6969
@@ -111,6 +111,11 @@ jobs:
111111
cd dist
112112
pip install -vv ${{ matrix.dist }}
113113
114+
- name: Log installation files
115+
run: |
116+
ls $CONDA_PREFIX/share/jupyter/nbextensions
117+
ls $CONDA_PREFIX/share/jupyter/labextensions
118+
114119
- name: Test installation files
115120
run: |
116121
test -d $CONDA_PREFIX/share/jupyter/nbextensions/ipycanvas

MANIFEST.in

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

dev-environment.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
- yarn
78
- nodejs=16
89
- jupyter-packaging

ipycanvas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
MultiRoughCanvas,
1313
hold_canvas,
1414
) # noqa
15-
from ._version import __version__, version_info # noqa
15+
from ._version import __version__ # noqa
1616

1717

1818
def _jupyter_nbextension_paths():

ipycanvas/_version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
# Copyright (c) Martin Renou.
55
# Distributed under the terms of the Modified BSD License.
66

7-
version_info = (0, 13, 1)
8-
__version__ = ".".join(map(str, version_info))
7+
__version__ = "0.13.1"

pyproject.toml

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,103 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.7.0", "jupyterlab==3.*", "setuptools>=40.8.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = [
3+
"hatchling",
4+
"jupyterlab==3.*",
5+
]
6+
build-backend = "hatchling.build"
7+
8+
[project]
9+
name = "ipycanvas"
10+
description = "Interactive widgets library exposing the browser's Canvas API"
11+
readme = "README.md"
12+
authors = [
13+
{ name = "Martin Renou", email = "[email protected]" },
14+
]
15+
keywords = [
16+
"IPython",
17+
"Jupyter",
18+
"Widgets",
19+
]
20+
classifiers = [
21+
"Framework :: Jupyter",
22+
"Intended Audience :: Developers",
23+
"Intended Audience :: Science/Research",
24+
"License :: OSI Approved :: BSD License",
25+
"Programming Language :: Python",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
]
32+
dependencies = [
33+
"ipywidgets>=7.6.0,<9",
34+
"numpy",
35+
"pillow>=6.0",
36+
]
37+
version = "0.13.1"
38+
39+
[project.license]
40+
file = "LICENSE.txt"
41+
42+
[project.optional-dependencies]
43+
44+
[project.urls]
45+
Homepage = "https://github.com/martinRenou/ipycanvas"
46+
47+
[tool.hatch.build]
48+
artifacts = [
49+
"ipycanvas/nbextension/static/index.*",
50+
"ipycanvas/labextension",
51+
]
52+
53+
[tool.hatch.build.targets.wheel.shared-data]
54+
"ipycanvas/nbextension/static" = "share/jupyter/nbextensions/ipycanvas"
55+
"ipycanvas/labextension" = "share/jupyter/labextensions/ipycanvas"
56+
"ipycanvas.json" = "etc/jupyter/nbconfig/notebook.d/ipycanvas.json"
57+
58+
[tool.hatch.build.targets.sdist]
59+
exclude = [
60+
".github",
61+
]
62+
63+
[tool.hatch.build.hooks.jupyter-builder]
64+
ensured-targets = [
65+
"ipycanvas/nbextension/static/index.js",
66+
"ipycanvas/labextension/package.json",
67+
]
68+
dependencies = [
69+
"hatch-jupyter-builder>=0.8.1",
70+
]
71+
build-function = "hatch_jupyter_builder.npm_builder"
72+
73+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
74+
path = "."
75+
build_cmd = "build:extensions"
76+
npm = [
77+
"yarn",
78+
]
79+
80+
[tool.tbump]
81+
field = [
82+
{ name = "channel", default = "" },
83+
{ name = "release", default = "" },
84+
]
85+
86+
[tool.tbump.version]
87+
current = "0.13.1"
88+
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?"
89+
90+
[tool.tbump.git]
91+
message_template = "Bump to {new_version}"
92+
tag_template = "v{new_version}"
93+
94+
[[tool.tbump.file]]
95+
src = "pyproject.toml"
96+
version_template = "version = \"{major}.{minor}.{patch}{channel}{release}\""
97+
98+
[[tool.tbump.file]]
99+
src = "ipycanvas/_version.py"
100+
101+
[[tool.tbump.file]]
102+
src = "package.json"
103+
version_template = "\"version\": \"{major}.{minor}.{patch}{channel}{release}\""

setup.cfg

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

setup.py

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,2 @@
1-
#!/usr/bin/env python
2-
# coding: utf-8
3-
4-
# Copyright (c) Jupyter Development Team.
5-
# Distributed under the terms of the Modified BSD License.
6-
7-
from __future__ import print_function
8-
from glob import glob
9-
import os
10-
from os.path import join as pjoin
11-
from os import path
12-
13-
14-
from jupyter_packaging import (
15-
create_cmdclass, install_npm, ensure_targets,
16-
combine_commands,
17-
get_version, skip_if_exists
18-
)
19-
20-
from setuptools import setup, find_packages
21-
22-
23-
HERE = path.dirname(path.abspath(__file__))
24-
25-
# The name of the project
26-
name = 'ipycanvas'
27-
28-
# Get our version
29-
version = get_version(pjoin(name, '_version.py'))
30-
31-
nb_path = pjoin(HERE, name, 'nbextension', 'static')
32-
lab_path = pjoin(HERE, name, 'labextension')
33-
34-
# Representative files that should exist after a successful build
35-
jstargets = [
36-
pjoin(nb_path, 'index.js'),
37-
pjoin(lab_path, 'package.json'),
38-
]
39-
40-
package_data_spec = {
41-
name: [
42-
'nbextension/static/*.*js*',
43-
'labextension/**'
44-
]
45-
}
46-
47-
data_files_spec = [
48-
('share/jupyter/nbextensions/ipycanvas',
49-
nb_path, '*.js*'),
50-
('share/jupyter/labextensions/ipycanvas', lab_path, '**'),
51-
('etc/jupyter/nbconfig/notebook.d', HERE, 'ipycanvas.json')
52-
]
53-
54-
55-
cmdclass = create_cmdclass('jsdeps', package_data_spec=package_data_spec,
56-
data_files_spec=data_files_spec)
57-
js_command = combine_commands(
58-
install_npm(HERE, npm=["yarn"], build_cmd='build:extensions'),
59-
ensure_targets(jstargets),
60-
)
61-
62-
is_repo = os.path.exists(os.path.join(HERE, '.git'))
63-
if is_repo:
64-
cmdclass['jsdeps'] = js_command
65-
else:
66-
cmdclass['jsdeps'] = skip_if_exists(jstargets, js_command)
67-
68-
setup_args = dict(
69-
name=name,
70-
description='Interactive widgets library exposing the browser\'s Canvas API',
71-
version=version,
72-
scripts=glob(pjoin('scripts', '*')),
73-
cmdclass=cmdclass,
74-
packages=find_packages(),
75-
author='Martin Renou',
76-
author_email='[email protected]',
77-
url='https://github.com/martinRenou/ipycanvas',
78-
license='BSD',
79-
platforms="Linux, Mac OS X, Windows",
80-
keywords=['Jupyter', 'Widgets', 'IPython'],
81-
classifiers=[
82-
'Intended Audience :: Developers',
83-
'Intended Audience :: Science/Research',
84-
'License :: OSI Approved :: BSD License',
85-
'Programming Language :: Python',
86-
'Programming Language :: Python :: 3',
87-
'Programming Language :: Python :: 3.7',
88-
'Programming Language :: Python :: 3.8',
89-
'Programming Language :: Python :: 3.9',
90-
'Programming Language :: Python :: 3.10',
91-
'Framework :: Jupyter',
92-
],
93-
include_package_data=True,
94-
install_requires=[
95-
'ipywidgets>=7.6.0,<9',
96-
'pillow>=6.0',
97-
'numpy'
98-
],
99-
extras_require={},
100-
entry_points={},
101-
)
102-
103-
if __name__ == '__main__':
104-
setup(**setup_args)
1+
# setup.py shim for use with applications that require it.
2+
__import__("setuptools").setup()

0 commit comments

Comments
 (0)