Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mypy + pytest global config + small fixes. #259

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo_usage/cuboids_to_bboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def main(args: Any):
logger.info(args)

if args.log_ids is None:
logger.error(f"Please provide a comma seperated list of log ids")
raise ValueError(f"Please provide a comma seperated list of log ids")
logger.error("Please provide a comma seperated list of log ids")
raise ValueError("Please provide a comma seperated list of log ids")
benjaminrwilson marked this conversation as resolved.
Show resolved Hide resolved

main(args)
6 changes: 3 additions & 3 deletions demo_usage/visualize_30hz_benchmark_data_on_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def render_bev_labels_mpl(
city_to_egovehicle_se3: Transformation from egovehicle frame to city frame
avm: ArgoverseMap instance
"""
if axis is not "city_axis":
if axis != "city_axis":
benjaminrwilson marked this conversation as resolved.
Show resolved Hide resolved
# rendering instead in the egovehicle reference frame
for da_idx, local_da in enumerate(local_das):
local_da = city_to_egovehicle_se3.inverse_transform_point_cloud(local_da)
Expand All @@ -262,7 +262,7 @@ def render_bev_labels_mpl(
draw_lane_polygons(ax, local_lane_polygons)
draw_lane_polygons(ax, local_das, color="tab:pink")

if axis is not "city_axis":
if axis != "city_axis":
benjaminrwilson marked this conversation as resolved.
Show resolved Hide resolved
lidar_pts = rotate_polygon_about_pt(lidar_pts, city_to_egovehicle_se3.rotation, np.zeros((3,)))
draw_point_cloud_bev(ax, lidar_pts)

Expand All @@ -283,7 +283,7 @@ def render_bev_labels_mpl(
bbox_ego_frame = rotate_polygon_about_pt(
bbox_ego_frame, city_to_egovehicle_se3.rotation, np.zeros((3,))
)
if axis is "city_axis":
if axis == "city_axis":
benjaminrwilson marked this conversation as resolved.
Show resolved Hide resolved
plot_bbox_2D(ax, bbox_city_fr, color)
if self.plot_lane_tangent_arrows:
bbox_center = np.mean(bbox_city_fr, axis=0)
Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[tool.black]
line-length = 120

Comment on lines +1 to +3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorted alphabetically.

[tool.isort]
known_first_party = "argoverse"
known_third_party = "mayavi,pytest,colour,descartes,imageio,matplotlib,motmetrics,numpy,cv2,pandas,pillow,imageio,pyntcloud,scipy,shapely,sklearn"
Expand All @@ -6,5 +9,9 @@ line_length = 120
multi_line_output = 3
profile = "black"

[tool.black]
line-length = 120
[tool.mypy]
ignore_missing_imports = true
strict = true
Comment on lines +12 to +14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy settings are supported in pyproject.toml now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a specific version of mypy that we need to enforce, to be able to use this functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


[tool.pytest.ini_options]
addopts = "--cov argoverse --cov-append --cov-branch --cov-report=term-missing"
Comment on lines +16 to +17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add pytest settings into pyproject.toml.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ deps =
flake8-string-format

commands =
pytest tests --cov argoverse --cov-append --cov-branch --cov-report=term-missing
flake8 --max-line-length 120 --ignore E203,E704,E711,E722,E741,W291,W293,W391,W503,F821,F401,F811,F841,P101,G004,G002,I201,I100,I101 --enable-extensions G argoverse
mypy --ignore-missing --strict argoverse
pytest tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have we verified that these options get picked up from the pyproject.toml file in practice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these can be verified by looking at the tox run in our Github workflow. I'll verify once again after we've settled on the other changes.

flake8 argoverse
mypy argoverse

depends =
py3{7,8}: clean
Expand Down