setuptools

Setuptools platform specific dependencies

会有一股神秘感。 提交于 2019-12-03 07:37:39
Is there any way to tell setuptools or distribute to require a package on a specific platform? In my specific case, I'm using readline , which comes as part of the standard library on Unix systems, but on Windows I need the pyreadline module to replace that functionality (cf. this question ). If I just put it in the requirements It also installs on Unix systems where it's completely useless. setup.py is simply a python script. You can create dynamic dependencies in that script: import platform setup_requires = ['foo', 'bar'] if platform.system() == 'Windows': setup_requires.append('pyreadline'

Updating pip and setuptools in homebrew does not work

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: After brew install python , the following comes up: Pip and setuptools have been installed. To update them pip2 install --upgrade pip setuptools Running pip2 install pip2 install --upgrade pip setuptools Traceback (most recent call last): File "/usr/local/bin/pip2", line 11, in <module> load_entry_point('pip==9.0.1', 'console_scripts', 'pip2')() File "/Users/user1/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 564, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/Users/user1

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

笑着哭i 提交于 2019-12-03 07:27:10
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 at least one other that appears to do it by accident ( behave ). So my (multi-part) question is this:

Excluding a top-level directory from a setuptools package

て烟熏妆下的殇ゞ 提交于 2019-12-03 06:50:27
问题 I'm trying to put a Python project into a tarball using setuptools. The problem is that setuptools doesn't appear to like the way that the source tree was originally setup (not by me, I must add). Everything that I actually want to distribute is in the top-level directory, rather than in a subdirectory like the setuptools docs talk about. The tree has a directory, tests , that I don't want to have in the released package. However, using exclude_package_data doesn't seem to actually do any

Python any of many dependencies

妖精的绣舞 提交于 2019-12-03 06:47:36
From time to time I come across a situation where I have a package that can depend on either package A or B. For example, my project depends on a package called spam , if this project is renamed to pyspam , my project can either depend on spam or pyspam . I cannot figure out (or find) how I would define such dependencies in setup.py. What is a commonly accepted way to solve this? EDIT: I would like to define the dependencies in setup.py . Something like this: from setuptools import setup setup( name='myproject', install_requires=[ 'spam || pyspam' ] ) You can check to see if the package is

unattended install of binary python packages (modules) for windows

狂风中的少年 提交于 2019-12-03 06:19:34
Is there no sane way to peform a scripted install of binary python packages for windows? Unfortunately it seems like several essential windows python packages like pywin32 and py2exe are only available as EXE's not MSI's (and as far as I know only the latter are scriptable). Easy_install/pip also seems no use since they apparently only find source packages and then try to compile locally which is obviously unsatisfactory. Am I missing something? You can download the source code of pywin32 at sourceforge.net/projects/pywin32/files/ and then build it as MSI file yourself. Therefore you need

Compiling & installing C executable using python's setuptools/setup.py?

非 Y 不嫁゛ 提交于 2019-12-03 06:11:59
I've got a python module that calls an external binary, built from C source. The source for that external executable is part of my python module, distributed as a .tar.gz file. Is there a way of unzipping, then compiling that external executable, and installing it using setuptools/setup.py? What I'd like to achieve is: installing that binary into virtual environments manage compilation/installation of the binary using setup.py install , setup.py build etc. making the binary part of my python module, so that it can be distributed as a wheel without external dependencies Solved in the end by

Easiest way to automatically download required modules in Python?

守給你的承諾、 提交于 2019-12-03 05:44:12
问题 I would like to release a python module I wrote which depends on several packages. What's the easiest way to make it so these packages are programmatically downloaded just in case they are not available on the system that's being run? Most of these modules should be available by easy_install or pip or something like that. I simply want to avoid having the user install each module separately. thanks. 回答1: pip uses requirements files, which have a very straightforward format. For more Python

Import error on installed package using setup.py

我与影子孤独终老i 提交于 2019-12-03 05:38:24
问题 I have a problem with using setup.py to setup a python package. First, I have the following directory setup: maindir |- setup.py |-mymodule |- __init__.py |- mainmodule.py |-subdir |- __init__.py |- submodule.py i.e. the project directory contains the setup.py and a directory mymodule , which in itself contains two python modules in two directories. The file submodule.py contains just teststring = "hello world" mainmodule.py contains: from .subdir import submodule mainstring = "42" and setup

python: simple example for a python egg with a one-file source file?

五迷三道 提交于 2019-12-03 05:12:06
问题 I'm not quite sure how to build a really simple one-file source module. Is there a sample module out there one the web somewhere which can be built as a python .egg? From the setuptools page it looks pretty simple, you just have your setup.py file and then at least one other .py file somewhere, and I can build an .egg file OK, and even install it using easy_install , but I can't seem to import the file from within python. (note: using 2.6.4) here's my sample dir: sconsconfig setup.py