Skip to content

Commit 58c4fba

Browse files
committed
Switch to hatch backend
1 parent 1d2eb69 commit 58c4fba

File tree

4 files changed

+127
-6
lines changed

4 files changed

+127
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
*.pyc
44
.cache
55
.vscode
6+
7+
myproject

cookiecutter.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"author_name": "",
3-
"author_email": "",
4-
"github_project_name": "",
5-
"github_organization_name": "",
2+
"author_name": "me",
3+
"author_email": "[email protected]",
4+
"github_project_name": "myproject",
5+
"github_organization_name": "myproject",
66
"python_package_name": "{{ cookiecutter.github_project_name | replace('-', '_') }}",
77
"npm_package_name": "{{ cookiecutter.github_project_name }}",
88
"npm_package_version": "0.1.0",

{{cookiecutter.github_project_name}}/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,14 @@ After a change wait for the build to finish and then refresh your browser and th
7070

7171
#### Python:
7272
If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.
73+
74+
## Updating the version
75+
76+
To update the version, install tbump and use it to bump the version.
77+
By default it will also create a tag.
78+
79+
```bash
80+
pip install tbump
81+
tbump <new-version>
82+
```
83+
Lines changed: 110 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,111 @@
11
[build-system]
2-
requires = ["jupyter_packaging==0.7.9", "jupyterlab==3.*", "setuptools>=40.8.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = [
3+
"hatchling>=1.3.1",
4+
"jupyterlab==3.*",
5+
]
6+
build-backend = "hatchling.build"
7+
8+
[project]
9+
name = "{{ cookiecutter.github_project_name }}"
10+
description = "{{ cookiecutter.project_short_description }}"
11+
readme = "README.md"
12+
license = "BSD"
13+
requires-python = ">=3.6"
14+
authors = [
15+
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" },
16+
]
17+
keywords = [
18+
"IPython",
19+
"Jupyter",
20+
"Widgets",
21+
]
22+
classifiers = [
23+
"Framework :: Jupyter",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: Science/Research",
26+
"License :: OSI Approved :: BSD License",
27+
"Programming Language :: Python",
28+
"Programming Language :: Python :: 3",
29+
"Programming Language :: Python :: 3.7",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.10",
33+
]
34+
dependencies = [
35+
"ipywidgets>=7.0.0",
36+
]
37+
version = "0.1.0.dev0"
38+
39+
[project.optional-dependencies]
40+
docs = [
41+
"jupyter_sphinx",
42+
"nbsphinx",
43+
"nbsphinx-link",
44+
"pypandoc",
45+
"pytest_check_links",
46+
"recommonmark",
47+
"sphinx>=1.5",
48+
"sphinx_rtd_theme",
49+
]
50+
examples = []
51+
test = [
52+
"nbval",
53+
"pytest-cov",
54+
"pytest>=6.0",
55+
]
56+
57+
[project.urls]
58+
Homepage = "https://github.com/{ cookiecutter.github_organization_name }}/{{ cookiecutter.github_project_name }}"
59+
60+
[tool.hatch.build]
61+
artifacts = [
62+
"{{ cookiecutter.github_project_name }}/nbextension/index.*",
63+
"{{ cookiecutter.github_project_name }}/labextension/*.tgz",
64+
"{{ cookiecutter.github_project_name }}/labextension",
65+
]
66+
67+
[tool.hatch.build.targets.wheel.shared-data]
68+
"{{ cookiecutter.github_project_name }}/nbextension/**" = "share/jupyter/nbextensions/{{ cookiecutter.github_project_name }}"
69+
"{{ cookiecutter.github_project_name }}/labextension/**" = "share/jupyter/labextensions/{{ cookiecutter.github_project_name }}"
70+
"./install.json" = "share/jupyter/labextensions/{{ cookiecutter.github_project_name }}"
71+
"./{{ cookiecutter.github_project_name }}.json" = "etc/jupyter/nbconfig/notebook.d"
72+
73+
[tool.hatch.build.targets.sdist]
74+
exclude = [
75+
".github",
76+
]
77+
78+
[tool.hatch.build.hooks.jupyter-builder]
79+
ensured-targets = [
80+
"{{ cookiecutter.github_project_name }}/nbextension/index.js",
81+
"{{ cookiecutter.github_project_name }}/labextension/package.json",
82+
]
83+
skip-if-exists = [
84+
"{{ cookiecutter.github_project_name }}/nbextension/index.js",
85+
"{{ cookiecutter.github_project_name }}/labextension/package.json",
86+
]
87+
dependencies = [
88+
"hatch-jupyter-builder>=0.5.0",
89+
]
90+
91+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
92+
path = "."
93+
build_cmd = "build:prod"
94+
95+
[tool.tbump]
96+
field = [
97+
{ name = "channel", default = "" },
98+
{ name = "release", default = "" },
99+
]
100+
file = [
101+
{ src = "pyproject.toml" },
102+
{ src = "{{ cookiecutter.github_project_name }}/_version.py" },
103+
]
104+
105+
[tool.tbump.version]
106+
current = "0.1.0.dev0"
107+
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?"
108+
109+
[tool.tbump.git]
110+
message_template = "Bump to {new_version}"
111+
tag_template = "v{new_version}"

0 commit comments

Comments
 (0)