setuptools

How to load package version into __version__ variable if you are using pbr?

天涯浪子 提交于 2019-12-10 16:37:45
问题 In order to simplify python packaging I am trying to migrate to use of pbr. Still, I was not able to figure out how to expose the version of the package into __version__ variable. This is quite important because I do have many users of the package that do rely on the existence of the version variable. People should be able to do: import somemodule print(somemodule.__version__) 回答1: I am not sure if that's the best approach but I was able to spot one other packages that is doing something

How do I make “setup.py bdist_egg” to ignore specific source files?

纵饮孤独 提交于 2019-12-10 16:33:36
问题 I'm trying to build a package for a django application, but excluding all tests modules. I have tried setting exclude = ["*.tests", "*.tests.*", "tests.*", "tests"] on find_packages and defining a MANIFEST.in , but the tests are always compiled and included in the bundle. Any clues? 回答1: I found the combination both adding find_packages rule and writing out MANIFEST.in rules i.e. prune tests Note that for python 3.2 and older you must have __init__.py in tests root, for find_packages command

Python Entry point 'console_scripts' not found

杀马特。学长 韩版系。学妹 提交于 2019-12-10 15:49:59
问题 I'm unable to import entry point console scripts in my python package. Looking for help debugging my current issue, as I have read every relevant post on the issue. Here is what my directory structure looks like: ├── ContentAnalysis │ ├── __init__.py │ ├── command_line.py │ ├── document.py │ ├── entities.py │ ├── sentiment.py │ ├── summary.py │ ├── text_tokenize.py │ ├── tokens.py ├── local-requirements.txt ├── requirements.txt ├── server-requirements.txt ├── setup.py └── tests ├── tests.py └

Including data files with setup.py

假如想象 提交于 2019-12-10 15:27:04
问题 I'm having trouble including data files in my setup.py script. My package is setup as follows: my_package/ setup.py MANIFEST.in my_package/ __init__.py access_data.py data_files/ my_data_file.csv I want to include the my_data_file.csv file when installing so that it can be read by access_data.py . To do so I used the package_data keyword in setuptools : setup(..., packages=['my_package'], package_data={'my_package': ['./my_package/data_files/my_data_file.csv']}, include_package_data=True ) I

Python fails after deleting site.py

五迷三道 提交于 2019-12-10 15:18:39
问题 tl;dr I accidentally deleted my Python installation’s site.py file. Now, when trying to start Python, it complains, ImportError: Couldn't find the real 'site' module I tried downloading a site.py from setuptools but this results in an infinite recursion in the __boot method around the statement imp.load_module('site',stream,path,descr) (line 37). Is there a way to fix this without reinstalling Python? What is the site.py file supposed to do? Some background information: This is on a Linux

What are the use cases for a Python distribution?

回眸只為那壹抹淺笑 提交于 2019-12-10 15:06:53
问题 I'm developing a distribution for the Python package I'm writing so I can post it on PyPI. It's my first time working with distutils, setuptools, distribute, pip, setup.py and all that and I'm struggling a bit with a learning curve that's quite a bit steeper than I anticipated :) I was having a little trouble getting some of my test data files to be included in the tarball by specifying them in the data_files parameter in setup.py until I came across a different post here that pointed me

How to make setuptools clone git dependencies recursively?

半城伤御伤魂 提交于 2019-12-10 14:58:39
问题 I want to let setuptools install Phoenix in my project and thus added setup( ... dependency_links = [ "git+https://github.com/wxWidgets/Phoenix.git#egg=Phoenix" ], install_requires = ["Phoenix"], ... ) to my setup.py , but Phoenix ' setuptools setup depends on a recursive git clone. How to tell the setuptools setup of my project to do git clone --recursive for Phoenix ? Defining a git alias with git config --global alias.clone 'clone --recursive' doesn't change anything. I'm using setuptools

Is it safe to call `setup()` multiple times in a single `setup.py`?

半世苍凉 提交于 2019-12-10 14:35:08
问题 I am developing a package containing Cython extensions. According to https://github.com/pypa/pip/issues/1958 I shall use setup_requires and postpone import of Cython . The best solution I came up with is to call setup() twice in setup.py : ... # initial imports setup(setup_requires=['cython']) from Cython.Build import cythonize bar = Extension('foo.bar', sources = ['bar.pyx']) setup(name = 'foo', ... # parameters ext_modules = cythonize([bar]), ... # more parameters ) However I have a feeling

find_packages doesn't find my Python file

天大地大妈咪最大 提交于 2019-12-10 13:48:44
问题 I have a directory tree like this: dir/ A/ __init__.py something.py I used find_packages on dir/A and expected it to find something.py . However, it returned an empty list. How do I make find_packages find something.py as a package? from setuptools import find_packages packages = find_packages('c:/dir/A') print(packages) 回答1: You'd need to make it a package, it's a module right now. You would do this the same way you made the A package: create a directory with the package name, include an _

How to remove build products

本秂侑毒 提交于 2019-12-10 12:56:43
问题 Is it possible to automatically remove build products that are generated by a setup.py script based on setuptools ? I've just started with a new Python project and it's the first time I'm using setuptools as a developer, so I may be getting something wrong. when I build the project using python setup.py bdist , three directories, build , dist and one ending in .egg-info are created. When I then run python setup.py clean it doesn't seem to be doing anything and just prints this: running clean