Add initial mypy job

Change-Id: I6a37421f324c76d30b1044f974066b0db0bb359d
This commit is contained in:
Ihar Hrachyshka 2024-09-18 21:59:03 -04:00
parent 08fff4087d
commit 943d26da20
4 changed files with 122 additions and 1 deletions

85
mypy.ini Normal file
View File

@ -0,0 +1,85 @@
# Config file options: https://mypy.readthedocs.io/en/stable/config_file.html
[mypy]
incremental = True
pretty = True
show_error_context = True
show_column_numbers = True
warn_unused_ignores = True
# remove gradually as progress is made
disable_error_code = import-untyped,var-annotated,import-not-found
# honor excludes by not following there through imports
follow_imports = silent
# NOTE: Gradually enable type checking for each package.
# Finally, when the whole repo is migrated this option can be deleted
# and rules applied to the whole repo.
exclude = (?x)(
^neutron/agent/linux/dhcp.py
| ^neutron/agent/metadata/agent.py$
| ^neutron/agent/metadata/driver.py$
| ^neutron/agent/ovn/extensions/metadata.py$
| ^neutron/agent/ovn/metadata/driver.py$
| ^neutron/agent/ovn/metadata/server.py$
| ^neutron/agent/securitygroups_rpc.py$
| ^neutron/api/rpc/callbacks/version_manager.py$
| ^neutron/db/l3_dvr_db.py$
| ^neutron/db/l3_hamode_db.py$
| ^neutron/db/migration/alembic_migrations/env.py$
| ^neutron/extensions/tagging.py$
| ^neutron/manager.py$
| ^neutron/objects/address_group.py$
| ^neutron/objects/address_scope.py$
| ^neutron/objects/agent.py$
| ^neutron/objects/auto_allocate.py$
| ^neutron/objects/conntrack_helper.py$
| ^neutron/objects/flavor.py$
| ^neutron/objects/floatingip.py$
| ^neutron/objects/ipam.py$
| ^neutron/objects/l3_hamode.py$
| ^neutron/objects/l3agent.py$
| ^neutron/objects/local_ip.py$
| ^neutron/objects/logapi/logging_resource.py$
| ^neutron/objects/metering.py$
| ^neutron/objects/ndp_proxy.py$
| ^neutron/objects/network.py$
| ^neutron/objects/network_segment_range.py$
| ^neutron/objects/plugins/ml2/flatallocation.py$
| ^neutron/objects/plugins/ml2/geneveallocation.py$
| ^neutron/objects/plugins/ml2/greallocation.py$
| ^neutron/objects/plugins/ml2/vlanallocation.py$
| ^neutron/objects/plugins/ml2/vxlanallocation.py$
| ^neutron/objects/port/extensions/allowedaddresspairs.py$
| ^neutron/objects/port/extensions/data_plane_status.py$
| ^neutron/objects/port/extensions/extra_dhcp_opt.py$
| ^neutron/objects/port/extensions/port_device_profile.py$
| ^neutron/objects/port/extensions/port_hardware_offload_type.py$
| ^neutron/objects/port/extensions/port_hints.py$
| ^neutron/objects/port/extensions/port_numa_affinity_policy.py$
| ^neutron/objects/port/extensions/port_security.py$
| ^neutron/objects/port/extensions/port_trusted.py$
| ^neutron/objects/port/extensions/uplink_status_propagation.py$
| ^neutron/objects/port_forwarding.py$
| ^neutron/objects/ports.py$
| ^neutron/objects/provisioning_blocks.py$
| ^neutron/objects/qos/binding.py$
| ^neutron/objects/qos/policy.py$
| ^neutron/objects/qos/rule.py$
| ^neutron/objects/quota.py$
| ^neutron/objects/router.py$
| ^neutron/objects/securitygroup.py$
| ^neutron/objects/securitygroup_default_rules.py$
| ^neutron/objects/servicetype.py$
| ^neutron/objects/subnet.py$
| ^neutron/objects/subnetpool.py$
| ^neutron/objects/tag.py$
| ^neutron/objects/trunk.py$
| ^neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py$
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/commands.py$
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py$
| ^neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovsdb_monitor.py$
| ^neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py$
| ^neutron/tests/$
)

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = docs,py3,pep8 envlist = docs,py3,pep8,mypy
minversion = 3.18.0 minversion = 3.18.0
skipsdist = False skipsdist = False
ignore_basepython_conflict = True ignore_basepython_conflict = True
@ -121,6 +121,12 @@ commands =
stestr run --slowest --concurrency 2 --exclude-regex neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs} stestr run --slowest --concurrency 2 --exclude-regex neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}
stestr run --slowest --combine --concurrency 1 neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs} stestr run --slowest --combine --concurrency 1 neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}
[testenv:mypy]
deps =
{[testenv]deps}
mypy==1.11.2
commands = mypy --config-file ./mypy.ini neutron
[testenv:releasenotes] [testenv:releasenotes]
description = description =
Build release note documentation in HTML format. Build release note documentation in HTML format.

View File

@ -113,6 +113,35 @@
- ^zuul.d/tempest-multinode.yaml - ^zuul.d/tempest-multinode.yaml
- ^zuul.d/tempest-singlenode.yaml - ^zuul.d/tempest-singlenode.yaml
- job:
name: neutron-tox-mypy
parent: openstack-tox
vars:
tox_envlist: mypy
voting: false
irrelevant-files:
- ^\.pylintrc$
- ^releasenotes/.*$
- ^doc/.*$
- ^setup.cfg$
- ^plugin.spec$
- ^tools/ovn_migration/.*$
- ^.*\.conf\.sample$
- ^.*\.rst$
- ^neutron/locale/.*$
- ^vagrant/.*$
- ^devstack/.*$
- ^playbooks/.*$
- ^roles/.*$
- ^rally-jobs/.*$
# Ignore everything except for zuul.d/project.yaml
- ^zuul.d/base.yaml
- ^zuul.d/grenade.yaml
- ^zuul.d/job-templates.yaml
- ^zuul.d/rally.yaml
- ^zuul.d/tempest-multinode.yaml
- ^zuul.d/tempest-singlenode.yaml
- job: - job:
name: neutron-fullstack-with-uwsgi name: neutron-fullstack-with-uwsgi
parent: neutron-fullstack parent: neutron-fullstack

View File

@ -18,6 +18,7 @@
- neutron-skip-level-jobs - neutron-skip-level-jobs
check: check:
jobs: jobs:
- neutron-tox-mypy
- neutron-functional-with-uwsgi - neutron-functional-with-uwsgi
- neutron-fullstack-with-uwsgi - neutron-fullstack-with-uwsgi
- neutron-ovs-grenade-multinode - neutron-ovs-grenade-multinode