Skip to content

Commit 738276d

Browse files
committed
refactor: switch to pyproject.toml for configuration
1 parent c9d1e0a commit 738276d

File tree

6 files changed

+125
-54
lines changed

6 files changed

+125
-54
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__
66
.idea
77
.pytest_cache
88
.coverage
9+
astyle_py/version.py

astyle_py/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2022 Ivan Grokhotkov <[email protected]>
22
# SPDX-License-Identifier: MIT
33
from .astyle_wrapper import Astyle, AstyleError
4+
from .version import __version__
45

5-
__all__ = ['Astyle', 'AstyleError']
6-
__version__ = '1.0.5'
6+
__all__ = ['Astyle', 'AstyleError', '__version__']

pyproject.toml

+122-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,124 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
2+
requires = ["setuptools", "setuptools-scm", "wheel"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "astyle_py"
7+
description = "Astyle, wrapped in a python package."
8+
readme = "README.md"
9+
requires-python = ">=3.9"
10+
license = {file = "LICENSE"}
11+
authors = [
12+
{name = "Ivan Grokhotkov", email = "[email protected]"}
13+
]
14+
urls = { "Homepage" = "https://github.com/igrr/astyle_py" }
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Environment :: Console",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python :: 3 :: Only"
21+
]
22+
dynamic = ["version"]
23+
24+
dependencies = [
25+
"wasmtime~=30.0.0",
26+
"PyYAML~=6.0.1"
27+
]
28+
29+
[project.optional-dependencies]
30+
dev = [
31+
"pytest",
32+
"types-PyYAML",
33+
"pre-commit",
34+
"coverage",
35+
"commitizen"
36+
]
37+
38+
[project.scripts]
39+
astyle_py = "astyle_py.__main__:main"
40+
41+
[tool.setuptools.packages.find]
42+
include = ["astyle_py"]
43+
44+
[tool.setuptools.package-data]
45+
"astyle_py" = ["lib/*/libastyle.wasm"]
46+
47+
[tool.setuptools_scm]
48+
write_to = "astyle_py/version.py"
49+
50+
[tool.flake8]
51+
max-line-length = 120
52+
53+
[tool.pytest.ini_options]
54+
addopts = "-s --tb short"
55+
56+
[tool.commitizen]
57+
annotated_tag = true
58+
bump_message = "change: release v$new_version"
59+
name = "cz_customize"
60+
tag_format = "v$version"
61+
update_changelog_on_bump = true
62+
version_provider = "scm"
63+
version_files = ["README.md"]
64+
65+
[tool.commitizen.customize]
66+
bump_map = { "change" = "MINOR", "feat" = "MINOR", "fix" = "PATCH", "refactor" = "PATCH", "remove" = "PATCH", "revert" = "PATCH" }
67+
bump_pattern = "^(change|feat|fix|refactor|remove|revert)"
68+
change_type_order = [
69+
"change",
70+
"ci",
71+
"test",
72+
"docs",
73+
"feat",
74+
"fix",
75+
"refactor",
76+
"remove",
77+
"revert",
78+
]
79+
example = "change: this is a custom change type"
80+
message_template = "{% if scope %}{{change_type}}({{scope}}): {{message}}{% else %}{{change_type}}: {{message}}{% endif %}{% if body %}\n\n{{body}}{% endif %}{% if is_breaking_change %}\n\nBREAKING CHANGE{% endif %}{% if footer %}\n\n{{footer}}{% endif %}"
81+
schema = "<type>(<scope>): <summary>"
82+
schema_pattern = "^([a-z]+)(\\([\\w\\-\\.]+\\))?:\\s.*"
83+
84+
[[tool.commitizen.customize.questions]]
85+
choices = [
86+
{ value = "change", name = "change: A change made to the codebase." },
87+
{ value = "ci", name = "ci: Changes to our CI configuration files and scripts." },
88+
{ value = "test", name = "test: Adding missing tests, correcting or improving existing tests." },
89+
{ value = "docs", name = "docs: Documentation only changes." },
90+
{ value = "feat", name = "feat: A new feature." },
91+
{ value = "fix", name = "fix: A bug fix." },
92+
{ value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature." },
93+
{ value = "remove", name = "remove: Removing code or files." },
94+
{ value = "revert", name = "revert: Revert to a commit." },
95+
]
96+
message = "Select the TYPE of change you are committing"
97+
name = "change_type"
98+
type = "list"
99+
100+
[[tool.commitizen.customize.questions]]
101+
message = "What is the SCOPE of this change (press enter to skip)?"
102+
name = "scope"
103+
type = "input"
104+
105+
[[tool.commitizen.customize.questions]]
106+
message = "Describe the changes made (SUMMARY of commit message):"
107+
name = "message"
108+
type = "input"
109+
110+
[[tool.commitizen.customize.questions]]
111+
message = "Provide additional contextual information - commit message BODY: (press [enter] to skip)"
112+
name = "body"
113+
type = "input"
114+
115+
[[tool.commitizen.customize.questions]]
116+
default = false
117+
message = "Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer"
118+
name = "is_breaking_change"
119+
type = "confirm"
120+
121+
[[tool.commitizen.customize.questions]]
122+
message = "Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)"
123+
name = "footer"
124+
type = "input"

setup.cfg

-45
This file was deleted.

setup.py

-2
This file was deleted.

test/pytest.ini

-4
This file was deleted.

0 commit comments

Comments
 (0)