buildinspace / peru

a generic package manager, for including other people's code in your projects
MIT License
1.11k stars 69 forks source link

include peru's dependencies in the repo #88

Open benjamin-bergia opened 9 years ago

benjamin-bergia commented 9 years ago

Is there a way to directly include Peru in a repository? Kind of like Rebar. This way after cloning the repository, peru is directly available without having to install it through pip.

oconnor663 commented 9 years ago

Yes, you could check in the peru repo as a subdirectory of your project. The peru.py script at the root of the repo should work to run peru from there, though it expects peru's dependencies to be available (see setup.py, but mainly Docopt and PyYAML). You could check those in too, and then use a wrapper script of your own that puts your local copies of them in the PYTHONPATH before invoking peru.py.

That's a little hacky, and unfortunately it won't be super stable if we add more dependencies to future versions of peru, but let me know if you think it might work for you. Previously we had an approach where we would check in copies of our dependencies for peru.py, but that got annoying when we started supporting setup.py too, and we had to update dependencies in two places. If this was a common use case, though, I could see us switching to a model where we check in peru.docopt and peru.yaml and stop using setup.py for dependencies at all. @olson-sean-k what do you think?

oconnor663 commented 9 years ago

I put up a branch to try this out: https://github.com/oconnor663/peru/tree/third_party

oconnor663 commented 9 years ago

I think I like this. setup.py still has our Python 3.3 dependencies (asyncio and pathlib, both provided by default in Python 3.4), so pip install still works there, but in Python 3.4 there are no external dependencies, and running peru.py straight out of the repo works. We also get to have peru be self-bootstrapping again, which makes me smile. (I think the script we had before, which confirmed the contents of third_party matched what was in peru.yaml, was more trouble than it was worth. I don't plan to bring it back.)

benjamin-bergia commented 9 years ago

That exactly what I was looking for :+1: Thanks

oconnor663 commented 9 years ago

@olson-sean-k and I have gone back and forth on this. On the one hand it's a nice capability to have. On the other hand, it makes our dependency management pretty nonstandard for a Python project. On the other other hand, it's would be cool to have peru bootstrap itself. On the other other other hand, if we ever take a dependency on libgit2, it probably won't work to check peru into your repo anymore. Not sure.