Commit Graph

15 Commits

Author SHA1 Message Date
Takashi Kajinami 343b2db574 Remove unmaintained API report tooling
This tool has not get any meaningful update for 7 years and looks
unmaintained.

Change-Id: I80ed6035f5a54cd97d2af574138a35893ddac65d
2023-11-14 17:38:20 +00:00
Takashi Natsume cb031937ed Remove import statement for six
Utilization of six library have been removed since
Ic6da328a6219c8a00d38602f6b539a2ff5be1b2e .
However an import statement for six in tools/pyir.py
has not been removed.
So remove the import statement for six in tools/pyir.py.

Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Change-Id: Iff0252ab07cef36b0ec8f4abcc3092959fae161c
2021-12-19 14:21:51 +09:00
Takashi Kajinami d4374c2254 Replace deprecated inspect.getargspec
inspect.getargspec was deprecated since Python 3.0 and
inspect.getfullargspec is its replacement with correct handling of
function annotations and keyword-only parameters[1].

[1] https://docs.python.org/3/library/inspect.html#inspect.getargspec

Change-Id: I1d72d3879a8aa12fdbe722f7b2370b44b9fd71e7
2021-07-15 20:37:17 +09:00
Brian Haley e92e98f8c6 Start running pylint for pep8 tests
When 'tox -e pep8' was run it didn't run any pylint
checks, let's start doing it.

Fixed issues pylint found, 2.6.0 added two new checkers
[1] that make pep8 validation fail:

- raise-missing-from (W0707)
- super-with-arguments (R1725)

[1] http://pylint.pycqa.org/en/latest/technical_reference/features.html

Change-Id: Ib83f30696269c968f41f9c1131596268a4412658
2020-09-17 09:53:01 -04:00
gugug 323364f234 Use importlib to take place of imp module
The imp module is deprecated[1] since version 3.4, use importlib to
instead

[1]: https://docs.python.org/3/library/imp.html

Change-Id: Ib576170fcc3000e418ae28179559d67f20de4efc
2020-08-30 19:38:43 +08:00
Rodolfo Alonso Hernandez 478502b3df Remove library "six"
Now Python2 is not supported, this compatibility library for both
versions is not needed anymore.

Change-Id: Ic6da328a6219c8a00d38602f6b539a2ff5be1b2e
2020-01-22 13:16:45 +00:00
Andreas Jaeger e8f2616574 Remove tools/tox_install.sh
This repo does not need tools/tox_install.sh at all, instead call pip
install directly and add constraints to dependencies.

Change-Id: Id6b1afde54d3dc26c1e95e85ec7e6a7100ff671b
2018-03-07 20:31:12 +01:00
csatari 136361273d Parameter modifications of edit-constraints
Having neutron-lib in the upper-constraints file causes
the api-ref build fail. With this change neutron-lib is
removed by edit-constraints.

Change-Id: Ic6ae5ca829f73477c54999bab3eb5d9320636219
Signed-off-by: csatari <gergely.csatari@nokia.com>
2017-08-22 10:03:51 +02:00
YAMAMOTO Takashi 2ce2b2ccbb Validate API sample JSON files
Change-Id: I0428e54c4eada67a967a5df36ce9d35a84335c97
2017-02-10 11:15:01 +09:00
Boden R 75ae597a8c Updates to API report tooling
This patch updates our api-report tooling as follows:
- Bugfix to support None as a valid public API attribute value.
- Rather than tracking collections with scalars, the tool now just
tracks the type of the collection (e.g. dict, list, etc.). There's no
reason for this tool to dig into collections and track their values
for API (tho it could do more with additional effort/code).
- Better handling/output for API signature changes. Previously
some of the output describing a changed API was a bit confusing.
This patch tries to address that issue by adding additional handling
for the scenario.

Sample output from current report [1] vs output with this patch [2].

[1] http://paste.openstack.org/show/587662/
[2] http://paste.openstack.org/show/587663/

Change-Id: Ic380633477c9939773198463a21ef887d575aa21
2016-11-02 10:05:56 -06:00
Ihar Hrachyshka b5454ede0e Add support for upper-constraints.txt for all tox targets
This will make neutron-lib gate use dependency versions that are sanity
checked by jobs in openstack/requirements gate.

Since the library is itself in upper-constraints.txt file, we should
remove its entry from the constraints file before applying it, otherwise
pip will fail due to version conflict between what's in the current
library repo and what's in constraints file.

Change-Id: I6a708e7b618f2f2da9c9210a19e4d4e4ac370462
2016-09-20 13:20:38 +00:00
Boden R effbe8b715 Enhance pyir tooling CLI
This change updates the pyir report tooling:
- Regex patterns for blacklisting report generation and
diff are now supported via CLI.
- CLI commands are modularized for easier extension.
- A new CLI command is added that takes an existing JSON
API report and outputs its signatures to STDOUT. This is
useful for listing an API given a report.
- A few minor bugs are fixed that were found during testing.

Note:
This is the last major "enhancement" I have planned for this
tooling code in its current form. Of course bugs will be
addressed. Once we give it a little burn-in time (assuming we
find it useful) I'll query the broader community for interest.
If there's broader interest I'll consider refactoring + hosting
it as a separate project (obviously a ways out, as that takes
time).

Change-Id: Ia6ed70bd9457e119a6c12d8d133f77384e392282
2016-08-17 09:16:44 -06:00
Boden R 14352ef121 Generate API report tooling
NB: The code here is not pretty and could use some love.
However there's many more pressing things to do, so perhaps
this can be revisited later need be (as we agreed during the
neutron-lib meeting [3]).

This patch adds a python and bash script to our tools that can be
run during tox/gate to generate python public API reports as
discussed during out neutron lib meeting [2][3]. The idea is that
this tool can be run to generate a public API report that we can
use to release note our neutron-lib releases [3].

There are 2 main approaches for extracting an API from python
source; (a) loading the source an using inspect based modules
to reflect the API and (b) reading the source without loading
it and parsing API signatures from raw source text. In addition
a hybrid approach can be taken with uses a combination of

This script uses preprocessing and inspection to permit python
source to be loaded (without its dependencies) and inspected.
The inspected source's public signatures are collected and
stored in a JSON format that defines the public API for the
inspected source. JSON API reports can also be compared to
determine what public APIs have changed, added, removed or
stayed the same.

The high level approach for generating an API is as follows:
- Copy the source directory tree to a temp staging location.
- Replace all imports in the staging source with mock imports
so that modules can be loaded without dependencies.
- Walk the source, dynamically loading modules and inspecting
them.
- Build a representation of the inspection including public
signatures. This include public functions, methods, and
variables. Only simple/scalar variable (module or class attrs)
values are tracked at present.
- Format the representation into a JSON format that can
be saved to a file and later used for comparison.

For a sample of the current output, see [1].

This patch also adds a standalone tox target called 'api-report'
that can be used to generate a new API report against the
current change. Note that tox target explicitly specifies the
neutron-lib version to do the api diff against and thus will need
updating per neutron-lib release.

[1] http://paste.openstack.org/show/526626/
[2] http://goo.gl/9Xpi4K
[3] http://goo.gl/LlAjX7

Change-Id: If31ae832f86ff146bd8fb53b6d4a5aa9b8217f72
2016-08-12 06:35:18 -06:00
Gary Kotton cf874bf560 Migration report: validate that bc is installed
Without this the tool reports:

gkotton@ubuntu:~/neutron-lib$ ./tools/migration_report.sh ../vmware-nsx/
You have 2517 total imports
You imported Neutron 477 times
You imported Neutron-Lib 108 times
./tools/migration_report.sh: line 30: bc: command not found
./tools/migration_report.sh: line 31: bc: command not found
./tools/migration_report.sh: line 33: [: : integer expression expected

Closes-bug: #1604438

Change-Id: Ib8236ae214d423c993d9e22035f70af1821af944
2016-07-19 07:21:45 -07:00
Armando Migliaccio 9dc6770fe2 Add tool to track migration to neutron-lib
Add a tool that tracks how far off a subproject is from breaking
the dependency from neutron.

Something fun to help us ease the pain. An example output is like
the one below:

You have 229 total imports
You imported Neutron 78 times
You imported Neutron-Lib 10 times
You need to get to 100%, you are this far: 11.3600%, get on with it!

Change-Id: I1a1d89a2628587e95e339524e5593191a27fe5bf
2016-07-13 17:40:25 -07:00