-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
upgrade mypy to latest #4486
upgrade mypy to latest #4486
Conversation
Hmm. Looks like it's failing here, but not locally. I thought both configs were pulling from |
I got the failure locally too. You might need to remove the .tox mypy directory, run 'make dev' and then run 'make mypy'. |
0cb0595
to
8c97019
Compare
Since this PR mypy has released v0.930. We should use that instead when we come back to this PR. |
We use "namespace packages" for our adapter directories (no init.py files), so we need to use the --namespace-packages flag. And possibly specify directories, I'm a little fuzzy on that. The init.py files are no longer required as of Python 3.3, but mypy doesn't support the lack of them all that well. More information: The adapters will not work with an init.py file in the dbt/adapters directory, because that makes dbt.adapters a package and prevents the adapters from being installed in dbt.adapters.postgres, etc. |
@nathaniel-may can we close this PR out since we merged Ian's? |
closing in favor of #5171 |
Description
This PR Is stuck. I don't know what the path forward is.
From our version to this version we gain:
TypeGuard
from 3.10 (and typing extensions) which can be used to replace some uses ofisinstance
for type narrowingtype()
not justisinstance
--exclude
flag for specifying modulesThe two big issues with getting this to work:
Fix for 1: add empty
__init__.py
files to the following directories:Fix for 2: remove the
__init__.py
files from the following directories:This means we have one of two things breaking at any given time. Either mypy fails because we it detects an error with the way we've named our modules because it's not traversing them all, or tests fail to import the postgres adapter from
dbt.adapters.postgres
. With 1 fixed, and 2 failing,dbt run
still works after install, so it's likely tests are failing because of test setup when the only change that has been made is adding init files to the context and deps packages.The reason the import mechanism is unknown is because the postgres adapter lives in the plugin directory. When you run
pip install dbt-postgres
, it installs dbt-core, then finds the postgres adapter in the plugins directory and copies those modules to the pathdbt/core/adapters/postgres
so they can be imported likefrom dbt.adapters.postgres import PostgresAdapter
. When you manually inspect the virtual environment after doing a freshpip install -r dev-requirements.txt -r editable-requirements.txt
, which is what both the makefile and tox are doing, the adapter modules have not been moved to that location yet the tests still run and import the adapter just fine.If we cannot find a path forward to make both mypy and unit tests pass, we may have to abandon this upgrade.
Checklist
CHANGELOG.md
and added information about my change