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
29
votes
5 answers

Force compiler when running python setup.py install

Is there a way to explicitly force the compiler for building Cython extensions when running python setup.py install? Where setup.py is of the form: import os.path import numpy as np from setuptools import setup, find_packages, Extension from…
rth
  • 10,680
  • 7
  • 53
  • 77
28
votes
1 answer

What is "where" argument for in setuptools.find_packages?

working on a python project, I tried to separate source code and unit tests; here is the project structure: MyProject/ MANIFEST.in README.md setup.py source/ __init.py__ my_project/ __init.py__ …
Géraud
  • 1,923
  • 3
  • 20
  • 20
28
votes
2 answers

Python: Why do some packages get installed as eggs and some as "egg folders"?

I maintain a few Python packages. I have a very similar setup.py file for each of them. However, when doing setup.py install, one of my packages gets installed as an egg, while the others get installed as "egg folders", i.e. folders with an…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
28
votes
3 answers

How can I make setuptools (or distribute) install a package from the local file system

Is it possible to specify (editable) source dependencies in setup.py that are known to reside on the local file system? Consider the following directory structure, all of which lives in a single VCS repository: projects utils setup.py ... …
millerdev
  • 10,011
  • 2
  • 31
  • 27
27
votes
6 answers

Specifying package data in pyproject.toml

I use setuptools. In setup.cfg, I can define [options.package_data] myModule = '*.csv' to make sure that data will be installed for my users. Can I achive the same with pyproject.toml instead?
LudvigH
  • 3,662
  • 5
  • 31
  • 49
27
votes
1 answer

Is there complete documentation for `setup.cfg`?

The Python Packaging Tutorial recommends that "Static metadata (setup.cfg) should be preferred. Dynamic metadata (setup.py) should be used only as an escape hatch when absolutely necessary. setup.py used to be required, but can be omitted with newer…
intuited
  • 23,174
  • 7
  • 66
  • 88
26
votes
5 answers

setuptools troubles -- excluding packages, including data files

I'm fairly new to setuptools. I've seen a few similar questions and it drives a little bit insane that I've seemed to follow advice I saw but setuptools still does something different than what I want. Here is the structure of my…
0x4B1D
  • 923
  • 1
  • 9
  • 19
26
votes
4 answers

How do I write a setup.py for a twistd/twisted plugin that works with setuptools, distribute, etc?

The Twisted Plugin System is the preferred way to write extensible twisted applications. However, due to the way the plugin system is structured (plugins go into a twisted/plugins directory which should not be a Python package), writing a proper…
Sidnei
  • 531
  • 4
  • 8
26
votes
5 answers

How to force a python wheel to be platform specific when building it?

I am working on a python2 package in which the setup.py contains some custom install commands. These commands actually build some Rust code and output some .dylib files that are moved into the python package. An important point is that the Rust code…
Adrien Ball
  • 440
  • 1
  • 4
  • 14
26
votes
1 answer

how to cleanly uninstall my python packages with pip3 or any other way?

this is my setup.py file for installing my python program, after the installation using python3 setup.py install an entry to my program was created named testmain , when i did pip3 freeze it showed abc==0.1 in its output ,so i uninstalled it using…
Rajdeep Sharma
  • 463
  • 1
  • 5
  • 9
26
votes
2 answers

Why doesn't setuptools 1.3.1 appear when I pip freeze?

I am running virtualenvwrapper and friends on Ubuntu 12.04 (virtualenvwrapper 1.7.1.2, virtualenv 1.7.1.2, pip 1.0, Distribute 0.6.24, Python 2.7). To be able to pip install matplotlib I need a newer version of Distribute/setuptools, so I do the…
lofidevops
  • 15,528
  • 14
  • 79
  • 119
26
votes
3 answers

Can you set conditional dependencies for Python 2 and 3 in setuptools?

When releasing a Python egg with support for both Python 2 and 3, can you specify dependencies that change depending on which version you're using? For example, if you use dnspython for Python 2, there is a Python 3 version that is called…
Michael Herold
  • 1,292
  • 1
  • 13
  • 22
26
votes
1 answer

Change default dist folder with setuptools

I'm using setuptools 0.6 to package my code. By default when I type python setup.py sdist, the tool creates a folder dist directly in the same folder of my script. What I can do to change this default folder? Edit: Another question is, if my setup…
nam
  • 3,542
  • 9
  • 46
  • 68
26
votes
4 answers

add data files to python projects setup.py

I have a project like this: ├── CHANGES.txt ├── LICENSE ├── MANIFEST.in ... ├── docs │   └── index.rst ├── negar │   ├── Negar.py │   ├── Virastar.py │   ├── Virastar.pyc │   ├── __init__.py │   ├── data │   │   ├── __init__.py │   │   └──…
Shahin
  • 1,415
  • 4
  • 22
  • 33
26
votes
2 answers

How can I make setuptools install a package from another source that's also available on pypi with the same version number?

It's a similar question to How can I make setuptools install a package that's not on PyPI? but not the same. As I would like to use the forked version of some package, setuptools ignore the dependency link (as it has the same version number). Is…
roberkules
  • 6,557
  • 2
  • 44
  • 52