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

New release (20.2) has a typing issue #290

Closed
sobolevn opened this issue Jan 1, 2021 · 4 comments
Closed

New release (20.2) has a typing issue #290

sobolevn opened this issue Jan 1, 2021 · 4 comments

Comments

@sobolevn
Copy link

sobolevn commented Jan 1, 2021

My CI fails for a new structlog release: https://github.com/wemake-services/wemake-django-template/pull/1418/checks?check_run_id=1632259635#step:7:861

Here's what happens:

mypy manage.py server tests/test_apps/test_main/test_models/test_migrations/test_blog_post_migrations.py tests/test_apps/test_main/test_models/test_blog_post_model.py tests/test_apps/test_main/test_views/test_index_view.py tests/conftest.py tests/test_server/test_urls.py
server/settings/components/logging.py:73: error: Argument "context_class" to "configure" has incompatible type "Type[MutableMapping[str, Any]]"; expected "Union[Type[Dict[str, Any]], Type[Dict[Any, Any]], None]"
Found 1 error in 1 file (checked 28 source files)

Here's the source code which works correctly with 20.1: https://github.com/wemake-services/wemake-django-template/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/server/settings/components/logging.py#L73

P.S. Happy New Year! 🎄

@hynek
Copy link
Owner

hynek commented Jan 2, 2021

Aw crap, does wrap_dict return the wrong type? Gotta expand typing-examples I guess 😒.

Meanwhile, may I recommend stopping to use wrap_dict and look into the new threadlocal primitives that allow to separate what you keep in threadlocal and what not? I think they're highly superior!

@hynek hynek closed this as completed in b9c8aa2 Jan 5, 2021
@hynek
Copy link
Owner

hynek commented Jan 5, 2021

Fixed and used your example as a regression test in the typing example. Happy new year to you too!

@mazzi
Copy link

mazzi commented Jan 5, 2021

When do you plan to release this fix @hynek ?
Thanks a lot! 😄

@hynek
Copy link
Owner

hynek commented Jan 7, 2021

I'm sorry, but that doesn't warrant an emergency release…just add a # type: ignore next to it for now. I want to work on all the stdlib logging meta data (#253, #209 and maybe some more) next once I've finished my current work project. I will release immediately after because it's super vexing to me.

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

No branches or pull requests

3 participants