Skip to content

Commit d80cf0a

Browse files
committed
Modernize the build: switch to hatchling
- generate the version from vcs metadata (tags) - use hatchling as a build system
1 parent 134b68c commit d80cf0a

File tree

7 files changed

+82
-66
lines changed

7 files changed

+82
-66
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ t.py
2626
*.pem
2727
/.python-version
2828
/.tool-versions
29+
src/github3/_version.py

dev-requirements.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
.
2-
pytest>=7.0
3-
pytest-xdist[psutil]
4-
wheel
5-
betamax>=0.5.1
6-
betamax_matchers>=0.3.0
7-
tox>=3.1.3
1+
.[dev]

pyproject.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,79 @@
1+
[build-system]
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "github3.py"
7+
description = "Python wrapper for the GitHub API(http://developer.github.com/v3)"
8+
readme = "README.rst"
9+
requires-python = ">= 3.7"
10+
url = "https://github3.readthedocs.io"
11+
authors = [
12+
{ name = "Ian Stapleton Cordasco", email="[email protected]" },
13+
]
14+
license = "BSD-3-Clause"
15+
license_file = "LICENSE"
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved",
20+
"License :: OSI Approved :: BSD License",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3 :: Only",
24+
"Programming Language :: Python :: Implementation :: CPython",
25+
]
26+
27+
dynamic = ["version"]
28+
29+
dependencies = [
30+
"PyJWT[crypto]>=2.3.0",
31+
"python-dateutil>=2.6.0",
32+
"requests>=2.18",
33+
"uritemplate>=3.0.0",
34+
]
35+
36+
[project.optional-dependencies]
37+
test = [
38+
"pytest>=7.0",
39+
"pytest-xdist[psutil]",
40+
"betamax>=0.5.1",
41+
"betamax_matchers>=0.3.0",
42+
]
43+
44+
dev = [
45+
"github3.py[test]",
46+
"wheel",
47+
"build",
48+
"twine",
49+
"tox>=3.1.3",
50+
]
51+
52+
[tool.hatch.version]
53+
source = "vcs"
54+
55+
[tool.hatch.build.hooks.vcs]
56+
version-file = "src/github3/_version.py"
57+
template = """\
58+
# coding: utf-8
59+
# file generated by hatch VCS
60+
# don't change, don't track in version control
61+
__version__ = {version!r} # pragma: no mutate
62+
__version_info__ = {version_tuple!r} # pragma: no mutate
63+
"""
64+
65+
[tool.hatch.build.targets.wheel]
66+
packages = [
67+
"src/github3",
68+
]
69+
70+
71+
[project.urls]
72+
Documentation = "https://github3.readthedocs.io"
73+
Changelog = "https://github3.readthedocs.io/en/latest/release-notes/index.html"
74+
Source = "https://github.com/sigmavirus24/github3.py"
75+
"Released Versions" = "https://github.com/sigmavirus24/github3.py/tags"
76+
177
[tool.black]
278
line-length = 78
379
target-version = ['py37']
@@ -15,5 +91,6 @@ exclude = '''
1591
| build
1692
| dist
1793
)/
94+
| src/github3/_version.py
1895
)
1996
'''

setup.cfg

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

setup.py

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

src/github3/__about__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
__author_email__ = "[email protected]"
66
__license__ = "Modified BSD"
77
__copyright__ = "Copyright 2012-2022 Ian Stapleton Cordasco"
8-
__version__ = "3.2.0"
9-
__version_info__ = tuple(
10-
int(i) for i in __version__.split(".") if i.isdigit()
11-
)
128
__url__ = "https://github3.readthedocs.io"
9+
from ._version import __version__, __version_info__
1310

1411
__all__ = (
1512
"__package_name__",

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ passenv = GH_*
77
pip_pre = False
88
deps =
99
requests{env:REQUESTS_VERSION:>=2.0}
10-
pytest
11-
pytest-xdist[psutil]
12-
betamax>=0.5.1
13-
betamax_matchers>=0.3.0
1410
pypy3: unittest2
11+
extras = test
1512
commands = pytest {posargs}
1613

1714
[testenv:flake8]
@@ -112,3 +109,4 @@ ignore-path-errors = docs/source/release-notes/1.0.0.rst;D001
112109
[flake8]
113110
extend-ignore = E203,W503
114111
max-line-length = 80
112+
exclude = src/github3/_version.py

0 commit comments

Comments
 (0)