Skip to content

Commit a0fa2ea

Browse files
iamdhakreysimo5
authored andcommitted
Migrate to Hatch build backend and dynamic versioning Add pyproject.toml
and remove setup.py-based build configuration Replace VERSION file with version.py for version metadata Refactor setup.py to read version from python source instead of plain file Replace VERSION file with version.py for version metadata in docs import version directly from jwcrypto.version in conf.py v s
1 parent 64f93cc commit a0fa2ea

File tree

6 files changed

+51
-11
lines changed

6 files changed

+51
-11
lines changed

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include LICENSE README.md
22
include tox.ini setup.cfg
3-
include jwcrypto/VERSION

docs/source/conf.py

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

15-
import sys
1615
import os
16+
import sys
1717

1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
2121
#sys.path.insert(0, os.path.abspath('.'))
2222

2323
sys.path.insert(0, os.path.abspath('../..'))
24+
from jwcrypto.version import __version__ as version
2425

2526
# -- General configuration ------------------------------------------------
2627

@@ -57,8 +58,6 @@
5758
# built documents.
5859
#
5960
# The short X.Y version.
60-
with open(os.path.join('../../jwcrypto', 'VERSION')) as verfile:
61-
version = verfile.read().strip()
6261
# The full version, including alpha/beta/rc tags.
6362
release = version
6463

jwcrypto/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

jwcrypto/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "1.5.6"

pyproject.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "jwcrypto"
7+
dynamic = ["version"]
8+
description = "Implementation of JOSE Web standards"
9+
readme = "README.md"
10+
license = "LGPL-3.0-or-later"
11+
requires-python = ">= 3.8"
12+
maintainers = [
13+
{ name = "JWCrypto Project Contributors", email = "simo@redhat.com" },
14+
]
15+
classifiers = [
16+
"Intended Audience :: Developers",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Topic :: Security",
22+
"Topic :: Software Development :: Libraries :: Python Modules",
23+
]
24+
dependencies = [
25+
"cryptography >= 3.4",
26+
"typing_extensions >= 4.5.0",
27+
]
28+
29+
[project.urls]
30+
Homepage = "https://github.com/latchset/jwcrypto"
31+
32+
[tool.hatch.version]
33+
path = "jwcrypto/version.py"
34+
35+
[tool.hatch.build.targets.wheel.shared-data]
36+
LICENSE = "share/doc/jwcrypto/LICENSE"
37+
"README.md" = "share/doc/jwcrypto/README.md"
38+
39+
[tool.hatch.build.targets.sdist]
40+
include = [
41+
"/jwcrypto",
42+
]

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
#
33
# Copyright (C) 2015 JWCrypto Project Contributors, see LICENSE file
44

5-
import os
6-
from setuptools import setup
7-
85
# read the contents of your README file
96
from pathlib import Path
7+
8+
from setuptools import setup
9+
10+
from jwcrypto import version
11+
1012
this_directory = Path(__file__).parent
1113
long_description = (this_directory / "README.md").read_text()
1214

13-
version = None
14-
with open(os.path.join('jwcrypto', 'VERSION')) as verfile:
15-
version = verfile.read().strip()
15+
version = version.__version__
1616

1717
setup(
1818
name = 'jwcrypto',

0 commit comments

Comments
 (0)