Updates to hacking howto
[mediagoblin.git] / docs / designdecisions.rst
CommitLineData
8736b05d
WKG
1.. _design-decisions-chapter:
2
3==================
4 Design Decisions
5==================
6
7This chapter talks a bit about design decisions.
8
9
10Why Python
11==========
12
13Chris Webber on "Why Python":
14
15 Because I know Python, love Python, am capable of actually making
16 this thing happen in Python (I've worked on a lot of large free
17 software web applications before in Python, including `Miro
18 Community`_, the `Miro Guide`_, a large portion of `Creative
19 Commons`_, and a whole bunch of things while working at `Imaginary
20 Landscape`_). I know Python, I can make this happen in Python, me
21 starting a project like this makes sense if it's done in Python.
22
23 You might say that PHP is way more deployable, that Rails has way
24 more cool developers riding around on fixie bikes, and all of
25 those things are true. But I know Python, like Python, and think
26 that Python is pretty great. I do think that deployment in Python
27 is not as good as with PHP, but I think the days of shared hosting
28 are (thankfully) coming to an end, and will probably be replaced
29 by cheap virtual machines spun up on the fly for people who want
30 that sort of stuff, and Python will be a huge part of that future,
31 maybe even more than PHP will. The deployment tools are getting
32 better. Maybe we can use something like Silver Lining. Maybe we
33 can just distribute as ``.debs`` or ``.rpms``. We'll figure it
34 out when we get there.
35
36 Regardless, if I'm starting this project, which I am, it's gonna
37 be in Python.
38
39.. _Miro Community: http://mirocommunity.org/
40.. _Miro Guide: http://miroguide.org/
41.. _Creative Commons: http://creativecommons.org/
42.. _Imaginary Landscape: http://www.imagescape.com/
43
44
45Why WSGI Minimalism
46===================
47
48Chris Webber on "Why WSGI Minimalism":
49
00fdc7bd 50 If you notice in the technology listI list a lot of
8736b05d
WKG
51 components that are very `Django Project`_, but not actually
52 Django components. What can I say, I really like a lot of the
53 ideas in Django! Which leads to the question: why not just use
54 Django?
55
56 While I really like Django's ideas and a lot of its components, I
57 also feel that most of the best ideas in Django I want have been
58 implemented as good or even better outside of Django. I could
59 just use Django and replace the templating system with Jinja2, and
60 the form system with wtforms, and the database with MongoDB and
61 MongoKit, but at that point, how much of Django is really left?
62
63 I also am sometimes saddened and irritated by how coupled all of
64 Django's components are. Loosely coupled yes, but still coupled.
65 WSGI has done a good job of providing a base layer for running
66 applications on and if you know how to do it yourself [1]_, it's
67 not hard or many lines of code at all to bind them together
68 without any framework at all (not even say `Pylons`_, `Pyramid`_
69 or `Flask`_ which I think are still great projects, especially for
70 people who want this sort of thing but have no idea how to get
71 started). And even at this already really early stage of writing
72 MediaGoblin, that glue work is mostly done.
73
74 Not to say I don't think Django isn't great for a lot of things.
75 For a lot of stuff, it's still the best, but not for MediaGoblin,
76 I think.
77
78 One thing that Django does super well though is documentation. It
79 still has some faults, but even with those considered I can hardly
80 think of any other project in Python that has as nice of
81 documentation as Django. It may be worth learning some lessons on
82 documentation from Django [2]_, on that note.
83
84 I'd really like to have a good, thorough hacking-howto and
85 deployment-howto, especially in the former making some notes on
86 how to make it easier for Django hackers to get started.
87
88.. _Django Project: http://www.djangoproject.com/
89.. _Pylons: http://pylonshq.com/
90.. _Pyramid: http://docs.pylonsproject.org/projects/pyramid/dev/
91.. _Flask: http://flask.pocoo.org/
92
93.. [1] http://pythonpaste.org/webob/do-it-yourself.html
94.. [2] http://pycon.blip.tv/file/4881071/
95
96
97Why MongoDB
98===========
99
100Chris Webber on "Why MongoDB":
101
102 In case you were wondering, I am not a NOSQL fanboy, I do not go
103 around telling people that MongoDB is web scale. Actually my
104 choice for MongoDB isn't scalability, though scaling up really
105 nicely is a pretty good feature and sets us up well in case large
106 volume sites eventually do use MediaGoblin. But there's another
107 side of scalability, and that's scaling down, which is important
108 for federation, maybe even more important than scaling up in an
109 ideal universe where everyone ran servers out of their own
110 housing. As a memory-mapped database, MongoDB is pretty hungry,
111 so actually I spent a lot of time debating whether the inability
112 to scale down as nicely as something like SQL has with sqlite
113 meant that it was out.
114
115 But I decided in the end that I really want MongoDB, not for
116 scalability, but for flexibility. Schema evolution pains in SQL
117 are almost enough reason for me to want MongoDB, but not quite.
118 The real reason is because I want the ability to eventually handle
119 multiple media types through MediaGoblin, and also allow for
120 plugins, without the rigidity of tables making that difficult. In
121 other words, something like::
122
123 {"title": "Me talking until you are bored",
124 "description": "blah blah blah",
125 "media_type": "audio",
126 "media_data": {
127 "length": "2:30",
128 "codec": "OGG Vorbis"},
129 "plugin_data": {
130 "licensing": {
131 "license": "http://creativecommons.org/licenses/by-sa/3.0/"}}}
132
133
134 Being able to just dump media-specific information in a media_data
135 hashtable is pretty great, and even better is having a plugin
136 system where you can just let plugins have their own entire
137 key-value space cleanly inside the document that doesn't interfere
138 with anyone else's stuff. If we were to let plugins to deposit
139 their own information inside the database, either we'd let plugins
140 create their own tables which makes SQL migrations even harder
141 than they already are, or we'd probably end up creating a table
142 with a column for key, a column for value, and a column for type
143 in one huge table called "plugin_data" or something similar. (Yo
144 dawg, I heard you liked plugins, so I put a database in your
145 database so you can query while you query.) Gross.
146
00fdc7bd 147 I also don't want things to be too loose so that we forget or lose
8736b05d
WKG
148 the structure of things, and that's one reason why I want to use
149 MongoKit, because we can cleanly define a much structure as we
150 want and verify that documents match that structure generally
00fdc7bd
WKG
151 without adding too much bloat or overhead (MongoKit is a pretty
152 lightweight wrapper and doesn't inject extra MongoKit-specific
8736b05d
WKG
153 stuff into the database, which is nice and nicer than many other
154 ORMs in that way).
155
156
157Why Sphinx for documentation
158============================
159
160Will Kahn-Greene on "Why Sphinx":
161
162 Sphinx is a fantastic tool for organizing documentation for a
163 Python-based project that makes it pretty easy to write docs that
164 are readable in source form and can be "compiled" into HTML, LaTeX
165 and other formats.
166
167 There are other doc systems out there, but given that GNU
168 MediaGoblin is being written in Python, it makes sense to use
169 Sphinx for now.
fad67707
WKG
170
171
172Why AGPLv3 and CC0?
173===================
174
175Chris, Brett, Will, Rob, Matt, et al curated into a story where
176everyone is the hero by Will on "Why AGPLv3 and CC0":
177
178 The `AGPL v3`_ preserves the freedoms guaranteed by the GPL v3 in
179 the context of software as a service. Using this license ensures
180 that users of the service have the ability to examine the source,
181 deploy their own instance, and implement their own version. This
182 is really important to us and a core mission component of this
183 project. Thus we decided that the software parts should be under
184 this license.
185
186 However, the project is made up of more than just software:
187 there's CSS, images, and other output-related things. We wanted
188 the templates/images/css side of the project all permissive and
efb291d6
WKG
189 permissive in the same absolutely permissive way. We're waiving
190 our copyrights to non-software things under the CC0 waiver.
fad67707
WKG
191
192 That brings us to the templates where there's some code and some
efb291d6
WKG
193 output. The template engine we're using is called Jinja2. It
194 mixes HTML markup with Python code to render the output of the
195 software. We decided the templates are part of the output of the
fad67707
WKG
196 software and not the software itself. We wanted the output of the
197 software to be licensed in a hassle-free way so that when someone
198 deploys their own GNU MediaGoblin instance with their own
199 templates, they don't have to deal with the copyleft aspects of
200 the AGPLv3 and we'd be fine with that because the changes they're
efb291d6
WKG
201 making are identity-related. So at first we decided to waive our
202 copyrights to the templates with a CC0 waiver and then add an
203 exception to the AGPLv3 for the software such that the templates
204 can make calls into the software and yet be a separately licensed
205 work. However, Brett brought up the question of whether this
206 allows some unscrupulous person to make changes to the software
207 through the templates in such a way that they're not bound by the
208 AGPLv3: i.e. a loophole. We thought about this loophole and
209 between this and the extra legalese involved in the exception to
210 the AGPLv3, we decided that it's just way simpler if the templates
211 were also licensed under the AGPLv3.
fad67707
WKG
212
213 Then we have the licensing for the documentation. Given that the
214 documentation is tied to the software content-wise, we don't feel
215 like we have to worry about ensuring freedom of the documentation
efb291d6
WKG
216 or worry about attribution concerns. Thus we're waiving our
217 copyrights to the documentation under CC0 as well.
fad67707
WKG
218
219 Lastly, we have branding. This covers logos and other things that
220 are distinctive to GNU MediaGoblin that we feel represents this
221 project. Since we don't currently have any branding, this is an
222 open issue, but we're thinking we'll go with a CC BY-SA license.
223
224 By licensing in this way, we make sure that users of the software
225 receive the freedoms that the AGPLv3 ensures regardless of what
226 fate befalls this project.
227
228 So to summarize:
229
efb291d6 230 * software (Python, JavaScript, HTML templates): licensed
fad67707 231 under AGPLv3
efb291d6
WKG
232 * non-software things (CSS, images, video): copyrights waived
233 under CC0 because this is output of the software
234 * documentation: copyrights waived under CC0 because it's not part
235 of the software
236 * branding assets: we're kicking this can down the road, but
237 probably CC BY-SA
fad67707
WKG
238
239 This is all codified in the ``COPYING`` file.
240
241.. _AGPL v3: http://www.gnu.org/licenses/agpl.html
242.. _CC0 v1: http://creativecommons.org/publicdomain/zero/1.0/
6a338d8e
WKG
243
244
245Why copyright assignment?
246=========================
247
248Will Kahn-Greene on "Why copyright assignment?":
249
250 GNU MediaGoblin is a GNU project with the copyrights held by the
251 FSF. Like other GNU projects, we require copyright assignment to
252 the FSF which gives the FSF the legal ability to defend the
253 AGPL-covered status of the software and distribute it.
254
255 This is important to us because it guarantees that this software
256 we're working so hard on will be available to everyone and will
257 survive us. As long as someone is interested in using it and/or
258 working on it, it will live on.