Questions tagged [distutils]

Distutils is the standard packaging system for Python modules and applications.

Distutils is the standard packaging system for Python modules and applications.

It has many high and low level features used to build, distribute and install Python projects. The official documentation page provides a good overview of its capabilities.

1123 questions
15
votes
5 answers

How can I get my setup.py to use a relative path to my files?

I'm trying to build a Python distribution with distutils. Unfortunately, my directory structure looks like this: /code /mypackage __init__.py file1.py file2.py /subpackage __init__.py /build …
Chris B.
  • 85,731
  • 25
  • 98
  • 139
15
votes
3 answers

What parts of a virtualenv need to be changed to relocate it?

So, I've got a Python program with a ridiculous number of addons/packages. I'd like to be able to distribute the program in its virtualenv, so that the packages come bundled. However, the program is for Windows, and the "relocatable" feature of…
jmite
  • 8,171
  • 6
  • 40
  • 81
15
votes
4 answers

Package only binary compiled .so files of a python library compiled with Cython

I have a package named mypack which inside has a module mymod.py, and the __init__.py. For some reason that is not in debate, I need to package this module compiled (nor .py or .pyc files are allowed). That is, the __init__.py is the only source…
eguaio
  • 3,754
  • 1
  • 24
  • 38
15
votes
6 answers

How to create, upload and install a package for PyPI?

I wrote a little module and I would like to know what are the basic steps to package it in order to upload it to PyPI: What is the file hierarchy? How should I name files? Should I use distutils to create PKG-INFO? Where should I include my…
Mermoz
  • 14,898
  • 17
  • 60
  • 85
15
votes
2 answers

Python packages installation in Windows

I recently began learning Python, and I am a bit confused about how packages are distributed and installed. I understand that the official way of installing packages is distutils: you download the source tarball, unpack it, and run: python setup.py…
Amro
  • 123,847
  • 25
  • 243
  • 454
15
votes
1 answer

Getting the `python setup.py test` syntax to work?

How do I get python setup.py test to work? - Current output: $ python setup.py test # also tried: `python setup.py tests` /usr/lib/python2.7/distutils/dist.py:267: \ UserWarning: Unknown distribution option:…
A T
  • 13,008
  • 21
  • 97
  • 158
15
votes
2 answers

Python module won't install

This is my setup.py file #!/usr/bin/env python from setuptools import setup from sys import path setup(name= 'conundrum', version= '0.1.0', author= 'elssar', author_email= 'elssar@altrawcode.com', py_modules= ['conundrum'], …
elssar
  • 5,651
  • 7
  • 46
  • 71
15
votes
4 answers

Testing Python C libraries - get build path

When using setuptools/distutils to build C libraries in Python $ python setup.py build the *.so/*.pyd files are placed in build/lib.win32-2.7 (or equivalent). I'd like to test these files in my test suite, but I'd rather not hard code the…
danodonovan
  • 19,636
  • 10
  • 70
  • 78
14
votes
3 answers

Determining the location of distutils data files programmatically in Python

I'm trying to include data files in distutils for my package and then refer to them using relative paths (following http://docs.python.org/distutils/setupscript.html#distutils-additional-files) My dir structure is: myproject/ mycode.py data/ …
user248237
14
votes
1 answer

2 techniques for including files in a Python distribution: which is better?

I'm working on packaging a small Python project as a zip or egg file so that it can be distributed. I've come across 2 ways to include the project's config files, both of which seem to produce identical results. Method 1: Include this code in…
froadie
  • 79,995
  • 75
  • 166
  • 235
14
votes
2 answers

Current state of python namespace packages

I would like to have several python sub modules inside a main module, but I want to distribute them as separated python packages. So package A should provide 'my_data.source_a', package B should provide 'my_data.source_b', ... and so on. I found out…
Achim
  • 15,415
  • 15
  • 80
  • 144
14
votes
1 answer

Unable to import distutils.dir_util on Windows

I'm trying to using distutils.dir_util on Windows 7 64bit. As far as I can glean from various googling, I may need to install some distutils package separately? I do have the base distutils package available, however it seems to be very stripped…
DanH
  • 5,498
  • 4
  • 49
  • 72
14
votes
4 answers

Python command line program: generate man page from existing documentation and include in the distribution

Following an (hopefully) common practice, I have a Python package that includes several modules and an executable script in a separate scripts directory, as can be seen here. The documentation for the script, apart from the auto-generated help given…
steko
  • 484
  • 5
  • 14
13
votes
2 answers

Multiple projects using multiple setup.py scripts?

I have a project from which I would like to generate two separate python packages. I want to install these packages using pip. In answers to this previous question, the general recommendation was to write two setup.py scripts: Multiple projects from…
13
votes
1 answer

How to pass flags to a distutils extension?

I'm trying to install a Python module that contains C modules. The C code relies on a library being available in the system's global install locations (/usr/include, /usr/lib), but in my case I only have a local installation of this lib available.…
BjoernD
  • 4,720
  • 27
  • 32