distutils

Execute a Python script post install using distutils / setuptools

Execute a Python script post install using distutils / setuptools Question: 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 execute a …

Total answers: 2

What is the correct way to share package version with setup.py and the package?

What is the correct way to share package version with setup.py and the package? Question: With distutils, setuptools, etc. a package version is specified in setup.py: # file: setup.py … setup( name=’foobar’, version=’1.0.0′, # other attributes ) I would like to be able to access the same version number from within the package: >>> import …

Total answers: 9

Using Cython To Link Python To A Shared Library

Using Cython To Link Python To A Shared Library Question: I am trying to integrate a third party library written in C with my python application using Cython. I have all of the python code written for a test. I am having trouble finding an example for setting this up. I have a pyd/pyx file …

Total answers: 1

How to tell distutils to use gcc?

How to tell distutils to use gcc? Question: I want to wrap a test project containing C++ and OpenMP code with Cython, and build it with distutils via a setup.py file. The content of my file looks like this: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext …

Total answers: 6

How to make setup.py install multiple top-level packages?

How to make setup.py install multiple top-level packages? Question: I have a python package that I would like to organize like so: root/ setup.py package1/ __init__.py package2/ __init__.py package3/ __init__.py I would like setup.py to install package1, package2, and package3 into the correct site-packages/ directory as top level packages, so that I could execute import …

Total answers: 2

How to include third party Python packages in Sublime Text 2 plugins

How to include third party Python packages in Sublime Text 2 plugins Question: I’m writing a sublime text 2 plugin that uses a module SEAPI.py which in itself imports the requests module. Since sublime text 2 uses it’s own embedded python interpreter, it doesn’t see the requests module installed in my ubuntu machine (I get …

Total answers: 2

MANIFEST.in, package_data, and data_files clarification?

MANIFEST.in, package_data, and data_files clarification? Question: I am trying to create a Python package, and I have a directory structure like this: mypkg/ ├── __init__.py ├── module1 │   ├── x.py │   ├── y.py │   └── z.txt └── module2 ├── a.py └── b.py Then I added all the files in MANIFEST.in and when I check the …

Total answers: 2

make distutils in Python automatically find packages

make distutils in Python automatically find packages Question: When describing a python package in setup.py in distutils in Python, is there a way to make it so automatically get every directory that has a __init__.py in it and include that as a subpackage? ie if the structure is: mypackage/__init__.py mypackage/a/__init__.py mypackage/b/__init__.py I want to avoid …

Total answers: 4

How to copy directory recursively in python and overwrite all?

How to copy directory recursively in python and overwrite all? Question: I’m trying to copy /home/myUser/dir1/ and all its contents (and their contents, etc.) to /home/myuser/dir2/ in python. Furthermore, I want the copy to overwrite everything in dir2/. It looks like distutils.dir_util.copy_tree might be the right tool for the job, but not sure if there’s …

Total answers: 6

pip ignores dependency_links in setup.py

pip ignores dependency_links in setup.py Question: I have dependency_links in my setup.py: … dependency_links = [‘http://github.com/robot-republic/python-s3/tarball/master.tar.gz#egg=python-s3′], … But it doesn’t work. However install_requires works fine. Maybe there are another method to set up git repo as required for setup.py? Asked By: syabro || Source Answers: This answer should help. In a nutshell, you need to …

Total answers: 6