8000 Change build system to hatch · FirebirdSQL/python3-lib@96d6e26 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96d6e26

Browse files
committed
Change build system to hatch
1 parent 19c0471 commit 96d6e26

File tree

16 files changed

+199
-26
lines changed

16 files changed

+199
-26
lines changed

docs/changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog
33
#########
44

5+
Version 1.5.0 [Unreleased]
6+
==========================
7+
8+
* Build system changed from setuptools to hatch
9+
510
Version 1.4.0
611
=============
712

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# sys.path.insert(0, os.path.abspath('.'))
1616

1717
import sphinx_bootstrap_theme
18+
from firebird.lib.__about__ import __version__
1819

1920
# -- Project information -----------------------------------------------------
2021

@@ -23,10 +24,10 @@
2324
author = 'Pavel Císař'
2425

2526
# The short X.Y version
26-
version = '1.4.0'
27+
version = __version__
2728

2829
# The full version, including alpha/beta/rc tags
29-
release = '1.4.0'
30+
release = __version__
3031

3132

3233
# -- General configuration ---------------------------------------------------

pyproject.toml

Lines changed: 157 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
[build-system]
2-
requires = ["setuptools >= 65.0.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "firebird-lib"
7-
version = "1.4.0"
87
description = "Firebird driver extension library"
9-
readme = "README.rst"
8+
dynamic = ["version"]
9+
readme = "README.md"
1010
requires-python = ">=3.8"
1111
license = { file = "LICENSE" }
12-
authors = [{ name = "Pavel Cisar", email = "pcisar@users.sourceforge.net"}]
12+
authors = [
13+
{ name = "Pavel Cisar", email = "pcisar@users.sourceforge.net"},
14+
]
1315
keywords = ["Firebird", "RDBMS", "driver", "extension", "library"]
1416
classifiers = [
1517
"Development Status :: 5 - Production/Stable",
@@ -34,9 +36,155 @@ dependencies = [
3436
[project.urls]
3537
Home = "https://github.com/FirebirdSQL/python3-lib"
3638
Documentation = "https://firebird-lib.rtfd.io"
37-
"Bug Reports" = "https://github.com/FirebirdSQL/python3-lib/issues"
38-
Funding = "https://www.firebirdsql.org/en/donate/"
39+
Issues = "https://github.com/FirebirdSQL/python3-lib/issues"
40+
Funding = "https://github.com/sponsors/pcisar"
3941
Source = "https://github.com/FirebirdSQL/python3-lib"
4042

41-
[tool.setuptools]
42-
zip-safe = true
43+
[tool.hatch.version]
44+
path = "src/firebird/lib/__about__.py"
45+
46+
[tool.hatch.build]
47+
packages = ["src/firebird"]
48+
49+
[tool.hatch.envs.default]
50+
dependencies = [
51+
]
52+
53+
[tool.hatch.envs.test]
54+
dependencies = [
55+
"coverage[toml]>=6.5",
56+
"pytest",
57+
]
58+
[tool.hatch.envs.test.scripts]
59+
test = "pytest {args:tests}"
60+
test-cov = "coverage run -m pytest {args:tests}"
61+
cov-report = [
62+
"- coverage combine",
63+
"coverage report",
64+
]
65+
cov = [
66+
"test-cov",
67+
"cov-report",
68+
]
69+
version = "python --version"
70+
71+
[[tool.hatch.envs.test.matrix]]
72+
python = ["3.8", "3.9", "3.10", "3.11"]
73+
74+
[tool.hatch.envs.doc]
75+
detached = false
76+
platforms = ["linux"]
77+
dependencies = [
78+
"Sphinx>=7.1",
79+
"sphinx-bootstrap-theme>=0.8.1",
80+
"sphinx-autodoc-typehints>=1.24.0",
81+
"doc2dash>=3.0.0"
82+
]
83+
[tool.hatch.envs.doc.scripts]
84+
build = "cd docs ; make html"
85+
docset = [
86+
"cd docs ; doc2dash -u https://firebird-lib.readthedocs.io/en/latest/ -f -i ./_static/fb-favicon.png -n firebird-lib ./_build/html/",
87+
"cd docs; VERSION=`hatch version` ; tar --exclude='.DS_Store' -cvzf ../dist/firebird-lib-$VERSION-docset.tgz firebird-lib.docset",
88+
]
89+
90+
[tool.hatch.envs.lint]
91+
detached = true
92+
dependencies = [
93+
"black>=23.1.0",
94+
"mypy>=1.0.0",
95+
"ruff>=0.0.243",
96+
]
97+
[tool.hatch.envs.lint.scripts]
98+
typing = "mypy --install-types --non-interactive {args:src/firebird/lib tests}"
99+
style = [
100+
"ruff {args:.}",
101+
"black --check --diff {args:.}",
102+
]
103+
fmt = [
104+
"black {args:.}",
105+
"ruff --fix {args:.}",
106+
"style",
107+
]
108+
all = [
109+
"style",
110+
"typing",
111+
]
112+
113+
[tool.black]
114+
target-version = ["py38"]
115+
line-length = 120
116+
skip-string-normalization = true
117+
118+
[tool.ruff]
119+
target-version = "py38"
120+
line-length = 120
121+
select = [
122+
"A",
123+
"ARG",
124+
"B",
125+
"C",
126+
"DTZ",
127+
"E",
128+
"EM",
129+
"F",
130+
"FBT",
131+
"I",
132+
"ICN",
133+
"ISC",
134+
"N",
135+
"PLC",
136+
"PLE",
137+
"PLR",
138+
"PLW",
139+
"Q",
140+
"RUF",
141+
"S",
142+
"T",
143+
"TID",
144+
"UP",
145+
"W",
146+
"YTT",
147+
]
148+
ignore = [
149+
# Allow non-abstract empty methods in abstract base classes
150+
"B027",
151+
# Allow boolean positional values in function calls, like `dict.get(... True)`
152+
"FBT003",
153+
# Ignore checks for possible passwords
154+
"S105", "S106", "S107",
155+
# Ignore complexity
156+
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
157+
]
158+
unfixable = [
159+
# Don't touch unused imports
160+
"F401",
161+
]
162+
163+
[tool.ruff.isort]
164+
known-first-party = ["firebird.lib"]
165+
166+
[tool.ruff.flake8-tidy-imports]
167+
ban-relative-imports = "all"
168+
169+
[tool.ruff.per-file-ignores]
170+
# Tests can use magic values, assertions, and relative imports
171+
"tests/**/*" = ["PLR2004", "S101", "TID252"]
172+
173+
[tool.coverage.run]
174+
source_pkgs = ["firebird.lib", "tests"]
175+
branch = true
176+
parallel = true
177+
omit = [
178+
"src/firebird/lib/__about__.py",
179+
]
180+
181+
[tool.coverage.paths]
182+
firebird_lib = ["src/python", "*/src/firebird/lib"]
183+
tests = ["tests", "*/python/tests"]
184+
185+
[tool.coverage.report]
186+
exclude_lines = [
187+
"no cov",
188+
"if __name__ == .__main__.:",
189+
"if TYPE_CHECKING:",
190+
]

src/firebird/lib/__about__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
__version__ = "1.5.0b0"

src/firebird/lib/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT

src/firebird/lib/gstat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
24
#
35
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/gstat.py

src/firebird/lib/log.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
24
#
35
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/log.py

src/firebird/lib/logmsgs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
22
#
3-
# PROGRAM/MODULE: Saturnin microservices
3+
# SPDX-License-Identifier: MIT
4+
#
5+
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/logmsgs.py
57
# DESCRIPTION: Firebird log messages for Firebird log parser
68
# CREATED: 22.11.2019

src/firebird/lib/monitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
24
#
35
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/monitor.py

src/firebird/lib/schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
24
#
35
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/schema.py

src/firebird/lib/trace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#coding:utf-8
1+
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
2+
#
3+
# SPDX-License-Identifier: MIT
24
#
35
# PROGRAM/MODULE: firebird-lib
46
# FILE: firebird/lib/trace.py

tests/fbtest50.fdb

0 Bytes
Binary file not shown.

tests/test_gstat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def setUp(self):
133133
raise Exception("Unsupported Firebird version (%s)" % self.version)
134134
#
135135
self.cwd = os.getcwd()
136-
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'test' \
137-
else os.path.join(self.cwd, 'test')
136+
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'tests' \
137+
else os.path.join(self.cwd, 'tests')
138138
self.dbfile = os.path.join(self.dbpath, self.FBTEST_DB)
139139
driver_config.get_database('fbtest').database.value = self.dbfile
140140
def clear_output(self):

tests/test_monitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def setUp(self):
8585
raise Exception("Unsupported Firebird version (%s)" % self.version)
8686
#
8787
self.cwd = os.getcwd()
88-
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'test' \
89-
else os.path.join(self.cwd, 'test')
88+
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'tests' \
89+
else os.path.join(self.cwd, 'tests')
9090
self.dbfile = os.path.join(self.dbpath, self.FBTEST_DB)
9191
driver_config.get_database('fbtest').database.value = self.dbfile
9292
def clear_output(self):

tests/test_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def setUp(self):
117117
raise Exception("Unsupported Firebird version (%s)" % self.version)
118118
#
119119
self.cwd = os.getcwd()
120-
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'test' \
121-
else os.path.join(self.cwd, 'test')
120+
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'tests' \
121+
else os.path.join(self.cwd, 'tests')
122122
self.dbfile = os.path.join(self.dbpath, self.FBTEST_DB)
123123
driver_config.get_database('fbtest').database.value = self.dbfile
124124
def clear_output(self):

tests/test_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def setUp(self):
134134
raise Exception("Unsupported Firebird version (%s)" % self.version)
135135
#
136136
self.cwd = os.getcwd()
137-
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'test' \
138-
else os.path.join(self.cwd, 'test')
137+
self.dbpath = self.cwd if os.path.split(self.cwd)[1] == 'tests' \
138+
else os.path.join(self.cwd, 'tests')
139139
self.dbfile = os.path.join(self.dbpath, self.FBTEST_DB)
140140
driver_config.get_database('fbtest').database.value = self.dbfile
141141
def clear_output(self):

0 commit comments

Comments
 (0)
0