setuptools

Cython conditional compilation based on external value given via `setuptools`

浪尽此生 提交于 2019-12-19 04:05:09
问题 I try to conditionally generate C code from a Cython pyx file. I found in the Cython documentation that I can use DEF to define a value and IF to conditionally generate code based on a defined value, but how can I set the value from the setup.py via Extension from setuptools . Thank You 回答1: Thank you for the link. The interesting flag in the setup.py is cython_compile_time_env . And to import the Extension from Cython. from setuptools import setup from Cython.Distutils.extension import

Install two python modules with same name

[亡魂溺海] 提交于 2019-12-18 17:00:50
问题 What's the best way to install two python modules with the same name? I currently depend on two different facebook libraries: pyfacebook and Facebook's new python-sdk. Both of these libraries install themselves as the module 'facebook'. I can think of a bunch of hacky solutions but before I go an hack away I was curious if there was a pythonic way of dealing with this situation. I'm using virtualenv and pip. (Yes, I will eventually deprecate one of them, but I had two different engineers

How to package a Python daemon with setuptools

自古美人都是妖i 提交于 2019-12-18 15:51:54
问题 How do you package a Python app with setuptools so that when it's installed (e.g. via setup.py or pip), it places a daemon script in the appropriate location, starts it, and marks it to automatically start at boot time? In my case, my code only works with Linux, so I only care about installing the daemon in Linux environments (specifically Ubuntu). I've found several posts describing how to easily create Python daemons, but I can't seem to find anything describing how you'd install them in a

Accessing data files before and after distutils/setuptools

 ̄綄美尐妖づ 提交于 2019-12-18 15:29:24
问题 I'm doing a platform independent PyQt application. I intend to use write a setup.py files using setuptools. So far I've managed to detech platform, e.g. load specific options for setup() depending on platform in order to use py2exe on Windows... etc... However, with my application I'm distributing some themes, HTML and images, I need to load these images in the application at runtime. So far they are stored in the themes/ directory of the application. I've been reading documentation on

Change Cython's naming rules for .so files

浪尽此生 提交于 2019-12-18 15:03:34
问题 I'm using Cython to generate a shared object out of Python module. The compilation output is written to build/lib.linux-x86_64-3.5/<Package>/<module>.cpython-35m-x86_64-linux-gnu.so . Is there any option to change the naming rule? I want the file to be named <module>.so without the interpreter version or arch appendix. 回答1: Seems like setuptools provides no option to change or get rid of the suffix completely. The magic happens in distutils/command/build_ext.py : def get_ext_filename(self,

Python “setup.py develop”: is it possible to create “.egg-info” folder not in source code folder?

∥☆過路亽.° 提交于 2019-12-18 13:01:36
问题 Python has ability to "pseudoinstall" a package by running it's setup.py script with develop instead of install . This modifies python environment so package can be imported from it's current location (it's not copied into site-package directory). This allows to develop packages that are used by other packages: source code is modified in place and changes are available to rest of python code via simple import . All works fine except that setup.py develop command creates an .egg-info folder

Python “setup.py develop”: is it possible to create “.egg-info” folder not in source code folder?

余生颓废 提交于 2019-12-18 13:01:08
问题 Python has ability to "pseudoinstall" a package by running it's setup.py script with develop instead of install . This modifies python environment so package can be imported from it's current location (it's not copied into site-package directory). This allows to develop packages that are used by other packages: source code is modified in place and changes are available to rest of python code via simple import . All works fine except that setup.py develop command creates an .egg-info folder

How to easy_install egg plugin and load it without restarting application?

家住魔仙堡 提交于 2019-12-18 12:05:51
问题 I'm creating an app that downloads and installs its own egg plugins, but I have a problem loading the egg after easy_install extracts it into place. This is how it works now: App downloads egg into temp folder Installs egg with setuptools.command.easy_install.main() into ~/.app/plugins folder (which is pointed by a pth on dist-packages) At this point, the ~/.apps/plugins/easy-install.pth is updated with the new egg path The problem is that the pth is not reloaded until the python process is

Unable to use easy_install to install Python modules

旧城冷巷雨未停 提交于 2019-12-18 11:27:05
问题 I am trying to use easy_install to install a module called requests by doing easy_install requests This worked fine a week ago when I was using Python 2.6.5 but today I installed Python 2.7.2 and then tried to import requests in one of my scripts but it failed. I then tried reinstalling requests with easy_install requests but got this error install_dir /usr/local/lib/python2.6/dist-packages/ error: can't create or remove files in install directory The following error occurred while trying to

install_requires based on python version

为君一笑 提交于 2019-12-18 10:33:10
问题 I have a module that works both on python 2 and python 3. In Python<3.2 I would like to install a specific package as a dependency. For Python>=3.2. Something like: install_requires=[ "threadpool >= 1.2.7 if python_version < 3.2.0", ], How can one make that? 回答1: setuptools has support for this using environment markers. install_requires=[ 'enum34;python_version<"3.4"', 'pywin32 >= 1.0;platform_system=="Windows"' ] Use of this is detailed in the official documentation. Based on the change log