2

I'm developing a small Python package - a bunch of *.py files. It has some dependencies, and I'd like to use virtualenv and buildout to create its own, separated environment for development and I'd like to package it as an Python egg.

What recipe should I use?

Should I put my project into eggs, develop, or parts variable?

Should I keep my code in src, parts or in develop-eggs folder?

And where do I add dependencies then?

I read some tutorials, but they look way too complicated for me - all I need is just a simple example with an explanation.

2
  • Do you need a buildout? For my really simple python packages I don't create one; I just use setup.py test to run my tests and that is it. See this simple package for example. Commented Feb 3, 2013 at 22:46
  • 2
    The answer below by @Skirmantas is correct. A setup.py to make your code available as a package. A develop = . in buildout.cfg to tell buildout to effectively do python setup.py develop on your local package. parts= is only to tell buildout which sections in its config file to execute. eggs= in the [scripts] section/part is how you configure which eggs/packages you want included in the path of the bin/* scripts buildout generates there. Commented Feb 12, 2013 at 13:27

1 Answer 1

3

There might be other ways. This is how I like to structure my packages:

mypackage/
    __init__.py
    mymodule.py

setup.py

    from setuptools import setup

    setup(...
          packages=['mypackage'],
          package_dir={'mypackage': 'mypackage'})

          entry_points="""
              [console_scripts]
              mypackage-script = mypackage.script:main
          """,
  )


buildout.cfg

    [buildout]
    parts =
        scripts
    eggs =
        mypackage
        django
        lxml
        ...

    develop = .

    [scripts]
    recipe = zc.recipe.egg:scripts
    eggs =
        ${buildout:eggs}
    scripts =
        mypackage-script

    interpreter = python
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.