As per the current release tested runtime, we test
till python 3.11 so updating the same in python
classifier in setup.cfg
Change-Id: I377137ecd661364cc7e870617d1f06daf30fc376
This fixes the following two warnings detected by recent Sphinx.
1.
Invalid configuration value found: 'language = None'. Update your
configuration to a valid language code. Falling back to 'en' (English).
2.
WARNING: The pre-Sphinx 1.0 'intersphinx_mapping' format is deprecated
and will be removed in Sphinx 8. Update to the current format as
described in the documentation.
These warnings are treated as errors and `tox -e docs` fails.
Change-Id: I6bde5e865d6d750f878fe618ad8e947fc833d899
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:
UserWarning: Usage of dash-separated 'description-file' will not be
supported in future versions. Please use the underscore name
'description_file' instead
[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb
Change-Id: I17034f1eed5da49087757142e1bfdd885c4f4300
Within 2023.2 python version 3.9 and 3.10 are the
supported python runtimes [1].
[1] https: //review.opendev.org/c/openstack/governance/+/872232
Change-Id: I33d31a585ab5e0a7a213a36a455b5d65113d8480
In Zed cycle testing runtime, we are targetting to drop the
python 3.6/3.7 support, project started adding python 3.8 as minimum,
example nova:
- 56b5aed08c/setup.cfg (L13)
Also moving zuul jobs to `openstack-python3-jobs`.
Change-Id: If02b0159a9a48971a26b503134f5ad5b3b86272f
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: I042162e9f303d2409491f71d3011db175930116d
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
python35 is pretty old and often not available by default on some
operating systems, so we need to be testing python36.
Change-Id: I61a7b7f29add38f2164d9c6907af2a3f31105612
Official projects are doing this as part of enabling python3
first, but it matters more here as a way to manage with local
control.
Change-Id: Ia93cd1a45519f5fe2ddd32a89f896f896f21491f
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.
We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.
We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.
Change-Id: Ia908e642ad1a3f67710d48a71d097c13b7743a5a
If no max or min is set, no Version should match, including
0.0. The test was already correct, but the associated
docstring was a pasto.
Change-Id: I925a9df3b044b1f581b2c62db1bda9ace0a5cc47
The __version__ in __init__.py is not used, and is out of date.
setup.cfg is adjusted to show that python 3.4 receives no attention.
Change-Id: Iaeff8dca06b7c4de2eff497dc2f1e49c4ee1f5e4
This change imports (with slight modification) the
MicroversionMiddleware created for the placement service.
For the time being the middleware relies on WebOb as that is
what it originally relied on. If there are requirements to do
otherwise, later, we can make adjustments then.
The README is updated with limited usage instructions.
Gabbi tests are added, requiring adjustments to the test configuration,
so the opportunity was taken to switch to using stestr instead of testr.
Though arguably "functional" tests because they are not strictly unit
tests, no distinction is made in the tests directory, for now, as it
is all nice and fast and we'd like to keep it that way.
Change-Id: I9d27b6fad35f7aea0085f08c0353f8e8acdb8b73
Use of Version within the placement service has made it clear
that the Version object knowing the min and max versions is
useful when making Version.matches comparisons.
Therefore the matches method has been updated to refer to
min_version and max_version attributes if they are not set
in the matches() request. The extract_version function now
sets those attributes based on the version_list that is
passed to it.
If min and max are not set on the Version object, they default
to negative versions, which are not possible in microversions
and mean matches() (without override args) will be false. The
use of explicit values (instead of None) is so python3 is happy
(and it is better anyway).
Change-Id: I71d091d037abcd068601b32722a09094ae74e658
This change imports two functions and a class from the microversion
handling implementation in the placement service. This code should be
generally useful for other implementations.
The added code provides functions for not just extracting the
microversion from HTTP headers, but for validating that the found
information is actually a properly formed microversion value.
'latest' is translated to whatever latest is in an ordered list of
versions and any found version is confirmed to be within the bounds of
and a member of that list of versions.
The README.rst has been updated to reflect the newly available methods.
This is a start at documentation, but we'll probably want more.
Change-Id: I267586c78308cc5520a88598c350a7e055783f3e
The get_version method accepts a dict or list of tuples that
represent HTTP request headers that will be processed to find a
microversion header. Sometimes, for example in some middlewares,
direct access to a headers dict will not be available and only the
WSGI environ will be present.
This change provides a utility method which creates a new dict of
headers: headers_from_wsgi_environ. This mode was chosen to make it
clear that a copy of the environ is being made, not the environ
itself as we really don't want to be passing that as some values in
it will not be simple objects (strings and numbers) and we do not
know what other middleware might have done or want to do with it.
Internal to get_version any attempt to get a header named 'FOO' will
fall back to looking for the WSGI equivalent of 'HTTP_FOO'.
README.rst has been updated to indicate the new style.
This change is backwards compatible, existing clients will not
notice.
Change-Id: I5262031d9cde0378eabe342c1913091658c3bf9b
Closes-Bug: #1579772
In the fold_headers function, if the headers behaves like a dict,
they were being retured unchanged. This would cause issues in the
later processing to extract the microversion header, which matches
on lower case strings.
Convert these headers to lowercase also provide a test case to
validate the header is being parsed correctly.
Change-Id: I8501c813d668c0a32905906e4ef3f8c6c6b12de2
Close-Bug:# 1606351
This removes the assert to ensure a value for service_type is set. The
keyword style of calling can still be used, so
microversion_parse.get_version(headers, service_type='compute')
will remain working.
Using an assert for this is probably inadvisable, since it will be
stripped away if python is run with -O.
Change-Id: I9775c5d87890c8ff4a6072c600d54fa47264fa9f
WebOb uses a Mapping class for headers which behaves like a dict
but does not inherit from dict, so the isinstance check in
fold_headers was not working as expected. This is now replaced
with a check for dict-like behaviors. It's a bit of a tossup
between doing a hasattr and simply trying to access a key. I chose
the former for readability and because we don't actually want to
do anything with the value we would retrieve were access by a key
legit.
Tests are added to specfically cover the use of a
webob.headers.EnvironHeaders object, which is what headers in
Nova and Nova derivations look like.
Change-Id: I31de49bcfd8822c53d3293b106de96138eaf4464
Initial setup for git review.
Add basic docs handling so that docs tests will pass. No
actual docs in place yet.
Align with global requirements.
Change-Id: I8ae7c2c6ce410c04f4ce53ce5278b2b85c141c93
See README.rst for details.
The basic gist is that a get_version method is provided. It takes a
dict or list of headers and returned a version for a service_type if
it can find it.