Why does “python setup.py sdist” create unwanted “PROJECT-egg.info” in project root directory?

This directory is created intentionally as part of the build process for a source distribution. A little gander at the developer guide for setuptools gives you a hint as to why: But, be sure to ignore any part of the distutils documentation that deals with MANIFEST or how it’s generated from MANIFEST.in; setuptools shields you … Read more

Managing resources in a Python project

You may want to use pkg_resources library that comes with setuptools. For example, I’ve made up a quick little package “proj” to illustrate the resource organization scheme I’d use: proj/setup.py proj/proj/__init__.py proj/proj/code.py proj/proj/resources/__init__.py proj/proj/resources/images/__init__.py proj/proj/resources/images/pic1.png proj/proj/resources/images/pic2.png Notice how I keep all resources in a separate subpackage. “code.py” shows how pkg_resources is used to refer to … Read more

Enforcing python version in setup.py

The current best practice (as of this writing in March 2018) is to add a python_requires argument directly to the setup() call in setup.py: from setuptools import setup […] setup(name=”my_package_name”, python_requires=”>3.5.2″, […] Note that this requires setuptools>=24.2.0 and pip>=9.0.0; see the documentation for more information.

How may I override the compiler (GCC) flags that setup.py uses by default?

Prepend CFLAGS=”-O0″ before you run setup.py: % CFLAGS=”-O0″ python ./setup.py The -O0 will be appended to CFLAGS while compiling, therefore will override previous -O2 setting. Another way is add -O0 to extra_compile_args in setup.py: moduleA = Extension(‘moduleA’, ….., include_dirs = [‘/usr/include’, ‘/usr/local/include’], extra_compile_args = [“-O0”], ) If you want to remove all default flags, use: … Read more

stopping setup.py from installing as egg

Solution 1: I feel like I’m missing something subtle or important (encountering this page years after the question was asked and not finding a satisfying answer) however the following works fine for me: python setup.py install –single-version-externally-managed –root=/ Compressed *.egg files are an invention of setuptools (I’m not a big fan of them although I … Read more

What is the advantage of setting zip_safe to True when packaging a Python project?

Zip files take up less space on disk, which also means they’re more quickly read from disk. Since most things are I/O bound, the overhead in decompressing the packaging may be less than the overhead in reading a larger file from disk. Moreover, it’s likely that a single, small-ish zip file is stored sequentially on … Read more

pip ignores dependency_links in setup.py

This answer should help. In a nutshell, you need to specify the version (or “dev”) for the #egg=python-s3 so it looks like #egg=python-s3-1.0.0. Updates based on @Cerin’s comment: Pip 1.5.x has a flag to enable dependency-links processing: –process-dependency-links. I haven’t tested it because I agree with the point below. This discussion seems to indicate that … Read more

Latest ‘pip’ fails with “requires setuptools >= 0.8 for dist-info”

This worked for me: sudo pip install setuptools –no-use-wheel –upgrade Note it’s usage of sudo UPDATE On Windows you just need to execute pip install setuptools –no-use-wheel –upgrade as an administrator. In Unix/Linux, the sudo command is for elevating permissions. UPDATE 2 This appears to have been fixed in 1.5.1.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)