setuptools

Installing data files into site-packages with setup.py

喜你入骨 提交于 2019-12-21 03:39:05
问题 I have a Python package with a standard setup.py installer but I cannot for the life of me get it to install some pre-defined configuration files into site-packages somewhere... my setup() function is called like this: setup( name='Hydrant', version=version, description=long_description, author='Scott Frazer', author_email='scott.d.frazer@gmail.com', packages=['hydrant'], package_data={'hydrant': ['sql/*.sql', 'hydrant.conf', 'hydrant.deploy']}, data_files=[('config', ['hydrant/hydrant.conf']

add data files to python projects setup.py

ε祈祈猫儿з 提交于 2019-12-21 03:35:50
问题 I have a project like this: ├── CHANGES.txt ├── LICENSE ├── MANIFEST.in ... ├── docs │ └── index.rst ├── negar │ ├── Negar.py │ ├── Virastar.py │ ├── Virastar.pyc │ ├── __init__.py │ ├── data │ │ ├── __init__.py │ │ └── untouchable.dat │ ├── gui.py │ ├── gui.pyc │ ├── i18n │ │ ├── fa_IR.qm │ │ └── fa_IR.ts │ └── negar.pro ├── setup.py ... and inside that my file Virastar.py need some data from data.untouchable.dat . it works fine until I install the project with this setup.py : setup( ...

Why doesn't setuptools 1.3.1 appear when I pip freeze?

妖精的绣舞 提交于 2019-12-21 03:35:15
问题 I am running virtualenvwrapper and friends on Ubuntu 12.04 (virtualenvwrapper 1.7.1.2, virtualenv 1.7.1.2, pip 1.0, Distribute 0.6.24, Python 2.7). To be able to pip install matplotlib I need a newer version of Distribute/setuptools, so I do the following: $ mkvirtualenv new_venv $ pip install matplotlib # fails $ easy_install -U distribute # installs Distribute 0.7.3 in the venv, # which then installs setuptools 1.3.1 $ pip install matplotlib # works However, when I run pip freeze I get:

Does it make sense to install my Python unit tests in site-packages?

孤街浪徒 提交于 2019-12-20 19:40:24
问题 I'm developing my first Python distribution package. My learning curve on Python packaging seems to be leveling off a bit, but I'm still wrestling with a few open questions. One is whether I should cause my unit tests to be installed alongside my code. I understand it's important to include tests in a source distribution. What I'm wondering is whether I should actually configure them to be installed? I've seen at least one popular package that appears to do this on purpose (PyHamcrest), and

How to compile C++ dependencies during pip install?

馋奶兔 提交于 2019-12-20 14:13:08
问题 I want to make my python code pip-able. However, my code depends on another library which isn't pip-able. So, somehow I need to compile the source code when a user calls pip install . How can I do that? I haven't been able to find a good reference via simple Google searches. 回答1: I would recommend taking a look at how llvmlite solves this problem. The idea is to use custom cmdclass s in setup.py that calls your other build system. In llvmlite, they call out to CMake, for example. See: https:/

The way to make namespace packages in Python

主宰稳场 提交于 2019-12-20 10:33:55
问题 From Namespace Packages in distribute, I know I can make use of namespace packages to separate a big Python package into several smaller ones. It is really awesome. The document also mentions: Note, by the way, that your project’s source tree must include the namespace packages’ __init__.py files (and the __init__.py of any parent packages), in a normal Python package layout. These __init__ .py files must contain the line: __import__('pkg_resources').declare_namespace(__name__) This code

How to write setup.py to include a git repo as a dependency

我的未来我决定 提交于 2019-12-20 09:56:06
问题 I am trying to write setup.py for my package. My package needs to specify a dependency on another git repo. This is what I have so far: from setuptools import setup, find_packages setup( name='abc', packages=find_packages(), url='https://github.abc.com/abc/myabc', description='This is a description for abc', long_description=open('README.md').read(), install_requires=[ "requests==2.7.0", "SomePrivateLib>=0.1.0", ], dependency_links = [ "git+git://github.abc.com/abc/SomePrivateLib.git#egg

Automatic version number both in setup.py (setuptools) AND source code?

♀尐吖头ヾ 提交于 2019-12-20 09:15:31
问题 SITUATION: I have a python library, which is controlled by git, and bundled with distutils/setuptools. And I want to automatically generate version number based on git tags, both for setup.py sdist and alike commands, and for the library itself. For the first task I can use git describe or alike solutions (see How can I get the version defined in setup.py (setuptools) in my package?). And when, for example, I am in a tag '0.1' and call for 'setup.py sdist', I get 'mylib-0.1.tar.gz'; or 'mylib

Unable to install MySQL-python

女生的网名这么多〃 提交于 2019-12-20 09:02:00
问题 Okay I recently upgraded from Ubuntu 10.04 to 12.04 Only to be faced by a lot of problems. I am a newbie at this so you might have to tell me in a little more detail or step-by-step I had a django project that was working perfectly but now it gives me this error : File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 16, in <module> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading

How do setuptools, distribute, and pip relate to one another?

可紊 提交于 2019-12-20 08:28:16
问题 I've been teaching myself Python through the book "Learn Python The Hard Way" (2nd Edition). In exercise 46 it told me to read up on Pip, Distribute, and a few other packages. The documentation for pip was clear enough. It allows me to install/uninstall, and upgrade packages. Reading the documentation for distribute, it basically seems to do the same thing: Easily download, build, install, upgrade, and uninstall Python packages What's the difference between pip and distribute, and how do they