setup.py

Packaging a Python library with an executable

拜拜、爱过 提交于 2019-12-10 13:25:27
问题 I just finished a module and want to package it. I've read the documentation and this question packaging a python application but I am not sure about how to proceed when I don't have a package to import but a script to launch instead. The project looks like that: Project/ |-- README |-- requirement.txt |-- driver.py |-- run.py |-- module_1 | |-- __init__.py | |-- class_1.py | |-- class_2.py |-- module 2 |-- |-- __init__.py |-- |-- class_1.py |-- |-- class_2.py In order to launch the tool I do

Distutils appharently fails with a (working) SWIG extension

隐身守侯 提交于 2019-12-10 03:54:02
问题 I am wrapping via SWIG a C library in a python module, here called "myExample". If I compile: $swig -python myExample.i $gcc -c myExample_wrap.c -I /usr/lib/python2.7 -fPIC -std=c99 $ld -shared myExample_wrap.so -llapacke -o _myExample.so I obtain a full working module (liblapacke is necessary for some functions I used). Now I'd like to make this module installable via "pip install". According to the distutils section (https://docs.python.org/2.7/distutils/setupscript.html), I wrote my setup

Install new regex module with setup.py

折月煮酒 提交于 2019-12-09 20:29:57
问题 I'm trying to install the new Regex module The readme.txt says::: To build and install regex for your default Python run python setup.py install To install regex for a specific version run setup.py with that interpreter, e.g. python3.1 setup.py install I type in python setup.py install and get back /Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory I'm looking for the answer but people

Providing a custom command class to setup.py in a separately installed package

纵饮孤独 提交于 2019-12-09 04:12:28
I am trying to create a python package that implements a custom command class for setuptools.setup() for use in other, unrelated packages' setup.py scripts. Ideally, I would like to be able to include this package in the setup_requires argument to setup() , and have the custom command class take effect before the remainder of the setup activities are performed. Does setup() provide a hook of some sort to support this use case? If not, how can I minimize the amount of boilerplate that has to appear in the setup.py script when using my package while still guaranteeing that my package will be

export vars for python setup.py install --prefix

两盒软妹~` 提交于 2019-12-09 02:27:30
When I install a python package with prefix python setup.py install --prefix=$HOME/opt In ~/.bashrc , I modify the PATH environment var. export PATH=$HOME/opt:$PATH Are there any other environment variables that I need to modify? You may need to modify PYTHONPATH. Use virtualenv for this. Virtualenv creates a directory which acts as a "little unix". You can activate and deactivate this environment as you like, and keep multiple environments for different purposes. Activating the environment will take care of all the environment variables. http://pypi.python.org/pypi/virtualenv virtualenv mynix

Why does `setup.py develop` not work?

强颜欢笑 提交于 2019-12-08 18:38:07
问题 I would like to install my Python module in development mode. As I have seen in many examples python setup.py develop is supposed to do that. But the develop command does not exist for my setup.py file: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext import os src = ["_NetworKit.pyx"] # list of source files modules = [Extension("_NetworKit", src, language = "c++", extra_compile_args=["-fopenmp

How to run py.test and linters in `python setup.py test`

纵饮孤独 提交于 2019-12-08 17:41:39
问题 I have a project with a setup.py file. I use pytest as the testing framework and I also run various linters on my code ( pep8 , pylint , pydocstyle , pyflakes , etc). I use tox to run these in several Python versions, as well as build documentation using Sphinx . I would like to run my test suites as well as the linters on my source code with the python setup.py test task. If I acheive this, I will then just use python setup.py test as the command for running tests in my tox.ini file. So my

export vars for python setup.py install --prefix

白昼怎懂夜的黑 提交于 2019-12-08 06:33:53
问题 When I install a python package with prefix python setup.py install --prefix=$HOME/opt In ~/.bashrc , I modify the PATH environment var. export PATH=$HOME/opt:$PATH Are there any other environment variables that I need to modify? 回答1: You may need to modify PYTHONPATH. 回答2: Use virtualenv for this. Virtualenv creates a directory which acts as a "little unix". You can activate and deactivate this environment as you like, and keep multiple environments for different purposes. Activating the

Passing command line arguments to pip install

岁酱吖の 提交于 2019-12-08 06:05:24
问题 I'm currently working on a Python project that is importing a Fortran module. The setup.py looks similar to that from numpy.distutils.core import Extension from numpy.distutils.core import setup ext = Extension( name = "fortran_module", sources = ["fortran_module.f90"], extra_f90_compile_args = ["-some -compile -arguments"] ) setup( ..., ..., ..., ext_modules = [ext], ..., ..., ... ) I'm currently installing it with pip install -e . , which works fine. But sometimes I need to change the extra

Having trouble with setup.py

青春壹個敷衍的年華 提交于 2019-12-08 05:02:48
问题 I've been using python for a while but I can't remember how I used to install modules, I haven't needed to in forever. I recently reinstalled ubuntu so now I need to. Firstly, I try to run setup.py and get this: nicholas@nicholas-K53E:~$ python setup.py install python: can't open file 'setup.py': [Errno 2] No such file or directory I tried using synaptic to install BeautifulSoup but it didn't work either and python tells me there's no modules named that. Some forums said that it had to do