Adopt uv instead of pip

- fix pyproject.toml file name (causing few reformats missed previously)
- extend pyproject.toml with the info from setup.cfg to make uv work
- introduce uv and start using it inside tox
- fix unittest that started failing due to that change

Change-Id: I461ffc9fee39085f795ced07b7d00ebde28a6034
This commit is contained in:
Artem Goncharov 2024-09-18 16:47:15 +02:00
parent e0f1e9c0b2
commit e3dda1cbc3
5 changed files with 4545 additions and 70 deletions

View File

@ -2,3 +2,4 @@ docutils>=0.11 # OSI-Approved Open Source, Public Domain
openstackdocstheme>=2.2.1 # Apache-2.0
reno>=3.1.0 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
setuptools;python_version < '3.12' # py310 misses pkg_resources without setuptools needed by pbr

View File

@ -1,14 +1,105 @@
[project]
name = "openstack-codegenerator"
description = "Generator for OpenStack stuff"
authors = [
{name = "Artem Goncharov"},
{email="openstack-discuss@lists.openstack.org"}
]
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {text = "Apache-2.0"}
dynamic = ["version"]
dependencies = [
"Jinja2>=3.0", # BSD
"jsonref>=1.0", # MIT
"openapi_core>=0.17", # BSD
"pydantic>=2.6", # MIT
"ruamel.yaml>=0.18", # MIT
"jsonschema>=4.19", # MIT
"beautifulsoup4>=4.0", # MIT
# convert html into markdown
"markdownify>=0.11", # MIT
# wrap markdown when rendering
"mdformat>=0.7", # MIT
# Get sphinx docstrings from source code
"sphinx>=4.0.0", # BSD
# Convert rst docstrings to html (openapi)
"docutils>=0.20", # MIT
"wsgi-intercept>=1.13", # MIT
"wsme>=0.12", # MIT
"oslotest>=5.0.0", # Apache-2.0
"openstacksdk>=2.0", # Apache-2.0
]
requires-python = ">=3.10"
classifiers = [
"Environment :: OpenStack",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
# Codegenerator is currently not intended to be uploaded to pypi
"Private :: Do Not Upload",
]
[project.optional-dependencies]
test = [
# pip is necessary since siblings installation job uses it
"pip", # Apache-2.0
"flake8-import-order==0.18.2", # LGPLv3
"stestr>=1.0.0" # Apache-2.0]
]
block-storage = ["cinder>=23.0"]
compute = ["nova>=28.0"]
identity = ["keystone>=23.0"]
image = ["glance>=27.0"]
load-balancing = ["octavia>=11.0"]
network = ["neutron>=23.1", "neutron-vpnaas>=23.0"]
placement = ["openstack-placement>=10.0"]
shared-file-system = ["manila>=18.0"]
[project.urls]
Homepage = "https://docs.openstack.org/codegenerator"
Repository = "https://opendev.org/openstack/codegenerator/"
[project.scripts]
openstack-codegenerator = "codegenerator.cli:main"
[build-system]
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
build-backend = "pbr.build"
[tool.uv]
[tool.ruff]
line-length = 79
target-version = "py38"
[tool.setuptools]
packages = [
"codegenerator"
]
[tool.ruff.lint]
# enable the following rule classes:
#
# C4: https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
# UP: https://docs.astral.sh/ruff/rules/#pyupgrade-up
select = ["C4", "UP"]
[tool.ruff.format]
quote-style = "double"
docstring-code-format = true
skip-magic-trailing-comma = true
[tool.mypy]
show_column_numbers = true
show_error_context = true
ignore_missing_imports = true
# follow_imports = normal
follow_imports = "skip"
incremental = true
check_untyped_defs = true
warn_unused_ignores = true

View File

@ -1,59 +1,2 @@
[metadata]
name = openstack-codegenerator
summary = Generator for OpenStack stuff
description_file =
README.rst
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/openstacksdk/
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
python_requires = >=3.10
[files]
packages =
codegenerator
[entry_points]
console_scripts =
openstack-codegenerator = codegenerator.cli:main
[extras]
block-storage =
cinder>=23.0
compute =
nova>=28.0
identity =
keystone>=23.0
image =
glance>=27.0
load-balancing =
octavia>=11.0
network =
neutron>=23.1
neutron-vpnaas>=23.0
placement =
openstack-placement>=10.0
shared-file-system =
manila>=18.0
baremetal =
ironic>=26.0
[mypy]
show_column_numbers = true
show_error_context = true
ignore_missing_imports = true
# follow_imports = normal
follow_imports = skip
incremental = true
check_untyped_defs = true
warn_unused_ignores = true

29
tox.ini
View File

@ -1,6 +1,9 @@
[tox]
requires =
tox>=4.2
tox-uv>=1.11.3
minversion = 4.3.0
envlist = pep8,py311
envlist = pep8,py312
ignore_basepython_conflict=True
[testenv]
@ -11,17 +14,14 @@ passenv =
setenv =
LANG=en_US.UTF-8
LANGUAGE=en_US:en
install_command = python -I -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
extras = test
commands =
# A very dirty hack to bypass dependency conflict of openapi-core/jsonchema/referencing
pip install -U openapi-core
uv pip install -U openapi-core
stestr run {posargs}
stestr slowest
[testenv:functional{,-py310,-py311}]
[testenv:functional{,-py310,-py311,-py312}]
description =
Run functional tests.
setenv =
@ -33,7 +33,7 @@ commands =
stestr --test-path ./codegenerator/tests/functional/ run {posargs}
stestr slowest
[testenv:docs{,-py310,-py311}]
[testenv:docs{,-py310,-py311,-py312}]
description =
Build documentation in HTML format.
# We do not want the package (because of heavy dependencies for docs)
@ -41,14 +41,17 @@ skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
pip
commands =
sphinx-build -W --keep-going -b html -j auto doc/source/ doc/build/html
[testenv:releasenotes{,-py310,-py311}]
[testenv:releasenotes{,-py310,-py311,-py312}]
# We do not want the package (because of heavy dependencies for docs)
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
skip_install = True
pip
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
@ -56,17 +59,17 @@ commands =
description =
Run style checks.
deps =
pre-commit
pre-commit-uv>=4.1.3
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:publish-openapi-specs]
description =
No-op env for publishing built Specs
skip_install = True
deps =
# We need any dependency, since only that causes `tox -epublish --notest` to create log dir that is required by tox-siblings role
pbr
skip_install = True
pip
commands =
[flake8]

4437
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff