conner.xyz
conner.xyz

Reputation: 7295

Is there any reason to list standard library dependencies when using setuptools?

I've gone down the Python packaging and distribution rabbit-hole and am wondering:

Is there ever any reason to provide standard library modules/packages as dependencies to setup() when using setuptools?

And a side note: the only setuptools docs I have found are terrible. Is there anything better?

Thanks

Upvotes: 2

Views: 471

Answers (2)

jwodder
jwodder

Reputation: 57610

No — In fact, you should never specify standard modules as setup() requirements, because those requirements are only for downloading packages from PyPI (or VCS repositories or other package indices). Adding, say, "itertools" to install_requires will mean that your package will fail to install because its dependencies can't be satisfied because there's (currently) no package named "itertools" on PyPI. Some standard modules do share their name with a project on PyPI; in the best case (e.g., argparse), the PyPI project is compatible with the standard module and only exists as a separate project for historical reasons/backwards compatibility. In the worst case... well, use your imagination.

Upvotes: 3

wim
wim

Reputation: 363314

In a word, no. The point of the dependencies is to make sure they are available when someone installs your library. Since standard libraries are always available with a python installation, you do not need to include them.

For a more user-friendly guide to packaging, check out Hynek's guide: Sharing Your Labor of Love: PyPI Quick and Dirty

Upvotes: 5

Related Questions