Commit Graph

43 Commits

Author SHA1 Message Date
Takashi Kajinami 26a2dc96cc Bump hacking
hacking 3.0.x or 2.0.x is too old.

Change-Id: I2784d242ba320c2019ddc26f7653985a64e6f598
2024-01-28 15:54:38 +09:00
Takashi Kajinami 05107bff05 Update python classifier in setup.cfg
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
2024-01-10 22:47:44 +09:00
Zuul 8b75af5cf5 Merge "setup.cfg: Replace dashes with underscores" 2023-09-07 11:39:03 +00:00
Takashi Kajinami 943a2f474c Fix warnings in doc build
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
2023-09-07 19:48:13 +09:00
niuke 3d3edb7a27 setup.cfg: Replace dashes with underscores
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
2023-08-07 15:38:15 +08:00
Ghanshyam edddb6bf49 Revert "Moves supported python runtimes from version 3.8 to 3.10"
This reverts commit 18f5be785d.

Keeping Python 3.10 in setup.cfg classifier. 

Reason for revert:

Needed-By: https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/882175

TC has been discussing about re-adding the python 3.8
testing in current master 2023.2 release testing.

- https://meetings.opendev.org/meetings/tc/2023/tc.2023-04-25-18.00.log.html#l-191
- https://lists.openstack.org/pipermail/openstack-discuss/2023-April/033469.html

While governance changes are under review, TC agreed to add py3.8 testing
so that we do not see more project/lib dropping python 3.8 and make them
uninstalable on python 3.8

- https://meetings.opendev.org/meetings/tc/2023/tc.2023-05-02-18.00.log.html#l-17
- https://review.opendev.org/c/openstack/governance/+/882165

Also adding py3.8 testing back in job https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/882175

Change-Id: I4ea8230d23e9c23e25bde5867c9dd543da22d265
2023-05-04 20:21:09 +00:00
Takashi Kajinami 18f5be785d Moves supported python runtimes from version 3.8 to 3.10
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
2023-04-10 13:17:40 +09:00
niuke d8e123228d remove unicode from code
Change-Id: Ief8896fd7244e29d4c471802b6734eac1e19447d
2022-07-28 08:58:56 +08:00
Hervé Beraud 6d98355f13 Drop python3.6/3.7 support in testing runtime
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
2022-05-09 15:10:02 +02:00
Zuul de4bf21ff3 Merge "Use py3 as the default runtime for tox" 2021-04-16 14:25:30 +00:00
Daniel Bengtsson ee08574e2d Move flake8 as a pre-commit local target.
The goal here is to avoid conflicts between flake8 and hacking version each
2 days.

Inspired from nova's approach[1].

The flake8 version to install will be determined by hacking and
requirements[2] will stay aligned instead of relying on different versions.

[1] https://opendev.org/openstack/nova/src/branch/master/.pre-commit-config.yaml#L26-L35
[2] https://opendev.org/openstack/hacking/src/branch/master/requirements.txt#L1

Change-Id: Ie5400425ff350ec4c165ec4e9392c43679a0ae46
2021-03-23 13:13:42 +01:00
Hervé Beraud dc07afb686 Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update this at
each new cycle.

Wallaby support officially the following runtimes [1]:
- Python 3.6
- Python 3.8

During Victoria Python 3.7 was used as the default runtime [2] however this
version isn't longer officially supported.

[1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby
[2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria

Change-Id: I9791e5696bab3af4a6109e756ce791d23b9d28b1
2021-01-21 15:42:04 +01:00
Hervé Beraud 4ea5fb3285 Use Python 3.8 as the default runtime for tox
Wallaby support officially the following runtimes [1]:
- Python 3.6
- Python 3.8

During Victoria Python 3.7 was used as the default runtime [2] however this
version isn't longer officially supported.

Moving on the most recent officially supported runtime as the default runtime
for tox.

[1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby
[2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria

Change-Id: I913d3dd7af3e82bdea63b96609739772ece81326
2020-11-03 14:32:48 +01:00
Hervé Beraud 89cb11c85c Adding pre-commit
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>
2020-09-15 15:19:35 +02:00
Moisés Guimarães de Medeiros 2c36df6bf3 fix python version in tox file: py35 -> py37
Change-Id: I74cdd7462cd5134b22d0c6b13aafd0e88ef60e1c
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-02-14 16:06:54 +01:00
Hervé Beraud 602fbc83d4 adding missing releasenote for the drop of py27 support
Change-Id: I2b887873d30171bc979728d975b40b9dc6065735
2020-02-06 12:26:58 +01:00
Andreas Jaeger dbf8dd6bcf [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Switch to modern sphinx-build and using openstackdocstheme
(note that repo is not building and publishing docs, docs building works
locally with these changes).

Change-Id: I9542c1dba3f339c2acece83d7d2b5726c1c3e2bc
2020-02-03 17:12:24 +01:00
OpenDev Sysadmins e418e75089 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:42:56 +00:00
Vieri 587cf0bb24 Change openstack-dev to openstack-discuss
Mailinglists have been updated. Openstack-discuss replaces openstack-dev.

Change-Id: I95f08e4cf53daafb1c7cd087597d43a54b92e2f1
2018-12-04 19:06:06 +00:00
Chris Dent 93d9bfa601 Add python36 jobs to microversion-parse
python35 is pretty old and often not available by default on some
operating systems, so we need to be testing python36.

Change-Id: I61a7b7f29add38f2164d9c6907af2a3f31105612
2018-09-04 10:16:46 +01:00
Chris Dent ef25083678 Copy zuul job settings from project-config
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
2018-09-04 09:17:45 +01:00
huang.zhiping 3f2247327a fix tox python3 overrides
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
2018-06-09 10:41:40 +08:00
Chris Dent ae5e3ce521 Enable universal wheels for microversion-parse
The library is fully python 3 and 2 happy, so the wheel
should be too.

Change-Id: I62f437ed7ac7852f400fd4d8391577c8ea3ab6a9
2018-03-21 17:39:24 +00:00
Chris Dent 6a379d9783 Correct docstring on Version(0, 0) test
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
2018-03-21 15:18:23 +00:00
Chris Dent e93d35f10d Do not use redundant attr check for keys in fold_headers
We only care about items, so use it, and pass if we get an
AttributeError

Change-Id: I7a09b63db390431be044ae3fc6aeece565606b40
Closes-Bug: #1756157
2018-03-20 17:24:56 +00:00
Chris Dent 4b87196837 Clean up package version and python version support
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
2018-03-20 17:24:56 +00:00
Chris Dent f816e324b8 Allow passing a json_error_formatter to the middleware
This is so error responses can be formatted according to the rules
of the application.

Change-Id: Ie44399447a349ebc49251dc63c23f56c6423fca6
2018-03-20 17:24:56 +00:00
Chris Dent b5359fcd80 Add MicroversionMiddleware
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
2018-03-20 17:24:56 +00:00
Chris Dent e346558d5f Improve Version.matches() method
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
2018-03-20 17:23:26 +00:00
Chris Dent da0b4d66c9 Import functions from placement
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
2018-03-15 18:15:25 +00:00
Chris Dent bd003b52a5 Provide a helper method to get headers from environ
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
2018-03-15 18:15:20 +00:00
PollyZ 1f6eac7c3d Convert dict headers and Webob headers into lowercase.
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
2016-07-29 13:22:36 -05:00
Chris Dent c031779d58 Fix summary information used in pypi display
Typo in summary information fixed.

Change-Id: I1cfbd2c020cac406944b5b380c9ce13d038ab343
2016-04-11 18:59:35 +01:00
Louis Taylor 4b04aaf3b2 Make service_type a positional argument
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
2016-04-08 14:03:08 +01:00
Chris Dent 2f044aae4e Include README.rst content on doc index
This is so there is at least some bare bones documentation to
start from.

Change-Id: I839e574bb1b52d16bc235d0437c60cff017d4594
2016-03-31 18:07:23 +01:00
Chris Dent b1f7162324 Fix folded header checks for WebOb
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
2016-03-31 14:03:13 +01:00
Chris Dent 33e0066354 Enable gerrit, gitreview and gate testing
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
2016-03-31 12:31:20 +01:00
Chris Dent 45916f2af1 Cleanup README
Some formatting errors.
2016-03-24 13:35:42 +00:00
Chris Dent 1214334f43 allow tox to skip missing interpreters 2016-03-24 13:28:08 +00:00
Chris Dent 615383062c package for initial release 2016-03-24 13:25:59 +00:00
Chris Dent d2c4bb7605 Change interface to explicitly pass legacy_headers
Based on suggestion from @sdague

TODO: more tests, positive and negative
2016-03-22 19:44:18 +00:00
Chris Dent 49b44934b9 Initial proof of concept of microversion_parse
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.
2016-03-22 17:48:42 +00:00
Chris Dent db6fb70f72 Initial commit 2016-03-22 15:29:38 +00:00