-
Notifications
You must be signed in to change notification settings - Fork 249
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
base: master
Are you sure you want to change the base?
Conversation
[tool.mypy] | ||
ignore_missing_imports = true | ||
strict = true |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use mypy
anywhere other than: https://github.com/argoai/argoverse-api/blob/ceaee0f0e09281fc36f58900388a0d00fd6841f9/tox.ini?
[tool.pytest.ini_options] | ||
addopts = "--cov argoverse --cov-append --cov-branch --cov-report=term-missing" |
There was a problem hiding this comment.
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
.
argoverse/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
VERSION = "1.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used in setup.cfg
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use __version__
.
[tool.black] | ||
line-length = 120 | ||
|
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
pytest tests | ||
flake8 argoverse | ||
mypy argoverse | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM
Thanks for the PR, Ben. Could you add to the PR description a few more details about the advantages of making this change? |
Could you add the version numbers as well, also? Do we need a specific version of |
setup.cfg
Outdated
version = attr: argoverse.VERSION | ||
|
||
[options] | ||
zip_safe = False |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Which version numbers are you referring to?
|
There was a problem hiding this 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.
No description provided.