Questions tagged [setuptools]

setuptools is a set of enhancements to Python's distutils which simplify building, distribution and installation of Python packages.

setuptools is a (largely) drop-in replacement for distutils first published in 2004. Its most notable addition over the unmodified distutils tools was the ability to declare dependencies on other packages. It is currently recommended as a more regularly updated alternative to distutils that offers consistent support for more recent packaging standards across a wide range of Python versions.

The recommended pip installer runs all setup.py scripts with setuptools, even if the script itself only imports distutils.
This text is Copyright © 2001-2021 Python Software Foundation; All Rights Reserved.


Tag usage

  • Questions about setuptools-specific features should be tagged .
  • If a question is only about functionality common to both distutils and setuptools, the tag can be used in advance.
  • If it's unclear that the question author is using setuptools, the tag should be used instead.

Other related tags:

Modern alternatives to setuptools

Resources

3420 questions
42
votes
4 answers

pip install test dependencies for tox from setup.py

I made my project with setuptools and I want to test it with tox. I listed dependencies in a variable and added to setup() parameter (tests_require and extras_require). My project needs to install all of the dependencies listed in tests_require to…
item4
  • 785
  • 1
  • 7
  • 11
42
votes
8 answers

PyCharm does not recognize modules installed in development mode

I have two pure python projects in PyCharm 3.4.1 Professional Edition. The first one, let's call it p (like package), is structured as a setuptools package (i.e. with setup.py, all requirements etc., however it is not uploaded to pypi or any other…
zegkljan
  • 8,051
  • 5
  • 34
  • 49
40
votes
2 answers

How to solve pkg_resources.VersionConflict error during bin/python bootstrap.py -d

I am tring to create a new plone environment using python plone-devstart.py tool. I got a bootstrap error. So i used a command bin/python bootstrap.py -d from my project directory. It(bin/python bootstrap.py -d command) worked fine before But now i…
Python Team
  • 1,143
  • 4
  • 21
  • 50
39
votes
2 answers

Is there a best practice to make a package PEP-561 compliant?

I'm writing a Python project which is published as a package to a pypi-like repository (using setuptools and twine). I use type hints in my code. The issue is, when importing the package from a different project and running mypy, I get the following…
Tsah Weiss
  • 563
  • 1
  • 6
  • 12
39
votes
1 answer

How do I use data in package_data from source code?

In setup.py, I have specified package_data like this: packages=['hermes'], package_dir={'hermes': 'hermes'}, package_data={'hermes': ['templates/*.tpl']}, And my directory structure is roughly hermes/ | | docs/ | ... | hermes/ | |…
Scott
  • 10,407
  • 13
  • 37
  • 35
37
votes
2 answers

Is `setup.cfg` deprecated?

It's not completely clear to me, what is the status of setup.cfg. I am looking for solutions for my other question about PEP 508 environment markers, and I became totally confused. To me it seems that setup.cfg is an improvement over setup.py,…
toriningen
  • 7,196
  • 3
  • 46
  • 68
37
votes
2 answers

Python Namespace Packages in Python3

The topic of namespace packages seems a bit confusing for the uninitiated, and it doesn't help that prior versions of Python have implemented it in a few different ways or that a lot of the Q&A on StackOverflow are dated. I am looking for a…
Bobby
  • 1,439
  • 2
  • 16
  • 30
37
votes
4 answers

Distribute a Python package with a compiled dynamic shared library

How do I package a Python module together with a precompiled .so library? Specifically, how do I write setup.py so that when I do this in Python >>> import top_secret_wrapper It can easily find top_secret.so without having to set…
Kit
  • 30,365
  • 39
  • 105
  • 149
36
votes
2 answers

Python setup.py: How to get find_packages() to identify packages in subdirectories

I'm trying to create a setup.py file where find_packages() recursively finds packages. In this example, foo, bar, and baz are all modules that I want to be installed and available on the python path. For example, I want to be able to do import foo,…
Joe J
  • 9,985
  • 16
  • 68
  • 100
36
votes
2 answers

setuptools: adding additional files outside package

I have a python application that has a fixed layout which I cannot change. I would like to wrap it up using setuptools, e.g. write a setup.py script. Using the official documentation, I was able to write a first template. However, the application in…
carsten
  • 1,315
  • 2
  • 13
  • 27
36
votes
2 answers

Execute a Python script post install using distutils / setuptools

Note: distutils is deprecated and the accepted answer has been updated to use setuptools I'm trying to add a post-install task to Python distutils as described in How to extend distutils with a simple post install script?. The task is supposed to…
kynan
  • 13,235
  • 6
  • 79
  • 81
36
votes
3 answers

Import error on installed package using setup.py

I have a problem with using setup.py to setup a python package. First, I have the following directory setup: maindir |- setup.py |-mymodule |- __init__.py |- mainmodule.py |-subdir |- __init__.py …
Alex
  • 41,580
  • 88
  • 260
  • 469
34
votes
2 answers

How can I add post-install scripts to easy_install / setuptools / distutils?

I would like to be able to add a hook to my setup.py that will be run post-install (either when easy_install'ing or when doing python setup.py install). In my project, PySmell, I have some support files for Vim and Emacs. When a user installs…
orestis
  • 16,305
  • 4
  • 25
  • 25
34
votes
3 answers

How can I install packages hosted in a private PyPI using setup.py?

I'm trying to write the setup.py install file for a private project, which has both public and private dependencies. The public ones are hosted on PyPI, whereas the private ones are hosted on a server running simplepypi. I would like both public and…
Balthazar Rouberol
  • 6,822
  • 2
  • 35
  • 41
34
votes
5 answers

How to obtain arguments passed to setup.py from pip with '--install-option'?

I am using pip 1.4.1, attempting to install a package from a local path, for example: pip install /path/to/my/local/package This does what I want, which is more or less the equivalent of running python /path/to/my/local/package/setup.py install,…
djangodude
  • 5,362
  • 3
  • 27
  • 39