Commit Graph

50 Commits

Author SHA1 Message Date
Takashi Kajinami 619d312a18 pre-commit: Integrate bandit
We also remove these unnecessary linter dependencies from
test-requirements.txt.

The independent bandit target was removed because it's integrated to
the pep8 target.

Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
Change-Id: I0c9ca1f9310820c83667bffa2d1287d3daffccbc
2024-02-01 02:37:23 +09:00
wangzihao e52d7b8b96 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I475fe7eac69350e5438cda7310eddd1cb6db813e
2021-08-12 01:19:20 +00:00
songwenping 622f5bf3a3 Drop lower-constraints
Lower-constraints is not a requirement of the OpenStack Python PTI
[0] and there currently is a discussion on the mailing list [1]
about dropping the test, with the oslo team already having done
so [2].

The new dependency resolver in pip fails due to incompatible
dependency versions in our lower-constraints file, meaning that
we were never providing any real guarantees with it.

To unblock the CI, I am disabling lower-constraints job for now,
with the option to reenable it in case we fix the constraints,
and based on the outcome of the mailing list discussions and
consensus.

[0]. https://governance.openstack.org/tc/reference/pti/python.html
[1].
http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019672.html
[2].
http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019659.html

Change-Id: I8c647b325a6f489aaffdab474117c5451852c81e
2021-04-16 10:44:44 +00:00
Hervé Beraud caefc844ea Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

[1] https://review.opendev.org/#/c/722814/
[2] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file

Change-Id: I4b54c27a99a095c7712c88b0e8bd59a21d7bc0b4
2020-11-04 10:51:48 +01:00
Hervé Beraud 1b949f9ced 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: Icaa63c0a076029c228c009015a833b8ca60f1ef4
2020-11-03 16:11:58 +01:00
Hervé Beraud 71122a0cca Adding pre-commit
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commithooks.
- 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: Iba1e2ce707051ea393ac559fc51b1f07da1f6ee8
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-09-09 13:38:50 +02:00
Andreas Jaeger d90726a1eb Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I3f23bf09ef24fe34e128102c34382da98e10f5c1
2020-04-02 15:10:56 +02:00
caoyuan 8433aba4d6 tox: Use upper-constraints for docs jobs
Change-Id: I43225fc4ed3ba471ba7097f1e317bc6ffa777a46
2020-03-11 14:55:49 +00:00
Hervé Beraud 1868508341 [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

Change-Id: If437786eb8dbba9386dd473b45dab0933812c649
2020-02-03 18:30:47 +01:00
Hervé Beraud d8c91bc7d0 tox: Trivial cleanup
Move 'basepython' to the top-level 'testenv'.
Use the default 'install_command'

https://tox.readthedocs.io/en/latest/config.html#conf-install_command

Change-Id: I45981d5e80ab8ea03176ce08e119556fec078a37
2020-01-08 19:51:15 +01:00
caoyuan dad48cabbe tox: Keeping going with docs
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.

[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045

Change-Id: I7d39be84c5c8bd730119220720d2d33cb9e4ef62
2019-10-24 14:47:50 +08:00
pengyuesheng a3c314eee6 Update the constraints url
For more detail, see http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006478.html

Change-Id: I071620b42a9e48590b21bc8bc04b079e01909451
2019-09-29 10:24:05 +08:00
Corey Bryant 1b8bafb391 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Change-Id: Iaf3ca4799bb9e78b180bbfdab26f57d88781bd42
Story: #2005924
Task: #34234
2019-07-05 15:10:54 -04:00
Zuul abba9a1fb0 Merge "Replace git.openstack.org URLs with opendev.org URLs" 2019-05-03 20:29:24 +00:00
jacky06 fc36aa36b7 Replace git.openstack.org URLs with opendev.org URLs
Thorough replacement of git.openstack.org URLs with their opendev.org counterparts.

Change-Id: I90c0338f37fb6c8ed3b555b2d9d6b76aff6dad76
Closes-Bug: #1825935
2019-04-23 05:35:56 +00:00
Ghanshyam Mann 1a87277dd0 Dropping the py35 testing
All the integration testing has been moved to
Bionic now[1] and py3.5 is not tested runtime for
Train or stable/stein[2].

As per below ML thread, we are good to drop the py35
testing now:
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005097.html

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004647.html
[2]
https://governance.openstack.org/tc/reference/runtimes/stein.html
https://governance.openstack.org/tc/reference/runtimes/train.html

Change-Id: I431a9623991dfad180f0654891b930b547df2689
2019-04-15 18:29:32 +00:00
ZhijunWei 1803b63823 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ide3a556918f341de6eafecb36ca431da40a0aed0
Closes-Bug: #1815715
2019-02-13 14:28:34 +08:00
Vu Cong Tuan 0812f94a23 Switch to stestr
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: Ica0262653e8c18681d049acca6d5920ac38f97e6
2018-07-04 08:28:15 +07:00
Doug Hellmann 6a82e0401d 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: Iba35cef6449b9c40a820114d59c1c45f56946b8d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-06 14:53:49 -04:00
Kenneth Giusti d365e4f666 Remove stale pip-missing-reqs tox test
pip_missing_reqs tool is no longer maintained and has broken with
release 10 of pip

Refer to:
 http://lists.openstack.org/pipermail/openstack-dev/2018-April/130027.html

Change-Id: I0f9170586dc4c270df282d8f7417910eec109d78
2018-05-02 11:13:03 -04:00
Doug Hellmann 3987124f3e set default python to python3
Set the default python to python3 except for the py27 environment. We
have to set that explicitly to override the new default.

Change-Id: I931fc5b5c5bd0b746e1600c93897a7551b3f559e
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-13 16:11:10 -04:00
Zuul da8d3c3bbc Merge "add lower-constraints job" 2018-03-29 06:38:00 +00:00
Doug Hellmann 0292d945cb add lower-constraints job
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.

Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.

Add openstack-tox-lower-constraints job to the zuul configuration.

See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.

Change-Id: I6dae26f75d10c070c3d32460fb4cf47bc41a0896
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-03-24 21:02:56 -04:00
Sean McGinnis 94c8bf7f58 Clean old output before new doc builds
Remove the doc/build directory to make sure there are no stale
artifacts from past runs.

Change-Id: Icd65eab77928d78ae775adbea03c8cf537b5adc1
2018-03-21 16:12:44 -05:00
ZhongShengping fc9dc7d5c2 Add -W for document build
For more detials information, please refer to:
http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

Change-Id: Idebdeab428a6fc2aa1f6bba9e919fe4e9f4f6227
2018-03-02 08:53:50 +08:00
ChangBo Guo(gcb) 2ba0aa94a0 Follow the new PTI for document build
For compliance with the Project Testing Interface as described in:

https://governance.openstack.org/tc/reference/project-testing-interface.html

For more detials information, please refer to:

http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

Change-Id: I3d86f1897dc900ba815c0c3975e95e27bb29b532
2017-12-20 17:34:50 +08:00
Andreas Jaeger 464a948d77 Avoid tox_install.sh for constraints support
We do not need tox_install.sh, pip can handle constraints itself
and install the project correctly. Thus update tox.ini and remove
the now obsolete tools/tox_install.sh file.

This follows https://review.openstack.org/#/c/508061 to remove
tools/tox_install.sh.

Change-Id: I0acb957501680b85919ca1672a5d8ad751eac5da
2017-12-02 17:06:59 +00:00
Eric Brown bc8c7d375b Remove references to Python 3.4
Now that there exists only a gate job for Python 3.5 and not 3.4,
we should remove those references to the 3.4 that is untested.

Change-Id: I275c60c1d5154ee7f2e7637a0cee15a83a7d077f
2017-01-09 10:14:48 -08:00
Tony Breeds dfe61b1b1b Add Constraints support
Adding constraints support to libraries is slightly more complex than
services as the libraries themselves are listed in upper-constraints.txt
which leads to errors that you can't install a specific version and a
constrained version.

This change adds constraints support by also adding a helper script to
edit the constraints to remove oslo.utils.

Change-Id: I612b881da465c96ee8200118f8f2b90ef2f02225
2016-12-20 14:20:50 +11:00
ChangBo Guo(gcb) a5a40aca7d Add reno for release notes management
Closes-Bug: #1634356

Change-Id: I6462e42df2a28cd63d6059ef5320cec3ca1473d9
2016-11-01 15:43:10 +08:00
Eric Brown 103a32216e Add Python 3.5 classifier and venv
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.

Change-Id: I96bd1ee7501905cc6a9cf9299b007dadaeac0d28
2016-07-11 20:25:58 -07:00
ChangBo Guo(gcb) 12d4936f12 Trivial: ignore openstack/common in flake8 exclude list
The directory openstack/common doesn't exist any more,
so remove it from flake8 exclude list.

Change-Id: I6f7f6bb9dd8b8e89979efd030a022d7455df67c7
2016-05-11 14:44:16 +08:00
Eric Brown 7e45bcc47d Explicitly exclude tests from bandit scan
Now that the bandit linter runs without a bandit.yaml specified,
it should exclude the tests directory similar to how it did before
in the bandit.yaml.

The reason this has not caused a problem yet is because bandit is
still finding a config bandit.yaml in .tox/pep8/etc/bandit/bandit.yaml.
But in a newer version of bandit this will not be the case.

Change-Id: Ic2d6d5da7083936eb364f56fb23e09b5dbccebae
2016-03-12 20:01:36 -08:00
ChangBo Guo(gcb) 04e34e7265 Enable bandit in gate
Run security linter bandit as part of pep8. Pep8
is the usual linter target and thus let's use it there instead of
starting another short-running job to enable it.

Change-Id: Id05b3d06fa25e8cf436d67f8aac400e96c7f75cd
2016-02-27 05:48:50 +08:00
Davanum Srinivas cf3de7d5f7 Remove bandit.yaml in favor of defaults
With latest bandit version, The bandit.yaml is only necessary
for advanced tweaking. We can just use the defaults.

Change-Id: Ie635370474f5e86d0d6188a52b581f04b14bd484
2016-02-04 19:16:48 -05:00
Joshua Harlow 479587c6d9 Revert "Move netifaces to extras"
For now revert this, at a later date we can reapply
this but we need to order this a little differently to
make it work out.

This reverts commit 2abbe1c3b1.

Change-Id: I20f3c5804caf1af698aa0f6397a9953eb9aba829
2015-12-07 12:44:17 -08:00
Davanum Srinivas 2abbe1c3b1 Move netifaces to extras
netifaces is a very heavy requirement especially for
python clients, the code that uses netifaces is called
only in exception paths at least now. So let us move
this requirement to extras to reduce the time taken
to install oslo.utils.

Closes-Bug: #1517069
Change-Id: If3430364e49c1c0b1d9f4937bb67900380662728
2015-11-21 13:16:51 -05:00
Cyril Roelandt 92661e47ba Add a bandit target to tox.ini
Some parts of the code have been annoted with "# nosec" as they made bandit
raise false positives.

Change-Id: I9d8a8ab79e8b5de98e7d291ac132f8971a44216d
2015-11-20 15:52:51 +01:00
Davanum Srinivas 1109598332 Remove python 2.6 and cleanup tox.ini
* Remove support for python 2.6
* Remove skipsdist : Needs to be set only if 
  sdist is expensive
* Remove usedevelop : only needed when skipsdist 
  is set to True
* Remove install_command : We can just use the 
  default, we don't need to override
* Remove setenv : We can just use the default as
  we don't need any extra environment variables
* Remove requirements.txt from deps, as this is
  already added automatically


Change-Id: I8fa1a3db7e156d5ee9b62490a63e2ccf0ffdd7f9
2015-11-16 00:38:26 +00:00
Ronald Bradford 5f273a1161 Fix coverage configuration and execution
A number of configuration errors prevent the successful creation of code
coverage. This corrects the .coveragerc source/omit setup and the tox
package name generation.

http://lists.openstack.org/pipermail/openstack-dev/2015-October/076193.html

Change-Id: Ic7bd03b1411a92c04dc6ea8c5995f88d1738a156
2015-10-08 17:23:20 -04:00
Davanum Srinivas f222f80930 flake8 - remove unused rules
Change-Id: Ibe23b07d82be32bf7bcdc69ef259d3eaaebf0435
2015-08-08 11:41:38 +00:00
Davanum Srinivas e608e62f10 Add tox target to find missing requirements
Change-Id: I34e093a03489285508ca0498c56ae6693444d203
2015-06-26 07:34:18 -04:00
Davanum Srinivas bb7eebb4c2 Advertise support for Python3.4 / Remove support for Python 3.3
Change-Id: I22b4e781eb96a39cbb49e750e6afc9a83cc9f51d
2015-05-10 19:22:25 -04:00
Doug Hellmann ca76fdcb52 Move files out of the namespace package
Move the public API out of oslo.utils to oslo_utils. Retain the ability
to import from the old namespace package for backwards compatibility for
this release cycle.

bp/drop-namespace-packages

Change-Id: Ic6dd62097399bf75e3d11b4d8a6400971069c415
2015-01-06 17:07:36 -05:00
James Carey b8d5872ef8 Activate pep8 check that _ is imported
Remove the specification in tox.ini that _ is a builtin so that
it will no longer assume that _ does not need to be imported.

This helps ensure that the _ from i18n is used.

Activating this check did not flag any violations.

Change-Id: I7b7f96cbece2192432a9b7b6a4355ebf0c868926
2014-10-31 20:13:38 +00:00
Jeremy Stanley fa774531ea Work toward Python 3.4 support and testing
Change-Id: I80ab362b6b7cca808e4969870f5c8416b6a14b70
2014-09-03 19:05:03 +00:00
Doug Hellmann 3a09189098 Add API docs and clean up other docs
Add auto-generated documentation for the public modules in the library
and clean up a bit of the docstrings used.

Change-Id: Id5efa5c413b82e13f1a7ac78c92e39c193f12214
2014-07-23 16:05:59 -04:00
Davanum Srinivas 9711b3d31b get pep8 working 2014-06-18 23:14:57 -04:00
Davanum Srinivas 01bca57862 Get the tox tests working 2014-06-18 23:12:10 -04:00
Davanum Srinivas 7b9410e41c exported from oslo-incubator by graduate.sh 2014-06-18 20:45:08 -04:00