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

Skip installing the package when type linting #313

Closed
wants to merge 1 commit into from

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Jun 29, 2024

Mypy is configured to scan the source directory, not the installed package. Therefore, this PR configures tox to skip package installation.

On my machine, this change reduces the mypy tox run from 2.79 seconds to 0.25 seconds.

@kurtmckee kurtmckee force-pushed the skip-install-for-mypy branch from 0ec5729 to c4e5e29 Compare July 1, 2024 14:40
@kurtmckee
Copy link
Contributor Author

Rebased on main

@miketheman
Copy link
Member

This appears to be failing as the runtime dependency nh3 is not being installed, and it contains the type hints that mypy is looking for.
Is there another way to tell tox to install the package deps without installing the package itself?

@kurtmckee
Copy link
Contributor Author

Fascinating. Installing the package allows the dependencies to be available for mypy. On my machine, the cached mypy tox environment wasn't recreated when making this change, so the dependencies were still available and didn't trigger an error. Now that it's running in a clean environment in CI, the test is failing.

I'm closing this, as it's currently necessary to install the package to get the package dependencies that mypy wants to also have installed.

@kurtmckee kurtmckee closed this Jul 1, 2024
@kurtmckee kurtmckee deleted the skip-install-for-mypy branch July 1, 2024 14:51
@kurtmckee
Copy link
Contributor Author

@miketheman We were typing at the same time. 😄

I don't know of a way to get the dependencies in a supported -- and non-duplicative -- way from within tox.

Tox supports deps, and nh3 et al could be added there manually, but that adds a risk of administrative burden to maintain dependencies in pyproject.toml and tox.ini.

The environment setup times will be less costly if #308 merges.

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.

2 participants