Usage¶
To use neutron-lib in a project:
import neutron_lib
Hacking Checks¶
The neutron_lib.hacking package implements a number of public
hacking checks intended to help
adopters validate their compliance with the latest hacking standards.
To adopt neutron-lib’s hacking checks:
Update your project’s
tox.inito useneutron_lib.hacking.checks.factoryfor itslocal-check-factory.For example in your
tox.ini:[hacking] local-check-factory = neutron_lib.hacking.checks.factory
If your project needs to register additional project specific hacking checks, you can define your own factory function that calls neutron-lib’s
factoryfunction.For example in your project’s python source:
def my_factory(register): # register neutron-lib checks neutron_lib_checks.factory(register) # register project specific checks register(my_project_check)
And use your project’s own factory in
tox.ini:[hacking] local-check-factory = myproject.mypkg.my_factory
Update your project’s
tox.inienable any flake8 extensions neutron-lib’stox.inidoes. These are hacking checks otherwise disabled by default that neutron-lib expects to run.For example in neutron-lib’s
tox.ini:[flake8] # H904: Delay string interpolations at logging calls enable-extensions=H904
In the example above, adopters should also add
H904to theenable-extensionsin theirtox.ini.Actively adopt neutron-lib hacking checks by running and monitoring the neutron-lib periodic job (as per stadium guidelines and watching for announcements. Announcements regarding neutron-lib adopter hacking checks will be communicated via openstack-dev email list and neutron meetings.
Under certain circumstances, adopters may need to ignore specific neutron-lib hacking checks temporarily. This can be done using the
ignoreproperty in the[flake8]section of yourtox.ini. For example, to ignore the hacking checkN536your tox.ini might have:[flake8] # temporarily ignore N536 while fixing failing checks ignore = N536