About managing dependencies in a collaborative development team and good practices.

23 views
Skip to first unread message

Santiago Basulto

unread,
Feb 20, 2012, 9:22:44 PM2/20/12
to Django users
Hello people,

some time ago with a couple of friends started a project with Django.
We are really getting into it now, and have made several progress in
the last 3 months. But, as the code starts to grow up, everything
start to get complicated.

Right now we have our project hosted on Bitbucket, and is simple to
set the enviroment to develop. Just clone the repo, syncdb, run a
script that install some fixtures, and runserver.

But, we started to use some externa apps, and add extra code, and it
started to look like a mess. Furthermore, we are 3 guys coding, it
starts to get complicated to all have the dependencies right.

After taking a look how pinax handle it, it seems a good option to
make use of PIP for the external apps, and create virtual envs.

First question then: Is that good? To use PIP with the external apps?
Will it be easy to deploy it?

Second question: What about our own apps? Should i let them live in
the project root directory? Should i try to pack them as "egg"
packages?

Finally: Do you have any good practice to tell me? Experience is
really needed!!

Thank you all!

PD: I have no much experience with Python, i'm a Java guy, and don't
think you like Maven ;)

Sébastien Billion

unread,
Feb 21, 2012, 8:24:12 AM2/21/12
to django...@googlegroups.com
Hi,

Set a virtualenv is good thing. You can write a shell script which set the virtualenv and install all the external module with pip -r. Use pip -r nameofrequriementsfile.txt. In this file, put the list of module with version.
Exemple:
django==1.3
PIL==1.1.7

If you want distribute your own apps, submit them on Pypi
http://wiki.python.org/moin/CheeseShopTutorial

2012/2/21 Santiago Basulto <santiago...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Tom Evans

unread,
Feb 21, 2012, 8:54:57 AM2/21/12
to django...@googlegroups.com
On Tue, Feb 21, 2012 at 1:24 PM, Sébastien Billion
<sebastie...@gmail.com> wrote:
> Hi,
>
> Set a virtualenv is good thing. You can write a shell script which set the
> virtualenv and install all the external module with pip -r. Use pip -r
> nameofrequriementsfile.txt. In this file, put the list of module with
> version.
> Exemple:
> django==1.3
> PIL==1.1.7
>
> If you want distribute your own apps, submit them on Pypi
> http://wiki.python.org/moin/CheeseShopTutorial
>

A more realistic proposal for proprietary packages is to bundle them
up yourselves. Putting business critical/private code into a public
RCS/distribution hub is not always a good plan.

Any python library with an standard setuptools install.py can be made
into a source package by 'python setup.py sdist'. If you place all the
required packages in a internal web accessible location, you can then
use pip to discover and install packages from there directly, as
though it were PyPi.

Check out the pip flags --index-url, --extra-index-url and
--find-links, which can be inserted into the pip requirements file.

Cheers

Tom

Javier Guerra Giraldez

unread,
Feb 21, 2012, 10:53:06 AM2/21/12
to django...@googlegroups.com
On Tue, Feb 21, 2012 at 8:24 AM, Sébastien Billion
<sebastie...@gmail.com> wrote:
> Set a virtualenv is good thing. You can write a shell script which set the
> virtualenv and install all the external module with pip -r. Use pip -r
> nameofrequriementsfile.txt. In this file, put the list of module with
> version.

i do exactly that. just a tip: to create and maintain the pip
requirements file do:

pip freeze > piprequirementsfile.txt

--
Javier

Shawn Milochik

unread,
Feb 21, 2012, 10:54:18 AM2/21/12
to django...@googlegroups.com
On 02/21/2012 10:53 AM, Javier Guerra Giraldez wrote:
>
> i do exactly that. just a tip: to create and maintain the pip
> requirements file do:
>
> pip freeze> piprequirementsfile.txt
>


+1

And it's checked into version control.

Shawn

Tom Evans

unread,
Feb 21, 2012, 11:21:39 AM2/21/12
to django...@googlegroups.com

How else would one do Software Change Management? :)

Cheers

Tom

Santiago Basulto

unread,
Feb 22, 2012, 9:17:37 AM2/22/12
to Django users
Thank you guys.

I'm unsing virtualenvs and Pip. Seems great, is really easy that way.

What about deployment? Will it be simple? Or should i care about the
specific webserver?

Thanks!

Javier Guerra Giraldez

unread,
Feb 22, 2012, 1:06:38 PM2/22/12
to django...@googlegroups.com
On Wed, Feb 22, 2012 at 9:17 AM, Santiago Basulto
<santiago...@gmail.com> wrote:
> I'm unsing virtualenvs and Pip. Seems great, is really easy that way.
>
> What about deployment? Will it be simple? Or should i care about the
> specific webserver?

on deployment there should be a 'real' webserver (as opposed to the
development server) and probably some wsgi server, database, cache,
queues, whatever your project needs.

besides that 'platform' needs, you also have the webapp itself: your
project and all the python dependencies (django, and extra apps like
South, celery, tagging, etc.) for this, it's (almost) the same as for
development: create a virtualenv, pull from repository, and
pip-install all dependencies.

the main difference is that instead of you running the dev-server, the
infrastructure (including your wsgi server) will execute your app.
exactly how that's done is different for each deployment architecture.

--
Javier

Matt Schinckel

unread,
Feb 22, 2012, 5:07:19 PM2/22/12
to django...@googlegroups.com
Not sure if it was mentioned earlier in this thread (couldn't find it), but what some people miss is that virtualenv is not just for development. You can, and should, deploy to a virtualenv on your server too.

Matt.

Alen Mujezinovic

unread,
Feb 23, 2012, 9:18:05 AM2/23/12
to django...@googlegroups.com
Hi Santiago


All the mentions of virtualenv and pip are good, but I want to throw in another suggestion that will make your life a lot easier when working in teams and lower the discrepancy between "development machine" and "live server": Vagrant [1].

In fact, we're now running *all* projects in vagrant vm's with automated provisioning. Adding a new coder to the team involves 

* Checking out the repository that contains 
** the vagrant configuration file
** the requirements.txt
** the setup.py
** the provisioning recipes

* running `vagrant up`

And you'll have a complete mini server that runs exactly the same architecture on each team member's dev machine and server.

Alen




Reply all
Reply to author
Forward
0 new messages