Skip to content

Enforce mypy on all Core bandersnatch #546

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

Merged
merged 2 commits into from
Jun 1, 2020
Merged

Conversation

cooperlees
Copy link
Contributor

  • Set Python 3.6
  • Turn on a lot more mypy checks + warnings
  • Exclude all plugins for now and focus on main code base

More work to get closer to finally close #15

- Set Python 3.6
- Turn on a lot more mypy checks + warnings
- Exclude all plugins for now and focus on main code base
@cooperlees cooperlees added enhancement New feature or request 4.1 labels May 31, 2020
Copy link
Contributor Author

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

Asking for some pro's to case their 👀 on some code for me 🤩

Comment on lines +51 to +53
with importlib.resources.path( # type: ignore
"bandersnatch", "default.conf"
) as config_path:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SanketDG - Any ideas why this error occurs? I haven't dug into it ... Maybe because in 3.6 we use the pulled in dependency?

I might move 4.1 to be >= 3.7.0 since Docker containers make moving to newer python so much easier these days ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, the library does not seem to have type hints
https://gitlab.com/python-devs/importlib_metadata/-/issues/10

@@ -97,7 +97,7 @@ def rewrite(
self.delete_file(filepath_tmp)

@contextlib.contextmanager
def update_safe(self, filename: str, **kw: Any) -> Generator[IO, None, None]:
def update_safe(self, filename: PATH_TYPES, **kw: Any) -> Generator[IO, None, None]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@techalchemy - This should be legit - my quick looks seems both can be handled or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dan ok'd in IRC. Merging :D

@cooperlees cooperlees changed the title Enforce More Mypy on Core bandersnatch Enforce mypy on all Core bandersnatch May 31, 2020
@cooperlees cooperlees merged commit 1393dbc into master Jun 1, 2020
@cooperlees cooperlees deleted the mypy_core_code_stricter branch June 1, 2020 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PEP484 type annotate all of bandersnatch
2 participants