| 1 | [[PageOutline]] |
| 2 | = Google's Summer of Code 2023 = |
| 3 | |
| 4 | Django is a mentor organization for the 2023 Google Summer of Code. Read |
| 5 | [https://summerofcode.withgoogle.com Google's page] for more information on |
| 6 | how the program works. |
| 7 | |
| 8 | Django's GSoC program is being coordinated by the current Django Fellows, |
| 9 | Carlton Gibson and Mariusz Felisiak. |
| 10 | |
| 11 | == Mentors == |
| 12 | |
| 13 | If you're interested in mentoring -- supervising a student in work on Django-related activities -- let us know via the Mentoring topic on https://forum.djangoproject.com/. |
| 14 | |
| 15 | == Students == |
| 16 | |
| 17 | Student application period runs until April 4, 2023. |
| 18 | |
| 19 | If you'd like to get started on your proposal early, we'll be looking for a few things. |
| 20 | |
| 21 | * You'll need to have a concrete task in mind (some ideas are below) along with |
| 22 | a solid idea of what will constitute "success" (you tell us). |
| 23 | * If your proposal is a single large feature, library or site, you'll need to present |
| 24 | a detailed design specification. This proposal should be posted to |
| 25 | [https://forum.djangoproject.com/c/internals/mentorship/10 the Django Forum], |
| 26 | where it can be refined until it is accepted by the developer community. |
| 27 | * We'll want to know a bit about you -- links to previous work are great, if any. If you're proposing something ambitious, you'll need to convince us that you're up to the task. |
| 28 | * You'll also need to provide us with a schedule, including a detailed work breakdown and major milestones so your mentor can know if and when to nag you :) |
| 29 | |
| 30 | Here's an example of an accepted proposal from a previous year: |
| 31 | |
| 32 | * https://gist.github.com/chrismedrela/82cbda8d2a78a280a129 |
| 33 | |
| 34 | Note that none of the ideas below are good enough to be submissions in their |
| 35 | own right (so don't copy and paste)! We'll want to know not just what you want |
| 36 | to do but how you plan to pull it off. |
| 37 | |
| 38 | Don't feel limited to the ideas below -- if you've got a cool project you want |
| 39 | to work on, we'll probably be able to find you a mentor. We plan on approving |
| 40 | as many projects as we possibly can. |
| 41 | |
| 42 | We're accepting any GSOC proposal that fits one of the following three categories: |
| 43 | |
| 44 | * Work on Django itself - such as the ORM, forms, etc. This is what we've traditionally accepted GSoC entries in. |
| 45 | * Work on tools to support Django - the dashboard (https://dashboard.djangoproject.com/) is a good example of an existing tool that would have fit into this category. |
| 46 | * Work on libraries that supplement or add new features to Django to ease development - South and Django Debug Toolbar are good examples of existing projects that would have fit here. |
| 47 | |
| 48 | Unless explicitly mentioned below, we're **not** looking for people to work on |
| 49 | existing third-party libraries - we aren't able to guarantee commit access to |
| 50 | them. We may allow an exception if a maintainer of the library in question |
| 51 | agrees to help mentor beforehand. |
| 52 | |
| 53 | The broadening in scope is to allow people to work on new ideas to help Django |
| 54 | development and developers without tying you down to having to implement it in |
| 55 | the core codebase (and thus ruling out some projects that might otherwise be |
| 56 | useful). |
| 57 | |
| 58 | We're still going to be strict with what we accept - you'll need to provide a |
| 59 | strong use case for your idea and show that it would be useful to a majority of |
| 60 | developers or significantly improve the development of Django itself. |
| 61 | |
| 62 | We're not looking for small groups of incremental updates - like "improve |
| 63 | Django's Trac" - nor are we looking for impossible tasks, like "replace Trac |
| 64 | with this brand new issue tracker I'm writing". What you propose should be a |
| 65 | single project, achievable within the time period of GSoC, and something the |
| 66 | core developers can help mentor you on. |
| 67 | |
| 68 | We're also not looking for sites or projects that are merely written in Django |
| 69 | - this GSoC is not for you to propose your new forum hosting site or amazing |
| 70 | Django-based blogging engine. |
| 71 | |
| 72 | Note that when you contribute code, you will be expected to adhere to the same |
| 73 | contribution guidelines as any other code contributor. This means you will be |
| 74 | expected to provide extensive tests and documentation for any feature you add, |
| 75 | you will be expected to participate in discussion on |
| 76 | [http://groups.google.com/group/django-developers django-developers] and the |
| 77 | [https://forum.djangoproject.com Django Forum] when your topic of interest is |
| 78 | raised. If you're not already familiar with |
| 79 | [http://docs.djangoproject.com/en/dev/internals/contributing/ Django's |
| 80 | contribution guidelines], now would be a good time to read them - even if |
| 81 | you're not applying to work on Django core directly, we'll still want the same |
| 82 | level of contribution. |
| 83 | |
| 84 | == How can I improve my chances of being accepted? == |
| 85 | |
| 86 | The best thing you can do to improve your chances to be accepted as a Django |
| 87 | GSoC student is to start contributing now. Read up on |
| 88 | [https://docs.djangoproject.com/en/dev/internals/contributing/ Django’s |
| 89 | contribution documentation] and make yourself known to the core team by your |
| 90 | contributions (ideally, related to the area of your proposal). That way, when |
| 91 | it comes time to evaluate student applications, you’ll be a known individual |
| 92 | and more likely to be able to get the attention you need to develop a proposal. |
| 93 | |
| 94 | We're looking for candidates who can demonstrate that they can engage in work |
| 95 | of a project scope on an independent basis. We're there to help but we can't |
| 96 | watch you every step of the way, so we need to see that motivation from you. |
| 97 | Being active before the submissions process is the best way to demonstrate |
| 98 | this. |
| 99 | |
| 100 | == Communication == |
| 101 | |
| 102 | All GSOC-related communication is handled via the [https://forum.djangoproject.com/c/internals/mentorship/10 Django Forum, in |
| 103 | the Mentoring channel]. Any proposals for GSOC should be submitted there, as |
| 104 | well as discussion on the proposed projects and any updates that students post. |
| 105 | |
| 106 | Please be careful to keep content to the forum clear and purposeful; if you |
| 107 | have an idea, update, or criticism, please make sure you describe it in detail; |
| 108 | it can be tedious asking people to clarify any vague statements. |
| 109 | |
| 110 | == Ideas == |
| 111 | |
| 112 | Here are some suggestions for projects students may want to propose (please |
| 113 | feel free add to this list!). This isn't by any means the be-all and end-all of |
| 114 | ideas; please feel free to submit proposals for things not on this list. |
| 115 | Remember, we'd much prefer that you posted a draft proposal and your rough |
| 116 | timeline / success conditions to the the [https://forum.djangoproject.com/c/internals/mentorship/10 Django Forum, in |
| 117 | the Mentoring channel] or [http://groups.google.com/group/django-developers django-developers list], |
| 118 | even if it's already on the list below; it will help you get feedback on |
| 119 | choosing the right part of a problem, as well as helping to see if there is any |
| 120 | interest before you start drafting a full proposal. |
| 121 | |
| 122 | When developing your proposal, try to scope ideas/proposals to size of your project (175hrs or 350hrs) -- you need to be ambitious, but not too ambitious. The GSoC does not |
| 123 | cover activities other than coding, so certain ideas ("Write a more detailed |
| 124 | tutorial" or "Create demonstration screencasts") are not suitable for inclusion |
| 125 | here. |
| 126 | |
| 127 | On the other side, though, be sure to be concrete in your proposal. We'll want |
| 128 | to know what your goals are, and how you plan to accomplish them. |
| 129 | |
| 130 | In no particular order: |
| 131 | |
| 132 | == Database Connection Pool == |
| 133 | |
| 134 | Difficulty: Hard |
| 135 | Size: 350hrs |
| 136 | Potential Mentors: "Florian Apolloner", "Carlton Gibson" |
| 137 | |
| 138 | Django's persistent database connections do not function correctly under ASGI, for asynchronous code. As such we need a connection pool solution. |
| 139 | |
| 140 | There are per-database solutions out there, e.g. PG Bouncer for PostgreSQL. Can we wrap those, or provide our own implementation if needed? |
| 141 | |
| 142 | A proposal here will show awareness of the prior art, and the difficulties involved. (Background reading: https://github.com/brettwooldridge/HikariCP/blob/dev/documents/Welcome-To-The-Jungle.md and https://www.psycopg.org/articles/2021/01/17/pool-design/) |
| 143 | |
| 144 | |
| 145 | == Auto-importing shell == |
| 146 | |
| 147 | Difficulty: Medium |
| 148 | Size: 175hrs |
| 149 | Potential Mentors: "Adam Johnson" |
| 150 | |
| 151 | One of the most popular features of django-extensions is `shell_plus`, which is like `shell` but auto-imports your models for you. Adding this behaviour to core would be a great addition. |
| 152 | |
| 153 | A proposal should consider ways to define extra things to import, perhaps a documented path of subclassing the management command and overriding a method. |
| 154 | |
| 155 | |
| 156 | == Security: Bring CORS and CSP into core == |
| 157 | |
| 158 | Difficulty: Medium |
| 159 | Size: 350hrs |
| 160 | Potential Mentors: "Adam Johnson", "James Bennett" |
| 161 | |
| 162 | There are third-party apps providing support for Cross-Origin Resource Sharing (CORS) `django-cors-headers` and Content Security Policy (CSP) `django-csp `, but it would be good to have support built-in to core. |
| 163 | |
| 164 | Following the design of the CSRF/clickjacking protection, having safe defaults, and allowing straightforward per-path customisation, via e.g. decorators, would improve the security of all Django projects. |
| 165 | |
| 166 | == Migrations == |
| 167 | |
| 168 | Here are a couple project ideas for improving Django's migrations framework. |
| 169 | |
| 170 | For both projects: |
| 171 | |
| 172 | Difficulty: Hard. |
| 173 | Size: 350hrs |
| 174 | Potential Mentors: "Shai Berger" |
| 175 | |
| 176 | === Moving models between apps === |
| 177 | |
| 178 | Support moving models between apps. This is a long-standing problem, esp. in |
| 179 | enterprise-y or just long-running projects. It's not simple and requires custom |
| 180 | migration operations to perform. |
| 181 | |
| 182 | It has been discussed previously: https://forum.djangoproject.com/t/why-do-we-need-apps/827/20 |
| 183 | |
| 184 | === Audo-detection of custom migration operations === |
| 185 | |
| 186 | Allow auto-detection of custom migration operations. |
| 187 | |
| 188 | The auto-detector has its change-detection mostly hard-coded: |
| 189 | https://github.com/django/django/blob/main/django/db/migrations/autodetector.py#L104 |
| 190 | |
| 191 | It doesn't seem easy (or even possible with the current approach) to |
| 192 | allow third-party code to intervene. |
| 193 | |
| 194 | A proposal here would need to demonstrate a plan for a route forward. |
| 195 | |
| 196 | Note: These two projects are quite independent. Auto-detection of the fact that |
| 197 | a model has moved between apps is not required, supporting such moves with |
| 198 | flags to makemigrations or even a dedicated management-command would be |
| 199 | completely satisfactory. |
| 200 | |
| 201 | |
| 202 | - [SummerOfCode2022 (Edit) – Django](https://code.djangoproject.com/wiki/SummerOfCode2022?action=edit) |
| 203 | - [WikiFormatting – Django](https://code.djangoproject.com/wiki/WikiFormatting) |
| 204 | |
| 205 | |
| 206 | |
| 207 | == Improve the Database Cache Backend == |
| 208 | |
| 209 | Difficulty: Medium. |
| 210 | Size: 350hrs |
| 211 | Potential Mentors: "Adam Johnson" |
| 212 | |
| 213 | Setting up a shared cache backend is nearly always required, as many |
| 214 | third-party packages assume the cache works like this (unlike the default |
| 215 | locmemcache which is per process). DatabaseCache is the easiest such cache |
| 216 | backend, not requiring any extra infra and working on shared hosts without a |
| 217 | filesystem. But it could be better. |
| 218 | |
| 219 | Django-Mysql has had a much better DB cache backend implementation since 2015: https://adamj.eu/tech/2015/05/17/building-a-better-databasecache-for-django-on-mysql/ . This has never been adapted for the other supported databases but it should be fairly straightforward, mostly some translation of SQL to different dialects. |
| 220 | |
| 221 | As a stretch goal, it would also be nice to hook the database cache tables into |
| 222 | migrations somehow rather than the current hacky duck typing approach: |
| 223 | https://github.com/django/django/blob/64b3c413da011f55469165256261f406a277e822/ |
| 224 | django/core/cache/backends/db.py#L12-L28 ). |
| 225 | |
| 226 | |
| 227 | == Typed Django == |
| 228 | |
| 229 | There are several potential projects related to typing and the django-stubs project. |
| 230 | |
| 231 | For all three projects: |
| 232 | |
| 233 | Difficulty: Hard. |
| 234 | Size: 175hrs |
| 235 | Potential Mentors: "Adam Johnson" |
| 236 | |
| 237 | === Strict-mode support for django-stubs === |
| 238 | |
| 239 | The django-stubs implementation does not currently pass Mypy’s strict mode. |
| 240 | |
| 241 | Making this compliant would enable users to always use strict mode with them, improving type safety. |
| 242 | |
| 243 | === Merging django-types back into django-stubs === |
| 244 | |
| 245 | There is a spin-off project from django-stubs called django-types. The original intention here was for it to be merged back into django-stubs, but that's never happened. |
| 246 | |
| 247 | django-types removes the need to use any mypy plugins, making it possible to use type checkers other than mypy, such as Pyrite, Pyre, etc. |
| 248 | |
| 249 | django-types is not actively maintained, however, and having competing stubs implementations means neither is as strong as could be. |
| 250 | |
| 251 | There is a small project in extracting the work from django-types and creating a PR for django-stubs allowing it to be merged back in, and effort to be concentrated on the single implementation. |
| 252 | |
| 253 | === Exploratory proof-of-concept for typing Django core === |
| 254 | |
| 255 | Since type annotations were added to Python, there has been discussion of when and whether they should be added to Django. |
| 256 | |
| 257 | In 2019 a proposal to add inline type hints was rejected. (See https://github.com/django/deps/pull/65 and links therein.) |
| 258 | |
| 259 | Since then there has been improvements in the typing landscape, and more people in the community are using type hints regularly in their own projects. |
| 260 | |
| 261 | It remains difficult, though, to judge whether it's now time to reassess that earlier decision. |
| 262 | |
| 263 | An exploratory proof-of-concept project applying type hints to some of the //leaf// modules in Django (those without further dependencies) — perhaps utils, the forms widgets and into fields, or inside the SQL compiler of the ORM — would enable us to see what the decision to adopt inline type hints would amount to. |
| 264 | |
| 265 | Such a project would need to: |
| 266 | |
| 267 | - Add readable type-hints, making good use type alises, Protocols, and so on. |
| 268 | - Configure mypy validation for the adjusted files, on CI, pre-commit, and for local development. |
| 269 | - Add typing to the relevant tests cases, and apply type checking there too. |
| 270 | |
| 271 | The goal would be a PR showing what an incremental adoption of inline typing would like for Django in 2023, to serve as the basis of a fresh discussion of whether to adopt typing more generally. |
| 272 | |
| 273 | |
| 274 | == Configurable Content Type Parsing == |
| 275 | |
| 276 | Difficulty: Medium. |
| 277 | Size: 350hrs |
| 278 | Potential Mentors: "Carlton Gibson" |
| 279 | |
| 280 | For Django 5.0 we're looking to modernize the `HTTPRequest` object, adding a content-type aware `request.data` property. This will parse `request.body` according to the content type. |
| 281 | |
| 282 | The initial phase — targeted for before GSoC — will add `request.data` and add support for JSON body handling, but the next phase is to make that fully pluggable with custom parsers. |
| 283 | |
| 284 | - Add a list of parsers to the request object, that can be customised — in a middleware for example — at any point prior to accessing `request.data`. |
| 285 | - Parsers should implement a `can_handle(content_type) -> Bool` method. The first parser returning True will be selected to parse the `request.body`. |
| 286 | |
| 287 | |
| 288 | == Window expressions improvements == |
| 289 | |
| 290 | Add support for filtering against window expressions (see #28333), for `EXCLUDE` and currently not covered `RowRange()` cases (see #29850). |
| 291 | |
| 292 | Hard project. 350hr project |
| 293 | |
| 294 | Would require knowledge of the Django ORM, and the supported databases. |
| 295 | |
| 296 | Expected outcome would be a PR (or a number of them) on the ORM. |
| 297 | |
| 298 | Possible mentor: ''Mariusz Felisiak''. |
| 299 | |
| 300 | |
| 301 | |
| 302 | == Database-level Cascades == |
| 303 | |
| 304 | Difficulty: Medium |
| 305 | Size: 350hr |
| 306 | Possible mentors: ''Mariusz Felisiak''. |
| 307 | |
| 308 | There's an old ticket to [https://code.djangoproject.com/ticket/21961 Add support for database-level cascading options]. |
| 309 | This means that rather than Django's in-Python options for `on_delete` clauses, we'd allow the database to handle this with it's native implementation. |
| 310 | This would be a new option `db_on_delete` maybe, with the existing `on_delete` being `DO_NOTHING` if it were used. |
| 311 | |
| 312 | This had a couple of PRs that were in the right direction ([https://github.com/django/django/pull/14550 1], [https://github.com/django/django/pull/8661 2]), and [https://groups.google.com/g/django-developers/c/FJMoGgtYIX4/m/LTdjlWydJ2EJ a long-discussion on django-developers]. |
| 313 | |
| 314 | A effective first-pass here for a single database backend can be done creating |
| 315 | a `ForeignKey` subclass setting a flag, and then overriding |
| 316 | `DatabaseSchemaEditor` `add_field()` and `sql_create_fk()` to detect that, |
| 317 | adjusting the generated SQL accordingly. (Try it!) |
| 318 | |
| 319 | The project would be to make that work generally, for all database backends, |
| 320 | and integrate with the migrations framework. |
| 321 | |
| 322 | Would require knowledge of the Django ORM, SQL, and the supported database |
| 323 | backends. Significant work has already gone into the project, so research of |
| 324 | the links given would be needed. |
| 325 | |
| 326 | Expected outcome would be a PR adding support for Database-level Cascades to |
| 327 | the Django ORM. |
| 328 | |
| 329 | == Add Async Support to Django Debug Toolbar == |
| 330 | |
| 331 | Difficulty: Medium. |
| 332 | Size: 350hr |
| 333 | Possible mentors: ''Tim Schilling''/''Carlton Gibson''. |
| 334 | |
| 335 | Django Debug Toolbar (DDT) is one of the key packages in the Django ecosystem. |
| 336 | |
| 337 | https://github.com/jazzband/django-debug-toolbar |
| 338 | |
| 339 | DDT is not yet compatibile with Django Channels and async Django run unders ASGI. |
| 340 | Adding support for async to DDT would be a great contribution. |
| 341 | |
| 342 | Preliminary implementation ideas for this are available here: https://github.com/jazzband/django-debug-toolbar/pull/1432 |
| 343 | |
| 344 | Would require some knowledge of asyncio, Django Channels, ASGI, and how the Django Debug Toolbar works. |
| 345 | |
| 346 | Expected outcome would be a PR (or multiple PRs) moving the toolbar towards full compatibility with Django channels and async logic. |
| 347 | |
| 348 | |
| 349 | |
| 350 | == Or Create Your Own == |
| 351 | |
| 352 | |
| 353 | We have around 900 accepted tickets on Django. Browse the issue tracker by |
| 354 | component — here's an |
| 355 | [https://code.djangoproject.com/query?status=assigned&status=new&component=contrib.staticfiles&col=id&col=summary&col=status&col=owner&col=type&col=component&col=version&desc=1&order=id example filter for contrib.staticfiles]. What's the bit of the framework that interests you? |
| 356 | What contribution do you want to make to it? |
| 357 | |
| 358 | Use the tickets as guides here. Remember the advice above, that your project |
| 359 | needs to be both on Django itself here, and achievable in the timescale of |
| 360 | GSoC. |
| 361 | |
| 362 | Could be scoped as a 175hr or a 350hr project, depending on your idea. |
| 363 | |
| 364 | Possible mentors: ''Carlton Gibson'', ''Mariusz Felisiak''. |