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

Conversation

benjaminrwilson
Copy link
Contributor

@benjaminrwilson benjaminrwilson commented Jul 23, 2021

No description provided.

Comment on lines +12 to +14
[tool.mypy]
ignore_missing_imports = true
strict = true
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.

Comment on lines +16 to +17
[tool.pytest.ini_options]
addopts = "--cov argoverse --cov-append --cov-branch --cov-report=term-missing"
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.

@@ -0,0 +1 @@
VERSION = "1.1.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used in setup.cfg.

Copy link
Contributor

Choose a reason for hiding this comment

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

is the version required to be placed here? This probably wouldnt be a place I would look for the version number, so do we need to write it in 2 places now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the first method listed here: https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-package-version. Although, they use __version__ instead of VERSION.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use __version__.

Comment on lines +1 to +3
[tool.black]
line-length = 120

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.

setup.cfg Outdated
@@ -1,2 +1,59 @@
[metadata]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Static declaration of metadata previously listed in setup.py.

tox.ini Outdated
Comment on lines 16 to 19
pytest tests
flake8 argoverse
mypy argoverse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These flags reside in either setup.cfg or pyproject.toml now.

Copy link

@wqi wqi left a comment

Choose a reason for hiding this comment

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

Changes LGTM

@johnwlambert
Copy link
Contributor

Thanks for the PR, Ben. Could you add to the PR description a few more details about the advantages of making this change?

@johnwlambert
Copy link
Contributor

Could you add the version numbers as well, also? Do we need a specific version of setuptools now to install this? And for any python version?

setup.cfg Outdated
version = attr: argoverse.VERSION

[options]
zip_safe = False
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we want zip_safe = False?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just a default option listed here: https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html?highlight=zip_safe. I don't have a strong opinion on it. setuptools will automatically try to determine the setting if we remove it, which might be useful.

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.

@benjaminrwilson
Copy link
Contributor Author

benjaminrwilson commented Jul 28, 2021

@johnwlambert

Could you add the version numbers as well, also?

Which version numbers are you referring to?

Do we need a specific version of setuptools now to install this? And for any python version?

New in 30.3.0 (8 Dec 2016).

https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#configuring-setup-using-setup-cfg-files

Copy link
Contributor

@tagarwal-argoai tagarwal-argoai left a comment

Choose a reason for hiding this comment

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

I took a look at the PR and it looks good overall. I am not an expert with setup.cfg but I trust your and John’s review on this and you could proceed with landing this.

@benjaminrwilson benjaminrwilson changed the title Migrate to setup.cfg. Add mypy + pytest global config + small fixes. Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants