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
2
votes
1 answer

Why isn't my setup.py long description showing on pypi?

Trying to upload a package to pypi and it's all working except my long_description. It's meant to read through my README.rst but it is just blank on pypi. docutils rst2html isn't throwing any errors, setup.py --long-description prints out my readme,…
huwwp
  • 37
  • 1
  • 7
2
votes
0 answers

How to use precompiled headers with python wheels?

I'm writing a python packages which I would like to distribute as a wheel, so it can be easily installed via pip install. As part of the functionality of the package itself I compile C++ code. For that, I distribute with the package some set of…
dcmm88
  • 1,445
  • 1
  • 12
  • 30
2
votes
3 answers

setuptools: force version of another package (if present) while not forcing installation of this package (when not present)

During development of Pylint, we encountered interesting problem related to non-dependency that may break pylint package. Case is following: python-future had a conflicting alias to configparser package. Quoting official docs: This release…
Łukasz Rogalski
  • 22,092
  • 8
  • 59
  • 93
2
votes
0 answers

Python package with distribution specific requirements

I would like to create an rpm package for python with Linux distribution specific requirements. Specifically, I would like to build an rpm which works across Amazon Linux, CentOS 7.x and RHEL 7.x (possibly 6.x for the last two). I am currently using…
Handle
  • 21
  • 1
2
votes
0 answers

How do I access data files with pkg_resources?

My package looks somewhat like this. Package tokenizer,py corpus.py __init__.py resources data.txt I want to access data.txt from corpus.py. How should I do it with pkg_resources? Also do I need to create setup.py for package…
2
votes
1 answer

Setuptools: how to distribute configuration files without erasing existing ones?

I'm trying to find a nice way to ship default configuration files with my python setuptools project. For now I'm doing it like this: from setuptools import setup setup( ... data_files = [('/usr/local/etc', ['files/myproject.conf', ...])] …
John Smith Optional
  • 22,259
  • 12
  • 43
  • 61
2
votes
2 answers

Where does setuptools find the version of a package?

I am trying to understand what version a github package has. I am building it locally. In the release process, I find this: VERSION=$(python setup.py --version) In my repo, whenever I run this I get: » python setup.py --version 1.0.9.dev29 But I…
blueFast
  • 41,341
  • 63
  • 198
  • 344
2
votes
0 answers

python setuptools arguments to develop

I have a custom command called CustomCSS defined in my setup.py file. The command takes two arguments, and does some processing on it. The arguments are defined like: class CustomCSS(BaseCommand): description = "Site level customizations" …
Saurabh Sood
  • 213
  • 1
  • 2
  • 9
2
votes
0 answers

How can I disable binary distributions using setuptools?

I've seen various messages while running pip that say skipping bdist_wheel for X due to binaries being disabled for it I have a package for which I want to disable binaries because there is some dynamic stuff done in setup.py. How can I do this?
xaav
  • 7,876
  • 9
  • 30
  • 47
2
votes
1 answer

Configure setup.py to install requirement from repository URL

I am creating a module and need to prepare my setup.py file to have some requirements. One of the requirements is a fork of one package that is already in PyPI so I want to reference my GitHub repository directly. I tried two configurations, the…
Ícaro
  • 1,432
  • 3
  • 18
  • 36
2
votes
1 answer

Why is `pip3 install numpy` much faster than setting it in `install_requires`?

The following takes place in a Python 3 virtual environment. I just authored a little package that requires numpy. So, in setup.py, I wrote install_requires=['numpy']. I ran python3 setup.py install, and it took something like two minutes -- I got…
Newb
  • 2,810
  • 3
  • 21
  • 35
2
votes
1 answer

Remove compile args in Cython

I want to compile my python project with cython. I created this setup.py file : from setuptools import setup, find_packages from Cython.Build import cythonize recursive_tree = [file for file in glob.iglob("sample/**/*.py", …
Jguillot
  • 214
  • 3
  • 14
2
votes
1 answer

Running setup.py installation - Relative module names not supported

When trying to run develop or install task of setuptools I am getting the Relative module names not supported error. The command run is $ python -m setup.py develop My setup.py script is pretty simple with one entry point: setup( name='foo', …
Martin Melka
  • 7,177
  • 16
  • 79
  • 138
2
votes
1 answer

python easy_install failed because of wrong setuptools version

I tried to a library via easy_install like following: $ sudo easy_install bbfreeze Searching for bbfreeze Reading http://pypi.python.org/simple/bbfreeze/ Reading http://systemexit.de/bbfreeze/ Best match: bbfreeze 0.97.2 Downloading…
Emmettoc
  • 137
  • 2
  • 8
2
votes
1 answer

`python setup.py upload_docs` succeeds but nothing changes online

I am trying to publish documentation on pythonhosted.org using setuptools, but while python setup.py upload_docs succeeds, nothing changes online, and no update of the documentation is reported in my package's journal on PyPI either. Yet, I can…
fchauvel
  • 763
  • 1
  • 6
  • 14