FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update README and documentation · python-pendulum/pendulum@3fdd777 · GitHub

Commit 3fdd777

Browse files
committed
Update README and documentation
1 parent 8aa32b2 commit 3fdd777

5 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎README.rst‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pendulum
1616

1717
Python datetimes made easy.
1818

19-
Supports Python **3.6+**.
19+
Supports Python **2.7** and **3.4+**.
2020

2121

2222
.. code-block:: python
@@ -45,11 +45,11 @@ Supports Python **3.6+**.
4545
'6 days 23 hours 58 minutes'
4646
4747
# Proper handling of datetime normalization
48-
>>> pendulum.create(2013, 3, 31, 2, 30, 0, 0, tz='Europe/Paris')
48+
>>> pendulum.datetime(2013, 3, 31, 2, 30, tz='Europe/Paris')
4949
'2013-03-31T03:30:00+02:00' # 2:30 does not exist (Skipped time)
5050
5151
# Proper handling of dst transitions
52-
>>> just_before = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, tz='Europe/Paris')
52+
>>> just_before = pendulum.datetime(2013, 3, 31, 1, 59, 59, 999999, tz='Europe/Paris')
5353
'2013-03-31T01:59:59.999999+01:00'
5454
>>> just_before.add(microseconds=1)
5555
'2013-03-31T03:00:00+02:00'
@@ -65,7 +65,7 @@ So it's still ``datetime`` but better.
6565

6666
Unlike other datetime libraries for Python, Pendulum is a drop-in replacement
6767
for the standard ``datetime`` class (it inherits from it), so, basically, you can replace all your ``datetime``
68-
instances by ``Pendulum`` instances in you code (exceptions exist for libraries that check
68+
instances by ``DateTime`` instances in you code (exceptions exist for libraries that check
6969
the type of the objects by using the ``type`` function like ``sqlite3`` or ``PyMySQL`` for instance).
7070

7171
It also removes the notion of naive datetimes: each ``Pendulum`` instance is timezone-aware
@@ -111,7 +111,7 @@ and it will try its best to return something while silently failing to handle so
111111
-3599.999999
112112
# Should be 1e-06
113113
114-
just_before = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
114+
just_before = pendulum.datetime(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
115115
just_after = just_before.add(microseconds=1)
116116
'2013-03-31T03:00:00+02:00'
117117
@@ -125,7 +125,7 @@ behavior with the data you are passing to it.
125125
Limitations
126126
===========
127127

128-
Even though the ``Pendulum`` class is a subclass of ``datetime`` there are some rare cases where
128+
Even though the ``DateTime`` class is a subclass of ``datetime`` there are some rare cases where
129129
it can't replace the native class directly. Here is a list (non-exhaustive) of the reported cases with
130130
a possible solution, if any:
131131

@@ -172,8 +172,8 @@ a possible solution, if any:
172172
Resources
173173
=========
174174

175-
* `Official Website <http://pendulum.eustace.io>`_
176-
* `Documentation <http://pendulum.eustace.io/docs/>`_
175+
* `Official Website <https://pendulum.eustace.io>`_
176+
* `Documentation <https://pendulum.eustace.io/docs/>`_
177177
* `Issue Tracker <https://github.com/sdispater/pendulum/issues>`_
178178

179179

‎docs/docs/difference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Difference
22

3-
The `diff()` method returns a :ref:`Period` instance that represents the total duration
3+
The `diff()` method returns a [Period](#period) instance that represents the total duration
44
between two `DateTime` instances. This interval can be then expressed in various units.
55
These interval methods always return *the total difference expressed* in the specified time requested.
66
All values are truncated and not rounded.

‎docs/docs/installation.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ Installing `pendulum` is quite simple:
55
```bash
66
$ pip install pendulum
77
```
8+
9+
or, if you are using [poetry](https://poetry.eustace.io):
10+
11+
```bash
12+
$ poetry add pendulum
13+
```

‎docs/docs/instantiation.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ It otherwise can be a `Timezone` instance or simply a string timezone value.
2828

2929
!!!note
3030

31-
Supported strings for timezones are the one provided by the [IANA time zone database](https://www.iana.org/time-zones>).
31+
Supported strings for timezones are the one provided
32+
by the [IANA time zone database](https://www.iana.org/time-zones>).
33+
3234
The special `local` string is also supported and will return your current timezone.
3335

3436
!!!warning

‎docs/docs/timezones.md‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ You can, however, control the normalization behavior:
3636
>>> pendulum.datetime(2013, 3, 31, 2, 30, 0, 0, tz='Europe/Paris',
3737
dst_rule=pendulum.PRE_TRANSITION)
3838
'2013-03-31T01:30:00+01:00'
39-
>>> pendulum.daettime(2013, 10, 27, 2, 30, 0, 0, tz='Europe/Paris',
39+
>>> pendulum.datetime(2013, 10, 27, 2, 30, 0, 0, tz='Europe/Paris',
4040
dst_rule=pendulum.PRE_TRANSITION)
4141
'2013-10-27T02:30:00+02:00'
4242

43-
>>> pendulum.datetime(2013, 3, 31, 2, 30, 0, 0, tz='Europe/Paris'
43+
>>> pendulum.datetime(2013, 3, 31, 2, 30, 0, 0, tz='Europe/Paris',
4444
dst_rule=pendulum.TRANSITION_ERROR)
4545
# NonExistingTime: The datetime 2013-03-31 02:30:00 does not exist
4646
>>> pendulum.datetime(2013, 10, 27, 2, 30, 0, 0, tz='Europe/Paris',
@@ -70,7 +70,7 @@ adopt the proper behavior and apply the transition accordingly.
7070
'2013-03-31T01:59:59.999998+01:00'
7171

7272
>>> dt = pendulum.datetime(2013, 10, 27, 2, 59, 59, 999999,
73-
tz='Europe/Paris'
73+
tz='Europe/Paris',
7474
dst_rule=pendulum.PRE_TRANSITION)
7575
'2013-10-27T02:59:59.999999+02:00'
7676
>>> dt = dt.add(microseconds=1)
@@ -99,6 +99,16 @@ with the `in_timezone()` method.
9999

100100
## Using the timezone library directly
101101

102+
!!!warning
103+
104+
**You should avoid using the timezone library in Python < 3.6.**
105+
106+
This is due to the fact that Pendulum relies heavily on the presence
107+
of the `fold` attribute which was introduced in Python 3.6.
108+
109+
The reason it works inside the Pendulum ecosystem is that it
110+
backported the `fold` attribute in the `DateTime` class.
111+
102112
Like said in the introduction, you can use the timezone library
103113
directly with standard `datetime` objects but with limitations, especially
104114
when adding and subtracting time around transition times.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL