Debian Codegraph @

docs/dev.rst

raw
1 Babel Development
2 =================
3
4 Babel as a library has a long history that goes back to the Trac project.
5 Since then it has evolved into an independently developed project that
6 implements data access for the `https://cldr.unicode.org Unicode CLDR project`_.
7
8 This document tries to explain as best as possible the general rules of
9 the project in case you want to help out developing.
10
11 Tracking the CLDR
12 -----------------
13
14 Generally the goal of the project is to work as closely as possible with
15 the `https://cldr.unicode.org/index/charts CLDR data`_. This has in the
16 past caused some frustrating problems
17 because the data is entirely out of our hand. To minimize the frustration
18 we generally deal with CLDR updates the following way:
19
20 * Bump the CLDR data only with a major release of Babel.
21 * Never perform custom bugfixes on the CLDR data.
22 * Never work around CLDR bugs within Babel. If you find a problem in
23 the data, report it upstream.
24 * Adjust the parsing of the data as soon as possible, otherwise this
25 will spiral out of control later. This is especially the case for
26 bigger updates that change pluralization and more.
27 * Try not to test against specific CLDR data that is likely to change.
28
29 Python Versions
30 ---------------
31
32 At the moment the following Python versions should be supported:
33
34 * Python 3.8 and up
35 * PyPy 3.8 and up
36
37 Unicode
38 -------
39
40 Unicode is a big deal in Babel. Here is how the rules are set up:
41
42 * internally everything is unicode that makes sense to have as unicode.
43 * Encode / decode at boundaries explicitly. Never assume an encoding in
44 a way it cannot be overridden. utf-8 should be generally considered
45 the default encoding.
46
47 Dates and Timezones
48 -------------------
49
50 Babel's timezone support relies on either ``pytz`` or ``zoneinfo``; if ``pytz``
51 is installed, it is preferred over ``zoneinfo``. Babel should assume that any
52 timezone objects can be from either of these modules.
53
54 Assumptions to make:
55
56 * use UTC where possible.
57 * be super careful with local time. Do not use local time without
58 knowing the exact timezone.
59 * `time` without date is a very useless construct. Do not try to
60 support timezones for it. If you do, assume that the current local
61 date is assumed and not utc date.