开发者

Buildout: Including another Python project via mercurial?

开发者 https://www.devze.com 2022-12-18 02:57 出处:网络
I have a project called Foo/ that has buildout.cfg and setup.py. Now there is another project called Bar/ .. which too has buildout.cfg and setup.py. Since Bar/ depends on various Python modules, it h

I have a project called Foo/ that has buildout.cfg and setup.py. Now there is another project called Bar/ .. which too has buildout.cfg and setup.py. Since Bar/ depends on various Python modules, it has install_requires=['lxml', 'SQLAlchemy'] in its setup.py. Foo/ depends on Bar/.

But Bar/ does not have a release yet. How do I include Bar/ in Foo's buildout so that I can import Bar's modules, lxml and SQLAlchemy?

Assume that Bar/ is using mercurial as its revision control system.

My attempt: Buildout mercurial recipe does not do much. It only clones the repository, but does not automatically get the eggs for install_req开发者_JAVA百科uires in Bar/setup.py and add Bar/ itself to sys.path.

Actual example: Here's what my buildout.cfg looks like (Bar == mercurialrecipe package):

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

...

This does not work because sys.path does not contain the path to locally cloned mercurialrecipe (in parts/mr), and the dependencies (from parts/mr/setup.py) are not installed.


The only way I found to go around this issue is by adding extra-paths to buildout :

[buildout]
parts = ... pyrtm ...
develop = . parts/pyrtm
eggs = pyrtm

extra-paths = parts/pyrtm/src
# or wherever your pyrtm folder 
# could as well be extra-paths = pyrtm/ 
# if you your code is on same path as buildout.cfg.

[pyrtm]
recipe = mercurialrecipe
repository = http://bitbucket.org/srid/pyrtm

Hope this helps.


If you can check out/clone the repository, then you can develop the python module as usual:

[buildout]
...
develop = src/Bar
eggs = Bar


You're using mercurial recipe to make a mercurial checkout of the mercurial recipe that you want to use as a development egg.... There's a huge circular dependency in there.

Buildout needs the mercurial recipe to run the "mr" part. So it grabs the recipe from pypi. It doesn't yet know that the recipe will actually download the recipe.

0

精彩评论

暂无评论...
验证码 换一张
取 消