Skip to content

Commit 568b021

Browse files
committed
build: change build system to poetry
1 parent 93d2918 commit 568b021

File tree

6 files changed

+223
-212
lines changed

6 files changed

+223
-212
lines changed

caso/__init__.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,25 @@
1616

1717
"""cASO is an accounting extractor."""
1818

19-
import pbr.version
19+
import importlib.metadata
20+
import pathlib
21+
from contextlib import suppress
2022

23+
__version__ = "4.2.0"
24+
25+
26+
def extract_version() -> str:
27+
"""Return either the version of the package installed."""
28+
with suppress(FileNotFoundError, StopIteration):
29+
root_dir = pathlib.Path(__file__).parent.parent.parent
30+
with open(root_dir / "pyproject.toml", encoding="utf-8") as pyproject_toml:
31+
version = (
32+
next(line for line in pyproject_toml if line.startswith("version"))
33+
.split("=")[1]
34+
.strip("'\"\n ")
35+
)
36+
return f"{version}-dev (at {root_dir})"
37+
return importlib.metadata.version(__package__ or __name__.split(".", maxsplit=1)[0])
2138

22-
__version__ = pbr.version.VersionInfo("caso").release_string()
2339

2440
user_agent = f"caso/{__version__} (OpenStack)"

caso/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ def parse_args(argv, default_config_files=None):
3535
cfg.CONF(
3636
argv[1:],
3737
project="caso",
38-
version=caso.__version__,
38+
version=caso.extract_version(),
3939
default_config_files=default_config_files,
4040
)

pyproject.toml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
[tool.poetry]
2+
3+
name = "caso"
4+
version = "4.2.0"
5+
description = "cASO is an OpenStack Accounting extractor."
6+
readme = "README.md"
7+
license = "Apache-2.0"
8+
9+
authors = [
10+
"Alvaro Lopez Garcia <[email protected]>",
11+
"Aida Palacio Hoz <[email protected]>",
12+
]
13+
14+
homepage = "http://github.com/IFCA/caso"
15+
repository = "http://github.com/IFCA/caso"
16+
documentation = "https://caso.readthedocs.io/"
17+
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Environment :: Console",
21+
"Environment :: OpenStack",
22+
"Intended Audience :: Information Technology",
23+
"Intended Audience :: System Administrators",
24+
"License :: OSI Approved :: Apache Software License",
25+
"Operating System :: POSIX :: Linux",
26+
"Programming Language :: Python",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
]
34+
35+
include = [
36+
"etc/caso/caso.conf.sample",
37+
"voms.json.sample",
38+
]
39+
40+
41+
[tool.poetry.urls]
42+
"Bug Tracker" = "https://github.com/IFCA/caso/issues"
43+
44+
45+
[tool.poetry.scripts]
46+
caso-extract = "caso._cmd.extract:main"
47+
caso-projects = "caso._cmd.projects:main"
48+
caso-mapping-migrate = "caso._cmd.projects:migrate"
49+
50+
51+
[tool.poetry.plugins] # Optiona super table
52+
53+
54+
[tool.poetry.plugins."oslo.config.opts"]
55+
56+
caso = "caso.opts:list_opts"
57+
58+
59+
[tool.poetry.plugins."caso.extractors"]
60+
61+
nova = "caso.extract.openstack.nova:NovaExtractor"
62+
neutron = "caso.extract.openstack.neutron:NeutronExtractor"
63+
cinder = "caso.extract.openstack.cinder:CinderExtractor"
64+
65+
66+
[tool.poetry.plugins."caso.messenger"]
67+
noop = "caso.messenger.noop:NoopMessenger"
68+
ssm = "caso.messenger.ssm:SSMMessenger"
69+
ssmv4 = "caso.messenger.ssm:SSMMessengerV04"
70+
logstash = "caso.messenger.logstash:LogstashMessenger"
71+
72+
73+
[tool.poetry.dependencies]
74+
python = "^3.8.1"
75+
six = "^1.16.0"
76+
dirq = "^1.8"
77+
python-dateutil = "^2.9.0.post0"
78+
oslo-config = "^9.6.0"
79+
oslo-concurrency = "^6.1.0"
80+
oslo-log = "^6.1.2"
81+
oslo-utils = "^7.3.0"
82+
python-cinderclient = "^9.6.0"
83+
python-novaclient = "^18.7.0"
84+
python-keystoneclient = "^5.5.0"
85+
python-glanceclient = "^4.7.0"
86+
python-neutronclient = "^11.3.1"
87+
keystoneauth1 = "^5.8.0"
88+
stevedore = "^5.3.0"
89+
pydantic = "^2"
90+
91+
92+
[tool.poetry.group.test.dependencies]
93+
pytest = "^8.3.3"
94+
pytest-cov = "^5.0.0"
95+
fixtures = "^4.1.0"
96+
mock = "^5.1.0"
97+
testtools = "^2.7.2"
98+
reno = "^4.1.0"
99+
100+
101+
[tool.poetry.group.test-flake8.dependencies]
102+
flake8 = "^7.1.1"
103+
flake8-bugbear = "^24.8.19"
104+
flake8-docstrings = "^1.7.0"
105+
flake8-typing-imports = "^1.15.0"
106+
flake8-colors = "^0.1.9"
107+
pep8-naming = "^0.14.1"
108+
pydocstyle = "^6.3.0"
109+
110+
111+
[tool.poetry.group.test-bandit.dependencies]
112+
bandit = "^1.7.10"
113+
114+
115+
[tool.poetry.group.test-pypi.dependencies]
116+
poetry = "^1.8.3"
117+
118+
119+
[tool.poetry.group.test-black.dependencies]
120+
black = "^24.8.0"
121+
122+
123+
[tool.poetry.group.test-mypy.dependencies]
124+
mypy = "^1.11.2"
125+
types-six = "^1.16.21.20240513"
126+
types-python-dateutil = "^2.9.0.20240906"
127+
128+
129+
[build-system]
130+
requires = ["poetry-core"]
131+
build-backend = "poetry.core.masonry.api"

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)