Migrate setup configuration to pyproject.toml

This causes some reformatting by ruff as it can now detect the minimum
Python version supported.

Change-Id: Id373609a39cee8ac8a992b5abe1f45ba4e4421c9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-09-11 14:50:56 +01:00
parent 1d3a9594e1
commit 151fd83943
3 changed files with 63 additions and 54 deletions

View File

@@ -147,37 +147,37 @@ class RequestContext:
def __init__(
self,
auth_token: ty.Optional[str] = None,
user_id: ty.Optional[str] = None,
project_id: ty.Optional[str] = None,
domain_id: ty.Optional[str] = None,
user_domain_id: ty.Optional[str] = None,
project_domain_id: ty.Optional[str] = None,
auth_token: str | None = None,
user_id: str | None = None,
project_id: str | None = None,
domain_id: str | None = None,
user_domain_id: str | None = None,
project_domain_id: str | None = None,
is_admin: bool = False,
read_only: bool = False,
show_deleted: bool = False,
request_id: ty.Optional[str] = None,
resource_uuid: ty.Optional[str] = None,
request_id: str | None = None,
resource_uuid: str | None = None,
overwrite: bool = True,
roles: ty.Optional[list[str]] = None,
user_name: ty.Optional[str] = None,
project_name: ty.Optional[str] = None,
domain_name: ty.Optional[str] = None,
user_domain_name: ty.Optional[str] = None,
project_domain_name: ty.Optional[str] = None,
roles: list[str] | None = None,
user_name: str | None = None,
project_name: str | None = None,
domain_name: str | None = None,
user_domain_name: str | None = None,
project_domain_name: str | None = None,
is_admin_project: bool = True,
service_token: ty.Optional[str] = None,
service_user_id: ty.Optional[str] = None,
service_user_name: ty.Optional[str] = None,
service_user_domain_id: ty.Optional[str] = None,
service_user_domain_name: ty.Optional[str] = None,
service_project_id: ty.Optional[str] = None,
service_project_name: ty.Optional[str] = None,
service_project_domain_id: ty.Optional[str] = None,
service_project_domain_name: ty.Optional[str] = None,
service_roles: ty.Optional[list[str]] = None,
global_request_id: ty.Optional[str] = None,
system_scope: ty.Optional[str] = None,
service_token: str | None = None,
service_user_id: str | None = None,
service_user_name: str | None = None,
service_user_domain_id: str | None = None,
service_user_domain_name: str | None = None,
service_project_id: str | None = None,
service_project_name: str | None = None,
service_project_domain_id: str | None = None,
service_project_domain_name: str | None = None,
service_roles: list[str] | None = None,
global_request_id: str | None = None,
system_scope: str | None = None,
):
"""Initialize the RequestContext
@@ -466,7 +466,7 @@ def get_context_from_function_and_args(
function: ty.Callable[..., ty.Any],
args: list[ty.Any],
kwargs: dict[str, ty.Any],
) -> ty.Optional[RequestContext]:
) -> RequestContext | None:
"""Find an arg of type RequestContext and return it.
This is useful in a couple of decorators where we don't know much about the
@@ -488,7 +488,7 @@ def is_user_context(context: ty.Any) -> bool:
return True
def get_current() -> ty.Optional[RequestContext]:
def get_current() -> RequestContext | None:
"""Return this thread's current context
If no context is set, returns None

View File

@@ -2,6 +2,40 @@
requires = ["pbr>=6.1.1"]
build-backend = "pbr.build"
[project]
name = "oslo.context"
description = "Oslo Context library"
authors = [
{name = "OpenStack", email = "openstack-discuss@lists.openstack.org"},
]
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {text = "Apache-2.0"}
dynamic = ["version", "dependencies"]
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",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
]
[project.urls]
Homepage = "https://docs.openstack.org/oslo.context/latest/"
[tool.setuptools]
packages = [
"oslo_context"
]
[tool.ruff]
line-length = 79
@@ -16,7 +50,7 @@ select = ["E4", "E7", "E9", "F", "S", "U"]
"oslo_context/tests/*" = ["S"]
[tool.mypy]
python_version = "3.9"
python_version = "3.10"
show_column_numbers = true
show_error_context = true
ignore_missing_imports = true

View File

@@ -1,27 +1,2 @@
[metadata]
name = oslo.context
summary = Oslo Context library
description_file =
README.rst
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/oslo.context/latest/
python_requires = >=3.10
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
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
[files]
packages =
oslo_context