8 So you want to hack on GNU MediaGoblin?
9 =======================================
11 First thing to do is check out the `Web site
12 <http://mediagoblin.org/join/>`_ where we list all the project
13 infrastructure including:
19 Additionally, we have information on how to get involved, who to talk
20 to, what needs to be worked on, and other things besides!
22 Second thing to do is take a look at :ref:`codebase-chapter` where
23 we've started documenting how GNU MediaGoblin is built and how to add
27 How to set up and maintain an environment for hacking
28 =====================================================
34 First, you need to have the following installed before you can build
35 an environment for hacking on GNU MediaGoblin:
37 * Python 2.6 or 2.7 - http://www.python.org/
39 You'll need Python as well as the dev files for building modules.
41 * python-lxml - http://lxml.de/
42 * git - http://git-scm.com/
43 * MongoDB - http://www.mongodb.org/
45 If you're running Debian GNU/Linux or a Debian-derived distribution
46 such as Mint or Ubuntu, running the following should install these
49 sudo apt-get install mongodb git-core python python-dev \
52 After getting the requirements, there are two ways to build a development environment:
54 1. Running bootstrap and buildout, OR
55 2. Creating a virtual environment
57 Pick one---don't do both!
60 Creating a dev environment with bootstrap and buildout
61 ------------------------------------------------------
65 Either follow the instructions in this section OR follow the ones
66 in the next one---don't do both!
69 After installing the requirements, follow these steps:
71 1. Clone the repository::
73 git clone http://git.gitorious.org/mediagoblin/mediagoblin.git
75 2. Bootstrap and run buildout::
78 python bootstrap.py && ./bin/buildout
81 That's it! Using this method, buildout should create a ``user_dev``
82 directory, in which certain things will be stored (media, beaker
83 session stuff, etc). You can change this, but for development
84 purposes this default should be fine.
89 We used `zc.buildout <http://www.buildout.org/>`_ because it
90 involves fewer steps to get things running and less knowledge of
91 Python packaging. However, if you prefer to use `virtualenv
92 <http://pypi.python.org/pypi/virtualenv>`_, that should work just
95 While hacking on GNU MediaGoblin over time, you'll eventually have to
96 update your development environment because the dependencies have
97 changed. To do that, run::
103 You only need to do this when dependencies are updated. You don't
104 need to do this when you've made code changes.
107 Creating a dev environment with virtualenv
108 ------------------------------------------
112 Either follow the instructions in this section OR follow the ones
113 in the previous one---don't do both!
115 The following assumes you have these things installed:
119 http://pypi.python.org/pypi/virtualenv
121 2. virtualenv wrapper:
123 http://www.doughellmann.com/projects/virtualenvwrapper/
132 1. Clone the repository::
134 git clone http://git.gitorious.org/mediagoblin/mediagoblin.git
136 2. Create a virtual environment::
138 mkvirtualenv --no-site-packages mediagoblin
140 3. If that doesn't put you in the virutal environment you just created, then do::
146 python setup.py develop
151 When you want to work on GNU MediaGoblin, you need to activate the
152 virtual environment like this::
156 If you want to deactivate it, you can do this::
162 You don't have to do anything additional to move changes you're
163 making to your virtual environment because the virtual environment
164 is pointing at the actual code files.
172 ./bin/paster serve mediagoblin.ini --reload
178 You need to do this if you want your media to process and actually
179 show up. It's probably a good idea in development to have the web
180 server (above) running in one terminal and celeryd in another window.
184 CELERY_CONFIG_MODULE=mediagoblin.celery_setup.from_celery ./bin/celeryd
187 Running the test suite
188 ======================
195 Wiping your environment for a clean-slate
196 -----------------------------------------
200 Unless you're doing development and working on and testing creating
201 a new instance, you will probably never have to do this. Will
202 plans to do this work and thus he documented it.
205 Delete the following directories:
210 * mediagoblin.egg-info/
217 If you're familiar with MongoDB, we'd love to get a `script that
218 removes all the GNU MediaGoblin data from an existing instance
219 <http://bugs.foocorp.net/issues/296>`_. Let us know!
222 Quickstart for Django programmers
223 =================================
225 We're not using Django, but the codebase is very Django-like in its
228 * ``routing.py`` is like ``urls.py`` in Django
229 * ``models.py`` has mongokit ORM definitions
230 * ``views.py`` is where the views go
232 We're using MongoDB. Basically, instead of a relational database with
233 tables, you have a big JSON structure which acts a lot like a Python
239 If there are other things that you think would help orient someone
240 new to GNU MediaGoblin but coming from Django, let us know!
243 Bite-sized bugs to start with
244 =============================
246 **May 3rd, 2011**: We don't have a list of bite-sized bugs, yet, but
247 this is important to us. If you're interested in things to work on,
248 let us know on `the mailing list <http://mediagoblin.org/join/>`_ or
249 on the `IRC channel <http://mediagoblin.org/join/>`_.
252 Tips for people new to coding
253 =============================
258 GNU MediaGoblin is written using a programming language called `Python
259 <http://python.org/>`_.
261 There are two different incompatible iterations of Python which I'll
262 refer to as Python 2 and Python 3. GNU MediaGoblin is written in
263 Python 2 and requires Python 2.6 or 2.7. At some point, we might
264 switch to Python 3, but that's a future thing.
266 You can learn how to code in Python 2 from several excellent books
267 that are freely available on the Internet:
269 * `Learn Python the Hard Way <http://learnpythonthehardway.org/>`_
270 * `Dive Into Pyton <http://diveintopython.org/>`_
271 * `Python for Software Design <http://www.greenteapress.com/thinkpython/>`_
272 * `A Byte of Python <http://www.swaroopch.com/notes/Python>`_
274 These are all excellent texts.
278 If you know of other good quality Python tutorials and Python
279 tutorial videos, let us know!
282 Learning Libraries GNU MediaGoblin uses
283 ---------------------------------------
285 GNU MediaGoblin uses a variety of libraries in order to do what it
286 does. These libraries are listed in the :ref:`codebase-chapter`
287 along with links to the project Web sites and documentation for the
290 There are a variety of Python-related conferences every year that have
291 sessions covering many aspects of these libraries. You can find them
292 at `Python Miro Community <http://python.mirocommunity.org>`_ [0]_.
294 .. [0] This is a shameless plug. Will Kahn-Greene runs Python Miro
297 If you have questions or need help, find us on the mailing list and on
301 .. _hacking-howto-git:
306 git is an interesting and very powerful tool. Like all powerful
307 tools, it has a learning curve.
309 If you're new to git, we highly recommend the following resources for
310 getting the hang of it:
312 * `Learn Git <http://learn.github.com/p/intro.html>`_ --- the GitHub
314 * `Pro Git <http://progit.org/book/>`_ --- fantastic book
315 * `Git casts <http://gitcasts.com/>`_ --- screencast covering git
317 * `Git Reference <http://gitref.org/>`_ --- Git reference that makes
318 it easier to get the hang of git if you're coming from other version
322 Learning other utilities
323 ------------------------
325 The `OpenHatch <http://openhatch.org/>`_ site has a series of
326 `training missions <http://openhatch.org/missions/>`_ which are
327 designed to help you learn how to use these tools.
329 If you're new to tar, diff and patch, we highly recommend you sign up
330 with OpenHatch and do the missions.