setuptools

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

本秂侑毒 提交于 2019-12-02 19:38:31
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 sconsconfig.py setup.py: from setuptools import setup, find_packages setup(name='sconsconfig', version='0.1',

Import error on installed package using setup.py

前提是你 提交于 2019-12-02 18:57:36
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.py contains: import os from setuptools import setup setup( name = "mytestmodule", version = "0.0.1",

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

送分小仙女□ 提交于 2019-12-02 17:54:30
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-0.1-3-abcd.tar.gz' if I altered the code after tagging. This is fine. THE PROBLEM IS: The problem

Unable to install MySQL-python

吃可爱长大的小学妹 提交于 2019-12-02 17:42: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 MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory or in

Setuptools “development” Requirements

会有一股神秘感。 提交于 2019-12-02 17:16:10
TL;DR : Is there a way to hook setuptool's 'develop' to install a set of development requirements when running python setup.py develop ? I'm building my first python package using setuptools. I'm specifying the requirements as: requirements = [ 'click', 'ansible', 'fabric', 'gitpython', 'pyyaml', 'jinja2', 'yapsy' ] test_requirements = [ 'pytest', 'pytest-pep8', 'pytest-cov', ] setup( ... install_requires=requirements, tests_require=test_requirements, ... ) During development, I've been installing the package (in a virtual environment) with: python setup.py develop and uninstalling with:

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

若如初见. 提交于 2019-12-02 17:15:44
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 relate to one another? Ned Deily [ 2014-10 TL;DR: distribute is dead, use pip , the new setuptools ,

Python Daemon Packaging Best Practices

人走茶凉 提交于 2019-12-02 16:47:38
I have a tool which I have written in python and generally should be run as a daemon. What are the best practices for packaging this tool for distribution, particularly how should settings files and the daemon executable/script be handled? Relatedly are there any common tools for setting up the daemon for running on boot as appropriate for the given platform (i.e. init scripts on linux, services on windows, launchd on os x)? To answer one part of your question, there are no tools I know of that will do daemon setup portably even across Linux systems let alone Windows or Mac OS X. Most Linux

Python package structure, setup.py for running unit tests

▼魔方 西西 提交于 2019-12-02 16:29:54
I'm not sure I'm organizing my package structure correctly or am using the right options in setup.py because I'm getting errors when I try to run unit tests. I have a structure like this: /project /bin /src /pkgname __init__.py module1.py module2.py /tests __init__.py test1.py test2.py My setup.py looks like this: #!/usr/bin/env python from setuptools import setup, find_packages setup(version='0.1', description='Trend following library', author='Nate Reed', author_email='nate@natereed.com', packages=find_packages(), install_requires=['numpy'], test_suite="tests", ) When I run 'python setup.py

Packaging legacy Fortran in Python. Is it OK to use setuptools and numpy.distutils?

落花浮王杯 提交于 2019-12-02 16:06:38
I am trying to make a python package distribution for some popular Fortran codes in my field. I want it to use the most standard approach with a setup.py file. The related qustion was helpful for learning how to wrap Fortran extensions . When using this approach, I noticed some confusing behavior when mixing setuptools and numpy.distutils . Is it bad practice to mix the two? As of 2015, it seems preferable to use setuptools as much as possible. However, I would like to build Fortran extensions in a way that is compatible with numpy. So I would like to import from numpy.distutils to get

Jython easy_install error

我们两清 提交于 2019-12-02 15:01:30
问题 My purpose to add some python libraries to jython i.e suds package To do this tried to follow the instruction from http://www.jython.org/jythonbook/en/1.0/appendixA.html#setuptools and also checked; How can I install various Python libraries in Jython? Installed Jython 2.5.2 and added JYTHON_HOME=C:\jyhon252 to environment variables and %JYTHON_HOME%\bin to path jython is working fine. As second step tried to install easy_install on top of Jython 2.5.2 got ez_setup.py from; http://peak