How to extract dependencies from a PyPi package without downloading it?

As jinghli notes, there isn’t currently a reliable way to get the dependency of an arbitrary PyPi package remotely without needing to download it completely. And in fact the dependencies sometimes depend on your environment, so an approach like Brian’s of executing setup.py code is needed in the general case. The way the Python ecosystem … Read more

Can’t upload to PyPi with Twine

EDIT: if you’re using Windows, check my other suggestion It looks like some sort of error with the account I was using. The following steps fixed it for me: Create a new account Upload the package with the new account with twine upload dist/* Add the previous account (that you originally wanted to upload with) … Read more

What does the `platforms` argument to `setup()` in `setup.py` do?

platforms is an argument the setuptools package inherits from distutils; see the Additional meta-data section in the distutils documentation: Meta-Data: platforms Description: a list of platforms Value: list of strings So, yes, using a list is the correct syntax. The field just provides metadata; what platforms does the package target. Use this to communicate to … Read more

How to find “import name” of any package in Python?

Wheels I know this is an old question, but wheel packages have since been invented! Since a wheel is simply a zip file that gets extracted into the lib/site-packages directory, an examination of the contents of the wheel archive can give you the top level imports. >>> import zipfile >>> zf = zipfile.ZipFile(‘setuptools-35.0.2-py2.py3-none-any.whl’) >>> top_level … Read more