Favor importlib.metadata.packages_distributions() over
importlib_metadata.packages_distributions() where it is available, i.e.,
on Python 3.10 and later.
Depend on PyPI importlib_metadata only on Python 3.9 and older:
conditionalize the requirements.txt entry on Python version.
Change-Id: I624fc0059057de05bb2bacd9c1238cba71ebad2a
'pkg_resources' is slow, while 'importlib.metadata' is the new shiny and
is *much* faster. Recent version of 'importlib.metadata' - namely those
found in Python 3.10 or provided by the 4.4 'importlib-metadata'
backport - now provide the last bit of functionality we were missing to
remove 'pkg_resources' entirely, namely the ability to map package names
to modules. This is used for generating epilogs.
The benefits of this are huge, yielding a near 40% decrease in runtime
for the cliffdemo app (100mS after compared to 160mS) before.
Change-Id: I934d8a196d76622671781643f36bdb8a07d2f319
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
We don't use pbr at runtime; ergo, there is no reason to include this in
requirements.txt.
While we're here, we remove a note that is no longer true with the new
dependency resolver introduced in pip 20.3.
Change-Id: I39ee12f052fff6d69f8fe97949e6e5df7511647b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This was added nearly a decade ago to work around a packaging bug in
cmd2. We don't use this explicitly ourselves so we can and should remove
it. Do that.
Change-Id: Ia6061a22b9037d157c0b2afecb4e06bbc62c2d74
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Using the autopage library we can automatically send the help output to
a pager (less, by default), git-style. The pager is configured to not
reset the terminal on exit, avoiding the problem when piping to less
manually that the help text you want to refer to disappears off the
screen when you go to use it. The pager is only invoked when the output
is to the terminal.
Since we invoke the pager, we can ensure that it is correctly set up to
interpret ANSI escape codes, so it is safe to use colour to make the
output easier to read. The autopage library provides light styling of
the default argparse help output, and some additional colour
highlighting is added here for the command list (which is generated by
cliff, not using argparse's formatting code).
Change-Id: If9e1aa5166da32c58cc0fa617f4f81eaa9b2c470
Depends-On: https://review.opendev.org/c/openstack/requirements/+/799343
PrettyTable was capped at a < 0.8, which meant we were getting the
veritably ancient 0.7.2 release first release in April 2013 (!) [1].
The project is now being maintained as a Jazzband project [2], meaning
we should switch to this new version.
The only significant change required here is that we no longer set the
'min_width' attribute since that actually does something - the wrong
thing - now. We want this attribute to set a lower bound on the wrap
width as opposed to an absolute minimum we can use, which is what
setting the 'min_width' attribute would do.
While we're here, we also remove a now useless bit of Python 2 code and
bump cmd2 to a slightly newer version.
[1] https://pypi.org/project/prettytable/#history
[2] https://github.com/jazzband/prettytable
Change-Id: Iceac729e7a9429e8ab25c60524a48d0aaeebeb37
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/requirements/+/774917
Switch to using stevedore now so that when the cache implementation is
released all cliff applications can take advantage of the performance
benefits.
Change-Id: Ib7bf53091470b55ab87082d315ca283d3600a636
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
cmd2 released a python3 only versions of itself. We need to update
requirements to handle it. This updates requirements to match
requirements. See https://review.openstack.org/570811 for more details.
Change-Id: I3d527ba30205c9f3b3b2e89f795ee5611422c013
Release 0.8.3 of cmd2 failed to properly specify a new dependency so
installing it breaks interactive mode for OSC and other cliff-based
apps. 0.8.4 fixes the issue.
Change-Id: I8bbd749e3328596fd333bd7f58391b9d688c00cf
Depends-On: https://review.openstack.org/560120
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
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.
Update the lower bound for PrettyTable so the unit tests pass.
See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.
Change-Id: Ia146248b505e66adf871d17ae1e4921d7888bb85
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
argparse is not required for Python 2.7 and 3.2+ (which are the only
Python versions explicitely supported in setup.py)
removing the unnecessary argparse dependency to allow package to be
properly packaged on Debian/Ubuntu systems.
Change-Id: I80f8607402ea3ec52f91e68a3b0393ccd684c11b
Only use unicodecsv for python 2, since the python 3 module works fine
with unicode data.
Change-Id: I8b82248e855a6986b7541ca997d8fd56628b17a5
Related-bug: #1491888
This change replaces the cliff-tablib yaml formatter with an internal
replacement. It differs from the tablib formatter in the following ways:
- always outputs with block formatting rather than the PyYAML default
of deciding based on value content
- emit_one serialises a simple dict where the column name is the key
and the data item is the value (rather than a list of dicts with
'Field' and 'Value' keys)
- emit_one preserves column order by printing a single-item dict for
each column_name
The cliff release which contains this change will need a corresponding
cliff-tablib release which removes the yaml formatter from its setup.py
entry_points.
Change-Id: I691dbab3dee7c5ec28b1083f87ab1f5c051d582b
Related-Bug: #1308744
Add pbr to the list of installation requirements so that it is installed
via pip before this library is installed, instead of with easy_install.
This avoids issues like Bug #1384919, and ensures that projects that use
this library as a dependency are properly installed.
Change-Id: I6c155370dbd01fe4748d5137bdf288e8d3e1a67e