Where practical, I like to have tools required for a build under version control. The ideal is that a fresh checkout will run on any machine with a minimal set of tools required to be installed first.
Is it practical to have Python under version control?
How about python packages? My naive attempt to use Sphinx without installing it fails due to a dependency on Docutils. Is there a way to do use it without installing?
Look at virtualenv and buildout for these needs.
virtualenv
lets you isolate the Python that is running your project from any other packages installed with that version of Python. So if your project needs Python x.y the only pre-requisite is that you need to ensure that there is a copy of that version of Python available on the system. Any packages you install within the virtualenv
are completely isolated from packages installed outside it.
buildout
lets you specify package dependencies, so if you need sphinx
to build your documentation you just include this in your buildout.cfg
file:
parts =
sphinx
[sphinx]
recipe = collective.recipe.sphinxbuilder
and when you run buildout
it will install collective.recipe.sphinxbuilder
, download and install docutils
and sphinx
within the virtualenv
, and build your docs.
Your buildout.cfg
can include all of the dependencies required to get your system running from an initial checkout of the folder containing the buildout.cfg
and a bootstrap.py
file. It makes setting up a system for development or final deployment really easy.
No, just like a compiler the python interpreter should be installed system-wide. The same thing applies to tools such as sphinx and docutils (which is most likely installed when installing sphinx via your distribution's package manager).
The same applies to most python packages, especially those that are used by the application itself and available via PyPi.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With