Skip to content

Commit 2ad0b63

Browse files
authored
Merge pull request #101 from dhellmann/switch-to-hatch
Switch to hatch
2 parents a885238 + df62ed1 commit 2ad0b63

File tree

13 files changed

+308
-291
lines changed

13 files changed

+308
-291
lines changed

.github/workflows/check.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
tox-environment:
16-
- docs
17-
- linter
18-
- pkglint
15+
hatch-environment:
16+
- docs:build
17+
- test:lint
18+
- test:pkglint
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/setup-python@v4
2727

2828
- name: Install dependencies
29-
run: python -m pip install tox
29+
run: python -m pip install hatch
3030

3131
- name: Run
32-
run: tox -e ${{ matrix.tox-environment }}
32+
run: hatch run ${{ matrix.hatch-environment }}

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
python-version:
16-
- 3.8
17-
- 3.9
18-
- "3.10"
1916
- "3.11"
2017
- "3.12"
18+
- "3.13"
2119

2220
steps:
2321
- uses: actions/checkout@v2
@@ -30,7 +28,7 @@ jobs:
3028
python-version: ${{ matrix.python-version }}
3129

3230
- name: Install dependencies
33-
run: python -m pip install tox
31+
run: python -m pip install hatch
3432

3533
- name: Run tests
36-
run: tox -e py
34+
run: hatch run test:test

.mergify.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pull_request_rules:
2-
32
- name: Add CI label
43
conditions:
54
- or:
@@ -24,20 +23,18 @@ pull_request_rules:
2423
- name: Automatic merge on approval
2524
conditions:
2625
- and:
27-
- "check-success=build (docs)"
28-
- "check-success=build (linter)"
29-
- "check-success=build (pkglint)"
30-
- "check-success=build (3.8)"
31-
- "check-success=build (3.9)"
32-
- "check-success=build (3.10)"
33-
- "check-success=build (3.11)"
34-
- "check-success=build (3.12)"
35-
- "-draft"
36-
- or:
37-
- "approved-reviews-by=dhellmann"
38-
- "author=dhellmann"
39-
- "approved-reviews-by=janbrohl"
40-
- "author=janbrohl"
26+
- "check-success=build (docs:build)"
27+
- "check-success=build (test:lint)"
28+
- "check-success=build (test:pkglint)"
29+
- "check-success=build (3.11)"
30+
- "check-success=build (3.12)"
31+
- "check-success=build (3.13)"
32+
- "-draft"
33+
- or:
34+
- "approved-reviews-by=dhellmann"
35+
- "author=dhellmann"
36+
- "approved-reviews-by=janbrohl"
37+
- "author=janbrohl"
4138
actions:
4239
merge:
4340
method: merge

doc/source/conf.py

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15-
import pkg_resources
15+
import importlib.metadata
1616

1717
# If extensions (or modules to document with autodoc) are in another directory,
1818
# add these directories to sys.path here. If the directory is relative to the
@@ -28,57 +28,57 @@
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2929
# ones.
3030
extensions = [
31-
'sphinx.ext.intersphinx',
32-
'sphinx.ext.autodoc',
33-
'sphinxcontrib.datatemplates',
31+
"sphinx.ext.intersphinx",
32+
"sphinx.ext.autodoc",
33+
"sphinxcontrib.datatemplates",
3434
"sphinxcontrib.runcmd",
3535
]
3636

3737
# Support linking to Python Docs
3838
intersphinx_mapping = {
39-
'python': ('https://docs.python.org/', None),
40-
'python3': ('https://docs.python.org/3', None),
41-
'python2': ('https://docs.python.org/2', None)
39+
"python": ("https://docs.python.org/", None),
40+
"python3": ("https://docs.python.org/3", None),
41+
"python2": ("https://docs.python.org/2", None),
4242
}
4343

4444
# Add any paths that contain templates here, relative to this directory.
45-
templates_path = ['_templates']
45+
templates_path = ["_templates"]
4646

4747
# The suffix(es) of source filenames.
4848
# You can specify multiple suffix as a list of string:
4949
# source_suffix = ['.rst', '.md']
50-
source_suffix = '.rst'
50+
source_suffix = ".rst"
5151

5252
# The encoding of source files.
5353
# source_encoding = 'utf-8-sig'
5454

5555
# The master toctree document.
56-
master_doc = 'index'
56+
master_doc = "index"
5757

5858
# General information about the project.
59-
project = u'sphinxcontrib.datatemplates'
60-
copyright = u'2015, Doug Hellmann'
61-
author = u'Doug Hellmann'
59+
project = "sphinxcontrib.datatemplates"
60+
copyright = "2015, Doug Hellmann"
61+
author = "Doug Hellmann"
6262

6363
# The version info for the project you're documenting, acts as replacement for
6464
# |version| and |release|, also used in various other places throughout the
6565
# built documents.
6666
#
6767
# The short X.Y version.
68-
version = pkg_resources.get_distribution('sphinxcontrib.datatemplates').version
68+
version = importlib.metadata.version("sphinxcontrib.datatemplates")
6969
# The full version, including alpha/beta/rc tags.
70-
release = '0.0.0'
70+
release = "0.0.0"
7171

7272
html_context = {
73-
'sample': 'Sample context value set in conf.py',
73+
"sample": "Sample context value set in conf.py",
7474
}
7575

7676
# The language for content autogenerated by Sphinx. Refer to documentation
7777
# for a list of supported languages.
7878
#
7979
# This is also used if you do content translation via gettext catalogs.
8080
# Usually you set "language" from the command line for these cases.
81-
language = 'en'
81+
language = "en"
8282

8383
# There are two options for replacing |today|: either, you set today to some
8484
# non-false value, then it is used:
@@ -106,7 +106,7 @@
106106
# show_authors = False
107107

108108
# The name of the Pygments (syntax highlighting) style to use.
109-
pygments_style = 'sphinx'
109+
pygments_style = "sphinx"
110110

111111
# A list of ignored prefixes for module index sorting.
112112
# modindex_common_prefix = []
@@ -150,7 +150,7 @@
150150
# Add any paths that contain custom static files (such as style sheets) here,
151151
# relative to this directory. They are copied after the builtin static files,
152152
# so a file named "default.css" will overwrite the builtin "default.css".
153-
html_static_path = ['_static']
153+
html_static_path = ["_static"]
154154

155155
# Add any extra paths that contain custom files (such as robots.txt or
156156
# .htaccess) here, relative to this directory. These files are copied
@@ -213,20 +213,17 @@
213213
# html_search_scorer = 'scorer.js'
214214

215215
# Output file base name for HTML help builder.
216-
htmlhelp_basename = 'sphinxcontribdatatemplatesdoc'
216+
htmlhelp_basename = "sphinxcontribdatatemplatesdoc"
217217

218218
# -- Options for LaTeX output ---------------------------------------------
219219

220220
latex_elements = {
221221
# The paper size ('letterpaper' or 'a4paper').
222222
# 'papersize': 'letterpaper',
223-
224223
# The font size ('10pt', '11pt' or '12pt').
225224
# 'pointsize': '10pt',
226-
227225
# Additional stuff for the LaTeX preamble.
228226
# 'preamble': '',
229-
230227
# Latex figure (float) alignment
231228
# 'figure_align': 'htbp',
232229
}
@@ -235,8 +232,13 @@
235232
# (source start file, target name, title,
236233
# author, documentclass [howto, manual, or own class]).
237234
latex_documents = [
238-
(master_doc, 'sphinxcontribdatatemplates.tex',
239-
u'sphinxcontrib.datatemplates Documentation', u'Doug Hellmann', 'manual'),
235+
(
236+
master_doc,
237+
"sphinxcontribdatatemplates.tex",
238+
"sphinxcontrib.datatemplates Documentation",
239+
"Doug Hellmann",
240+
"manual",
241+
),
240242
]
241243

242244
# The name of an image file (relative to this directory) to place at the top of
@@ -263,8 +265,15 @@
263265

264266
# One entry per manual page. List of tuples
265267
# (source start file, name, description, authors, manual section).
266-
man_pages = [(master_doc, 'sphinxcontribdatatemplates',
267-
u'sphinxcontrib.datatemplates Documentation', [author], 1)]
268+
man_pages = [
269+
(
270+
master_doc,
271+
"sphinxcontribdatatemplates",
272+
"sphinxcontrib.datatemplates Documentation",
273+
[author],
274+
1,
275+
)
276+
]
268277

269278
# If true, show URL addresses after external links.
270279
# man_show_urls = False
@@ -275,10 +284,15 @@
275284
# (source start file, target name, title, author,
276285
# dir menu entry, description, category)
277286
texinfo_documents = [
278-
(master_doc, 'sphinxcontribdatatemplates',
279-
u'sphinxcontrib.datatemplates Documentation', author,
280-
'sphinxcontribdatatemplates', 'One line description of project.',
281-
'Miscellaneous'),
287+
(
288+
master_doc,
289+
"sphinxcontribdatatemplates",
290+
"sphinxcontrib.datatemplates Documentation",
291+
author,
292+
"sphinxcontribdatatemplates",
293+
"One line description of project.",
294+
"Miscellaneous",
295+
),
282296
]
283297

284298
# Documents to append as an appendix to all manuals.

doc/source/history.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Release History
33
=================
44

5+
Next
6+
====
7+
8+
* Switch packaging tool to hatch
9+
* Switch linter to ruff
10+
511
0.10.0
612
======
713

pyproject.toml

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
[build-system]
2-
requires = ["setuptools", "setuptools_scm[toml]>=6.2"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "sphinxcontrib.datatemplates"
77
readme = "README.rst"
8-
authors = [
9-
{name = "Doug Hellmann", email = "[email protected]"},
10-
]
8+
authors = [{ name = "Doug Hellmann", email = "[email protected]" }]
119
description = "Sphinx extension for rendering data files as nice HTML"
1210
dynamic = ["version"]
1311

@@ -20,23 +18,16 @@ classifiers = [
2018
"License :: OSI Approved :: BSD License",
2119
"Operating System :: OS Independent",
2220
"Programming Language :: Python",
23-
"Programming Language :: Python :: 3.8",
24-
"Programming Language :: Python :: 3.9",
25-
"Programming Language :: Python :: 3.10",
2621
"Programming Language :: Python :: 3.11",
2722
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
2824
"Topic :: Documentation",
2925
"Topic :: Utilities",
3026
]
3127

32-
requires-python = ">=3.8"
28+
requires-python = ">=3.11"
3329

34-
dependencies = [
35-
"Sphinx",
36-
"PyYAML",
37-
"defusedxml",
38-
"sphinxcontrib-runcmd",
39-
]
30+
dependencies = ["Sphinx", "PyYAML", "defusedxml", "sphinxcontrib-runcmd"]
4031

4132
[project.scripts]
4233
datatemplate = "sphinxcontrib.datatemplates.cli:main"
@@ -46,23 +37,45 @@ homepage = "https://sphinxcontribdatatemplates.readthedocs.io/en/latest/"
4637
repository = "http://github.com/sphinx-contrib/datatemplates"
4738

4839
[project.optional-dependencies]
49-
linter = [
50-
"flake8",
51-
]
52-
test = [
53-
"pytest",
54-
"beautifulsoup4",
55-
]
56-
build = [
57-
"build",
58-
"twine",
59-
]
40+
linter = ["ruff"]
41+
test = ["pytest", "beautifulsoup4"]
42+
build = ["twine"]
43+
44+
[tool.hatch.version]
45+
source = "vcs"
6046

61-
[tools.setuptools]
62-
packages = [
63-
"sphinxcontrib.datatemplates",
47+
[tool.hatch.build.hooks.vcs]
48+
version-file = "sphinxcontrib/datatemplates/version.py"
49+
50+
[tool.hatch.build.targets.sdist]
51+
include = ["sphinxcontrib/", "README.rst", "LICENSE", "pyproject.toml"]
52+
53+
[tool.hatch.build.targets.wheel]
54+
only-include = ["sphinxcontrib"]
55+
56+
[tool.hatch.build]
57+
exclude = ["/doc", "/tests", "/dist", "/build"]
58+
59+
[tool.hatch.metadata]
60+
allow-direct-references = true
61+
62+
[tool.hatch.envs.test]
63+
features = ["test", "linter", "build"]
64+
dependencies = ["check-python-versions"]
65+
[tool.hatch.envs.test.scripts]
66+
test = "pytest tests"
67+
lint = ["ruff check sphinxcontrib", "ruff format --check sphinxcontrib"]
68+
lint-fix = ["ruff format sphinxcontrib"]
69+
pkglint = [
70+
"hatch build",
71+
"twine check dist/*.tar.gz",
72+
"check-python-versions --only pyproject.toml,.github/workflows/test.yml",
6473
]
6574

66-
# https://github.com/pypa/setuptools_scm/
67-
[tool.setuptools_scm]
68-
write_to = "sphinxcontrib/datatemplates/version.py"
75+
[tool.hatch.envs.docs]
76+
dependencies = ["sphinx"]
77+
[tool.hatch.envs.docs.scripts]
78+
build = "python -m sphinx.cmd.build -E -W -v -T doc/source doc/build"
79+
80+
[tool.ruff]
81+
exclude = ["sphinxcontrib/datatemplates/version.py"]

0 commit comments

Comments
 (0)