2

So I've been working on a project. I've reached the stage where everything works.

The only thing that's left for me to do is to deploy/distribute the project so I'll be able to install / run it on my own machines with minimal effort. Since this project is for personal use only, I wasn't planning on distributing it and putting on on PyPi.

So what is the best distribution scheme given this?

Is it to install using distutils and setup.py?

My original plan was to pull the entire project from my git repository on to the host machine and automatically install the dependencies (Which I understood can be done using Pip and a requirement file). Does this make more sense?

I'd appreciate some guidance since I've never done this before.

pjs
  • 18,696
  • 4
  • 27
  • 56
matanc1
  • 6,525
  • 6
  • 37
  • 57
  • 1
    I think it depends if you're distributing it only to technical users, or to machines you have control over. Equally, it depends if you want your users to access your source code (sounds like you're happy with that tho?). GibHub and Pip sound like your best bet, and they're not that hard to set up. If you're using a Windows environment, you might be interested in http://www.py2exe.org/ – Tom Dalton Aug 28 '14 at 21:53
  • Like I said, the project is personal which means that no one but myself will probably use it. It's currently up on github. Like I said before, I was planning on downloading the repo and installing dependencies. Is that what you meant to do? – matanc1 Aug 28 '14 at 21:55
  • 1
    Ok, I understand now. It's really up to you. distutils is quite easy to learn but if you only need to install this on 2-3 machines it's probably not worth doing compared with just cloning from github. But if you're interested in learning to use it (it sounds like you are), then it's worth making the effort! – Tom Dalton Aug 28 '14 at 21:57
  • How do I handle dependencies if i don't go with setup.py? Is it like I said with pip and a requirement file? – matanc1 Aug 28 '14 at 22:10
  • Yep that would probably be the easiest way if you know the target machines have an internet connection and pip installed. – Tom Dalton Aug 28 '14 at 22:11
  • if this is for *nix than that is certainly good ... if you are looking at windows go with something like pyinstaller or py2exe – Joran Beasley Aug 28 '14 at 22:11
  • @TomDalton - Correct me if I'm wrong, but it would seem that setuptools can't install the dependencies unless you specify a link. However if the package has been put on PyPi pip will read the `install_requires` field from `setup.py` and install the packages automatically. Anyways, if that's the case wouldn't it make more sense using a `requirements` file and pip? Since that way I only depend on the package names and not download links like in the setup.py case? – matanc1 Aug 28 '14 at 22:46
  • https://pythonhosted.org/setuptools/setuptools.html#declaring-dependencies suggests that you can declare dependencies (that are on on Pypi) without providing a link... – Tom Dalton Aug 28 '14 at 22:49
  • BTW, if your project is on GitHub, then providing a link so we can see what you're doing would help a lot! – Tom Dalton Aug 28 '14 at 22:50
  • @TomDalton - So from what I'm reading it makes no sense to use pip requirement files. Might as well learn how to package python program since the requirement files don't have any real advantage over setup.py And here is the project: https://github.com/matanc1/smarthome – matanc1 Aug 28 '14 at 22:52
  • It totally depends on what you're doing. For development, the requirement files can be useful and you can create a set of differnet requirement files e.g. "production", "test", "development", all of them pulling in a base requirements file. You can then do something like this: http://stackoverflow.com/questions/14399534/how-can-i-reference-requirements-txt-for-the-install-requires-kwarg-in-setuptool/16624700#16624700 Then you get the best of both worlds - requirements that can be installed via pip directly, and also as part of the package installation. – Tom Dalton Aug 28 '14 at 22:57

0 Answers0