Use setuptools_scm instead of pbr and implement pep-517

Signed-off-by: Andriy Kurilin <andr.kurilin@gmail.com>
Change-Id: I2d598a0c944fd9e911ef87b51b7fbb73351b68f2
This commit is contained in:
Andriy Kurilin
2025-08-03 21:23:01 +02:00
parent c6754c1df6
commit 48e20b5d55
8 changed files with 105 additions and 73 deletions

View File

@@ -16,8 +16,13 @@ Changelog
.. Release notes for existing releases are MUTABLE! If there is something that .. Release notes for existing releases are MUTABLE! If there is something that
was missed or can be improved, feel free to change it! was missed or can be improved, feel free to change it!
Unreleased [unreleased]
---------- ------------
Added
~~~~~
* CI jobs for checking compatibility with python 3.12
Removed Removed
~~~~~~~ ~~~~~~~
@@ -25,9 +30,14 @@ Removed
* Support for Python 3.8 is dropped * Support for Python 3.8 is dropped
* Removed all support for the retired Murano project * Removed all support for the retired Murano project
* Removed all support for the retired Sahara project * Removed all support for the retired Sahara project
* Removed all support for the retired Senlin project * Removed all support for the retired Senlin project
Changed
~~~~~~~
* Implements pep-517 (pyproject.toml) and replaces pbr dependency
with setuptools-scm
[3.0.0] - 2024-05-23 [3.0.0] - 2024-05-23
-------------------- --------------------

View File

@@ -90,7 +90,7 @@ EOF
# install_rally() - Collect source and prepare # install_rally() - Collect source and prepare
function install_rally() { function install_rally() {
setup_develop $RALLY_DIR setup_package $RALLY_DIR -e
} }
# configure_rally() - Set config files, create data dirs, etc # configure_rally() - Set config files, create data dirs, etc

56
pyproject.toml Normal file
View File

@@ -0,0 +1,56 @@
[project]
name = "rally-openstack"
description = "Rally plugins for OpenStack platform"
authors = [
{name = "OpenStack", email = "openstack-discuss@lists.openstack.org"},
]
readme = "README.rst"
license = { text = "Apache License, Version 2.0"}
classifiers = [
"Environment :: OpenStack",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = ["version", "dependencies"]
requires-python = ">=3.9"
[project.urls]
Homepage = "https://docs.openstack.org/rally/latest/"
[build-system]
requires = [
"setuptools>=64",
"setuptools_scm>=8"
]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
[tool.setuptools_scm]
local_scheme = "no-local-version"
[tool.setuptools.packages.find]
where = ["."]
include = ["rally_openstack*"]
exclude = ["tests"]
[project.entry-points."rally_plugins"]
path = "rally_openstack"
options = "rally_openstack.common.cfg.opts:list_opts"
[project.entry-points."oslo.config.opts"]
rally_openstack = "rally_openstack.common.cfg.opts:list_opts"

View File

@@ -12,17 +12,37 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import pbr.version from importlib.metadata import version as _version
from rally.common import version as __rally_version__ from rally.common import version as __rally_version__
from rally_openstack import _compat from rally_openstack import _compat
if hasattr(__rally_version__, "__version_tuple__"):
__rally_version__ = __rally_version__.__version_tuple__
else:
__rally_version__ = __rally_version__.version_info.semantic_version() __rally_version__ = __rally_version__.version_info.semantic_version()
__rally_version__ = __rally_version__.version_tuple() __rally_version__ = __rally_version__.version_tuple()
__version_info__ = pbr.version.VersionInfo("rally-openstack") try:
__version__ = __version_info__.version_string() # Try to get version from installed package metadata
__version_tuple__ = __version_info__.semantic_version().version_tuple() __version__ = _version("rally-openstack")
except Exception:
# Fallback to setuptools_scm for development installs
try:
from setuptools_scm import get_version # type: ignore[import-untyped]
__version__ = get_version()
except Exception:
# Final fallback - this should rarely happen
__version__ = "0.0.0"
__version_tuple__ = tuple(
int(p) if p.isdigit() else p
for p in __version__.replace("-", ".").split(".")
)
# WARNING: IF YOU ARE LOOKING FOR SOME PHYSICALLY UNEXISTING MODULES THAT CAN # WARNING: IF YOU ARE LOOKING FOR SOME PHYSICALLY UNEXISTING MODULES THAT CAN

View File

@@ -1,9 +1,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
requests!=2.20.0,!=2.24.0 # Apache-2.0 requests!=2.20.0,!=2.24.0 # Apache-2.0
rally>=4.1.0 # Apache License, Version 2.0 rally>=4.1.0 # Apache License, Version 2.0
setuptools_scm
# OpenStack related # OpenStack related
gnocchiclient # Apache Software License gnocchiclient # Apache Software License

View File

@@ -1,34 +0,0 @@
[metadata]
name = rally-openstack
summary = Rally plugins for OpenStack platform
description_file =
README.rst
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/rally/latest/
license = Apache License, Version 2.0
python_requires = >=3.9
classifier =
Environment :: OpenStack
Intended Audience :: Developers
Intended Audience :: Information Technology
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
[files]
packages =
rally_openstack
[entry_points]
rally_plugins =
path = rally_openstack
options = rally_openstack.common.cfg.opts:list_opts
oslo.config.opts =
rally_openstack = rally_openstack.common.cfg.opts:list_opts

View File

@@ -1,20 +0,0 @@
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import setuptools
setuptools.setup(
setup_requires=['pbr>=1.8'],
pbr=True)

12
tox.ini
View File

@@ -46,7 +46,12 @@ commands = ansible-lint --strict --config-file tests/ci/playbooks/.ansible-lint
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
skip_install = true skip_install = true
commands = flake8 commands = flake8
distribute = false
[testenv:mypy]
skip_install = true
deps = {[testenv]deps}
-r{toxinidir}/types-requirements.txt
commands = mypy {posargs:"rally_openstack"}
[testenv:venv] [testenv:venv]
basepython = python3 basepython = python3
@@ -132,10 +137,7 @@ filterwarnings =
error error
ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning
# we do not use anything inner from OptionParser, so we do not care about it's parent # we do not use anything inner from OptionParser, so we do not care about it's parent
ignore:The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.:DeprecationWarning: ignore:The frontend.Option.* class will be.*:DeprecationWarning:
# we do not use Option directly, it is initialized by OptionParser by itself.
# as soon as docutils team get rid of frontend.Option, they will also fix OptionParser
ignore: The frontend.Option class will be removed in Docutils 0.21 or later.:DeprecationWarning:
# raised by designateclient?! # raised by designateclient?!
ignore:dns.hash module will be removed in future versions. Please use hashlib instead.:DeprecationWarning ignore:dns.hash module will be removed in future versions. Please use hashlib instead.:DeprecationWarning
# should be fixed at rally framework (raised by functional job) # should be fixed at rally framework (raised by functional job)