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

py.typed missing in package #316

Closed
maximeflya opened this issue May 23, 2024 · 6 comments · Fixed by #319
Closed

py.typed missing in package #316

maximeflya opened this issue May 23, 2024 · 6 comments · Fixed by #319

Comments

@maximeflya
Copy link

I see that schema.py is typed and it would be great to be able to use that information when running mypy. In order for that to happen, there needs to be a py.typed file in the package.

I see that there was an attempt in including it in the package:

package_data={"": ["py.typed"]}, # Include py.typed file

It seems to do nothing though when inspecting the wheel and tar.gz (version 0.7.7): only the schema.py file is stored.

I did not try but it might work if the file structure is changed to something like this:

schema
├── __init__.py <- current content of schema.py
└── py.typed
@skorokithakis
Copy link
Collaborator

Ah, hmm, it might need to be included in the manifest, actually...

@maximeflya
Copy link
Author

That might help indeed. I'm just wondering how pip will install the package because currently it is just

lib/python3.11/site-packages
├─ schema-0.7.7.dist-info
│   ├── INSTALLER
│   └── ...
└─ schema.py

So there is currently no folder for schema like other packages where the py.typed file could be in.

@maximeflya
Copy link
Author

From some quick testing, adding it in the MANIFEST.in adds the py.typed in the tar.gz but not the wheel and it gets discarded when installing it with pip

@skorokithakis
Copy link
Collaborator

Hm, that's odd, I wouldn't have expected that... Unfortunately I'm not an expert in packaging, does including the file both in the package_data key and the manifest work?

@maximeflya
Copy link
Author

maximeflya commented May 24, 2024

I tried and that doesn't work either.
From this discussion I found, my suggestion seems to be the way to go:
python/typing#1333 (comment)

This would involve slightly changing the setup.py to find the package version in schema/__init__.py instead of schema.

@skorokithakis
Copy link
Collaborator

Could you please open a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants