Commit | Line | Data |
---|---|---|
8736b05d WKG |
1 | .. _design-decisions-chapter: |
2 | ||
3 | ================== | |
4 | Design Decisions | |
5 | ================== | |
6 | ||
7 | This chapter talks a bit about design decisions. | |
8 | ||
9 | ||
10 | Why Python | |
11 | ========== | |
12 | ||
13 | Chris 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 | |
cafc7451 WKG |
20 | Landscape`_). Me starting a project like this makes sense if it's |
21 | done in Python. | |
8736b05d WKG |
22 | |
23 | You might say that PHP is way more deployable, that Rails has way | |
cafc7451 | 24 | more cool developers riding around on fixie bikes---and all of |
8736b05d WKG |
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 | ||
45 | Why WSGI Minimalism | |
46 | =================== | |
47 | ||
48 | Chris 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 | ||
97 | Why MongoDB | |
98 | =========== | |
99 | ||
100 | Chris 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 | ||
157 | Why Sphinx for documentation | |
158 | ============================ | |
159 | ||
160 | Will Kahn-Greene on "Why Sphinx": | |
161 | ||
cafc7451 | 162 | `Sphinx`_ is a fantastic tool for organizing documentation for a |
8736b05d WKG |
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 | |
cafc7451 WKG |
168 | MediaGoblin is being written in Python and I've done a ton of |
169 | documentation using Sphinx, it makes sense to use Sphinx for now. | |
170 | ||
171 | .. _Sphinx: http://sphinx.pocoo.org/ | |
fad67707 WKG |
172 | |
173 | ||
174 | Why AGPLv3 and CC0? | |
175 | =================== | |
176 | ||
177 | Chris, Brett, Will, Rob, Matt, et al curated into a story where | |
178 | everyone is the hero by Will on "Why AGPLv3 and CC0": | |
179 | ||
180 | The `AGPL v3`_ preserves the freedoms guaranteed by the GPL v3 in | |
181 | the context of software as a service. Using this license ensures | |
182 | that users of the service have the ability to examine the source, | |
183 | deploy their own instance, and implement their own version. This | |
184 | is really important to us and a core mission component of this | |
185 | project. Thus we decided that the software parts should be under | |
186 | this license. | |
187 | ||
188 | However, the project is made up of more than just software: | |
189 | there's CSS, images, and other output-related things. We wanted | |
190 | the templates/images/css side of the project all permissive and | |
efb291d6 WKG |
191 | permissive in the same absolutely permissive way. We're waiving |
192 | our copyrights to non-software things under the CC0 waiver. | |
fad67707 WKG |
193 | |
194 | That brings us to the templates where there's some code and some | |
efb291d6 WKG |
195 | output. The template engine we're using is called Jinja2. It |
196 | mixes HTML markup with Python code to render the output of the | |
197 | software. We decided the templates are part of the output of the | |
fad67707 WKG |
198 | software and not the software itself. We wanted the output of the |
199 | software to be licensed in a hassle-free way so that when someone | |
200 | deploys their own GNU MediaGoblin instance with their own | |
201 | templates, they don't have to deal with the copyleft aspects of | |
202 | the AGPLv3 and we'd be fine with that because the changes they're | |
efb291d6 WKG |
203 | making are identity-related. So at first we decided to waive our |
204 | copyrights to the templates with a CC0 waiver and then add an | |
205 | exception to the AGPLv3 for the software such that the templates | |
206 | can make calls into the software and yet be a separately licensed | |
207 | work. However, Brett brought up the question of whether this | |
208 | allows some unscrupulous person to make changes to the software | |
209 | through the templates in such a way that they're not bound by the | |
210 | AGPLv3: i.e. a loophole. We thought about this loophole and | |
211 | between this and the extra legalese involved in the exception to | |
212 | the AGPLv3, we decided that it's just way simpler if the templates | |
213 | were also licensed under the AGPLv3. | |
fad67707 WKG |
214 | |
215 | Then we have the licensing for the documentation. Given that the | |
216 | documentation is tied to the software content-wise, we don't feel | |
217 | like we have to worry about ensuring freedom of the documentation | |
efb291d6 WKG |
218 | or worry about attribution concerns. Thus we're waiving our |
219 | copyrights to the documentation under CC0 as well. | |
fad67707 WKG |
220 | |
221 | Lastly, we have branding. This covers logos and other things that | |
222 | are distinctive to GNU MediaGoblin that we feel represents this | |
223 | project. Since we don't currently have any branding, this is an | |
224 | open issue, but we're thinking we'll go with a CC BY-SA license. | |
225 | ||
226 | By licensing in this way, we make sure that users of the software | |
227 | receive the freedoms that the AGPLv3 ensures regardless of what | |
228 | fate befalls this project. | |
229 | ||
230 | So to summarize: | |
231 | ||
efb291d6 | 232 | * software (Python, JavaScript, HTML templates): licensed |
fad67707 | 233 | under AGPLv3 |
efb291d6 WKG |
234 | * non-software things (CSS, images, video): copyrights waived |
235 | under CC0 because this is output of the software | |
236 | * documentation: copyrights waived under CC0 because it's not part | |
237 | of the software | |
238 | * branding assets: we're kicking this can down the road, but | |
239 | probably CC BY-SA | |
fad67707 WKG |
240 | |
241 | This is all codified in the ``COPYING`` file. | |
242 | ||
243 | .. _AGPL v3: http://www.gnu.org/licenses/agpl.html | |
244 | .. _CC0 v1: http://creativecommons.org/publicdomain/zero/1.0/ | |
6a338d8e WKG |
245 | |
246 | ||
247 | Why copyright assignment? | |
248 | ========================= | |
249 | ||
250 | Will Kahn-Greene on "Why copyright assignment?": | |
251 | ||
252 | GNU MediaGoblin is a GNU project with the copyrights held by the | |
253 | FSF. Like other GNU projects, we require copyright assignment to | |
254 | the FSF which gives the FSF the legal ability to defend the | |
255 | AGPL-covered status of the software and distribute it. | |
256 | ||
257 | This is important to us because it guarantees that this software | |
258 | we're working so hard on will be available to everyone and will | |
259 | survive us. As long as someone is interested in using it and/or | |
260 | working on it, it will live on. |