Bug 2211742 - Bad import in responses 0.21 breaks mypy typechecking for namespace_packages
Summary: Bad import in responses 0.21 breaks mypy typechecking for namespace_packages
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-responses
Version: 37
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Felix Schwarz
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/getsentry/response...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-01 18:34 UTC by Josh Reed
Modified: 2023-06-27 00:35 UTC (History)
4 users (show)

Fixed In Version: python-responses-0.22.0-1.fc37 python-responses-0.22.0-2.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-06-11 01:58:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Josh Reed 2023-06-01 18:34:57 UTC
MyPy Python typechecking has an option to use "namespace packages" which is just Python's way of saying "folders without __init__.py in them." But using this feature breaks when python-responses 0.21 is included (see https://github.com/getsentry/responses/issues/556) in the set of modules to check.

```
/path/to/mypy/typeshed/stdlib/unittest/mock.pyi: error: Source file found twice under different module
names: "unittest.mock" and "mypy.typeshed.stdlib.unittest.mock"
Found 1 error in 1 file (errors prevented further checking)
```

This is fixed in https://github.com/getsentry/responses/releases/tag/0.22.0

Would it be possible to bump the f37 version of responses to 0.22 ?

Reproducible: Always

Steps to Reproduce:
1. sudo dnf -y install python3-{mypy,responses}
2. echo 'import responses; import unittest.mock' > crash.py
3. mypy --namespace-packages crash.py
Actual Results:  
/path/to/mypy/typeshed/stdlib/unittest/mock.pyi: error: Source file found twice under different module
names: "unittest.mock" and "mypy.typeshed.stdlib.unittest.mock"
Found 1 error in 1 file (errors prevented further checking)

Expected Results:  
MyPy found 0 errors

Comment 1 Felix Schwarz 2023-06-01 19:30:10 UTC
> Would it be possible to bump the f37 version of responses to 0.22 ?

Sure, I just did not see the any need so far. From looking at the changelog I think the new version should be mostly compatible with 0.21 we currently ship in F37.

Due to the currently ongoing koji database update (https://www.fedorastatus.org/) I can not build the new version right now but hopefully I remember to do that tomorrow (feel free to ping me if I forgot to update the package).

Comment 2 Fedora Update System 2023-06-02 16:40:24 UTC
FEDORA-2023-edb49f593c has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-edb49f593c

Comment 3 Fedora Update System 2023-06-03 03:19:04 UTC
FEDORA-2023-edb49f593c has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-edb49f593c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-edb49f593c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2023-06-11 01:58:44 UTC
FEDORA-2023-edb49f593c has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Josh Reed 2023-06-13 20:35:18 UTC
Looks like 0.22 had further MyPy errors: https://github.com/getsentry/responses/pull/593

Current changelog seems to suggest no further mypy issues: https://github.com/getsentry/responses/blob/master/CHANGES

I'll pull the package during testing this team to make sure it doesn't break for us if you're interested in bumping again to 0.23

Comment 6 Fedora Update System 2023-06-23 19:43:37 UTC
FEDORA-2023-d1630a36c7 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-d1630a36c7

Comment 7 Felix Schwarz 2023-06-23 19:45:04 UTC
There is another Fedora user who stumbled upon the same bug (https://src.fedoraproject.org/rpms/python-responses/pull-request/9) so I cherry-picked the commit and built 0.22.0-2: https://bodhi.fedoraproject.org/updates/FEDORA-2023-d1630a36c7

This should fix your mypy issue (without introducing potential incompatibilities). Maybe you can try this build to see if it fixes your issues?

Comment 8 Fedora Update System 2023-06-24 01:56:41 UTC
FEDORA-2023-d1630a36c7 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-d1630a36c7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-d1630a36c7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2023-06-27 00:35:12 UTC
FEDORA-2023-d1630a36c7 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.