Menu
  • HOME
  • TAGS

Referring to existing distutils options inside setup.cfg and setup.py

python,python-2.7,distutils,setup.py

Referring to Variables Inside setup.cfg You can refer to other variables/options inside your setup.cfg file. The syntax is $variable, for instance: [install] prefix = /my/prefix install-scripts = $base/scripts Please note that I used $base since this variable is affected by your prefix settings provided both in the setup.cfg and using...

Does _spawn_posix in distutils always raise an error?

python,distutils,python-os

Aha, OK, the docs say about os.execvp and the other os.exec functions These functions all execute a new program, replacing the current process; they do not return. On Unix, the new executable is loaded into the current process, and will have the same process id as the caller. Errors will...

How to specify C++11 with distutils?

python,c++11,distutils

You can use the extra_compile_args parameter of distutils.core.Extension: ext = Extension('foo', sources=[....], libraries=[....], extra_compile_args=['-std=c++11'], ....) Note that this is completely platform dependent. It won't even work on some older versions of gcc and clang....

Automate Python application installation

python,bash,pip,distutils,easy-install

Maybe deliver fully packed applications ? Have a look at Freeze and py2exe. Also, if you planned on delivering for windows environment, notice that compiling require a lots and is quite annoying, prefer sending libraries pre-compiled with your app. For linux environment, well, it mostly depend of the environment so...

Force `sdist` to create .zip archive even on Linux

python,distutils,sdist

Found it myself from distutils docs here and here, and from distutils sources: # Override sdist to always produce .zip archive from distutils.command.sdist import sdist as _sdist class sdistzip(_sdist): def initialize_options(self): _sdist.initialize_options(self) self.formats = 'zip' setup( ... cmdclass={'sdist': sdistzip}, ) ...

Best practices for imports for installed package

python,import,distutils

The relative import syntax, from .a import blah, is the modern way to do things. See PEP 328, https://www.python.org/dev/peps/pep-0328/ , as to why it's superior to the alternatives. (Though admittedly PEP 8 prefers absolute exports, it also allows within-package relative imports as an acceptable alternative). Personally, BTW, I always ever...

How to install a dependency from a submodule in Python?

python,git-submodules,distutils

Create a package for mysubmodule with its own setup.py and let the top-level package depend on that package in its setup.py. This means you only need to make the packages / dependencies available and run python setup.py install on the top-level package. The question then becomes how to ship the...

how do i control to which python to install a package

python,setuptools,distutils,setup.py,mosek

I believe it is your setup.py options which are causing the error. Specifically the user option will install into a specific directory linked to your user profile https://docs.python.org/2/install/#alternate-installation-the-user-scheme , regardless of what's linked to the WinPython. This is for users who do not have write privileges in system directories. If...

Including logging.conf in setup.py?

python,python-2.7,setuptools,distutils,data-files

Do you want to include logging.conf within your package distribution? Use the package_data argument to setup(): setup( name = "package-name", packages = ["packagename"], package_data= { "packagename": [ "resources/foo.bar", "resources/static/css/*", "README.md", "logging.conf" ]}, ... ) ...

setup.py check if non-python library dependency exists

python,setuptools,distutils,setup.py,cgal

Whether a particular extension module should be compiled depending on the availability of some library version, can be accomplished by dynamically generating the ext_modules argument of setup() in setup.py. For the _yaml.so module of ruamel.yaml, that only should be compiled when the libyaml development libraries have been installed on the...

RPM subpackages from a Python project

python,package,rpm,setuptools,distutils

No, distutils and its derivatives do not support that. You would have two codebases, each with a setup.py script, producing two different sets of sdists/wheels/RPMs. Or you could have one repository with e.g. setup_client.py and setup_server.py scripts (with different package name and list of files to package), but that is...

read README in setup.py

python,setuptools,distutils,setup.py

To manually include files in a distribution do the following: set include_package_data = True Create a MANIFEST.in file that has a list of include <glob> lines for each file you want to include from the project root. You can use recursive-include <dirname> <glob> to include from sub-directories of the project...

Dependencies from git aren't being installed?

python,python-2.7,pip,setuptools,distutils

Looks like the issue was with: package_dir In my setuptool.setup function call. Removing that keyword argument completely resolved my issue. Additionally I put all my requirements in p0's "requirements.txt"....

How can I check for which command is run in setup.py?

python,distutils,setup.py

You can override the command instead: from distutils.command.install import install from distutils.core import setup def run_file(path): with open(path, 'r') as f: exec(f.read()) class myinstall(install): # subclass distutils's install command def finalize_options(self): # called after option parsing # call base class function install.finalize_options(self) # super won't work because distutils under Python...

Automate compilation of protobuf specs into python classes in setup.py

python,protocol-buffers,distutils,distutils2

In a similar situation, I ended up with this code (setup.py, but written in a way to allow extraction into some external Python module for reuse). Note that I took the generate_proto function and several ideas from the setup.py file of the protobuf source distribution. from __future__ import print_function import...

cython build via setup.py does wrong thing (putting all .so files in extra src dir)

python,build,virtualenv,cython,distutils

Whenever I use cython I use the extension command. I would write the setup.py file as follows: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize print "hello build" extensions=[Extensions("helloworld",["helloworld.pyx"])] setup( ext_modules = cythonize(extensions) ) Hopefully this will then put the .so file in the current directory....

How should setup.py and requirements.txt be used by app developers?

python-2.7,distutils

An irrelevant version number which needs to be manually updated. The version number in setup.py is only important if your application / deployment needs it. The 'test' imports aren't relevant to the project ("multiprocessing"). In that case you may need to remove it - it could be outdated code....

Install a CMake macro script from within a python package install script (using setup.py)

python,cmake,setuptools,distutils,setup.py

It took me a while to understand your question. If I understand correctly, what you are trying to do is provide the IodSymbolize.cmake in the standard installation location of cmake so that other users/projects who rely on your software(symbolizer) can use it in their build process. I think you are...

What's the minimal directory structure to make setuptools work with one_file.py?

python,pip,setuptools,distutils

You can get away with this with just a setup.py and your module--no additional directories. In your setup.py just use setup(..., py_modules=['one_file'], ...) (you might want to check on the exact spelling). To install the script you can use the console_scripts entry-point: from setuptools import setup setup( name='one-file', version='1.0', py_modules=['one_file'],...

Installing Python package documentation

python,documentation,distutils

Installing docs is not supported by distutils. These days it seems more important to publish them online than to install them on the target system though, so if you’re set up to use Reat The Docs or upload docs to PyPI, you’re good.

Distributing a Python module with ffmpeg dependency

python,ffmpeg,distutils,software-distribution

For Windows I think it will be easy to find ffmpeg binaries that work on any system, just like for Qt or whatever GUI library you are using. You can ship these binaries with your project and things will work (you may want to distinguish 32 bit and 64 bit...

Why is an egg-info file created when I'm using distutils?

python,setuptools,distutils,virtualenvwrapper

There was discussion about adding setuptools to the stdlib for Python 2.5, and then about adding only pkg_resource (one part of setuptools). Various reasons made that not happen. The core devs recognized that setuptools was an important third-party tool, and accepted a change to make projects installed with a pure-distutils...

What does `python setup.py check` actually do?

python,python-2.7,distutils

First stop, the distutils package documentation: The check command performs some tests on the meta-data of a package. For example, it verifies that all required meta-data are provided as the arguments passed to the setup() function. So it tests if you have filled in your metadata correctly; see it as...

Is it possible to wrap a function from a shared library using F2PY?

python,numpy,distutils,lapack,f2py

I think you just need ctypes, there is a complete example on calling a lapack function on this page: http://www.sagemath.org/doc/numerical_sage/ctypes.html You get your function like this: import ctypes from ctypes.util import find_library lapack = ctypes.cdll.LoadLibrary(find_library("lapack")) dgtsv = lapack.dgtsv_ ...

Python cx_freeze 4.3.4: Setting targetName causes errors

python,python-2.7,distutils,cx-freeze

Reposting as an answer: targetName is the filename of the executable it's going to produce. On Windows, executables must have a .exe extension, so you'll need to set it as 'hello.exe' rather than just 'hello'....

Python generate sdist and upload it in a separate step

python,distutils,sdist

Currently, upload will only push files that are created by a distutils sdist/bdist command run from the same command line than upload, e.g. python setup.py sdist upload. If you run sdist, check the result, and then do sdist upload, the second sdist should be exactly the same, unless your setup.py...

How do I use setuptools or distutils to distribute a script as opposed to a Python package?

python,setuptools,distutils

You should use setuptools entry points and pip install pkg will create a bin/ script for you. When you do a system-wide package installation the script will go to /usr/bin or /usr/local/bin. About entry points...

can't copy 'ANIFEST.in': doesn't exist or not a regular file

pip,setuptools,distutils

With a hint from this thread, I realized that I was making the mistake; I didn't really understand all the options to the setup function in setup.py. I had package_dir={'spherical_functions': ''}, when I should have had package_dir={'spherical_functions': '.'}, (Note the extra dot.) After including this, it seems to work just...

python 3.4 py2exe is not working or doing anything

python,pip,py2exe,distutils

I have found the problem, there is no problem with py2exe but with mycode in mycode I use some images from my computer so when I create the .exe it takes those images from the directory in my computer and runs but when I take the .exe from my computer...

How to add c compiler options to distutils

python,c,distutils

I realized that if you don't modify the C source code then nothing is compiled (the original error I had stayed because of that reason). Using CFLAGS, as I did, actually does fix the problem. After digging around in distutils documentations I found two additional fixes (these only use setup.py...