Skip to content

Commit 5091232

Browse files
internal: change datetime implementation
Rework our implementation of tarantool.Datetime class. Previously it had relied on pandas.Timestamp and pandas.Timedelta. There were user complaints about pandas as a requirement since it's rather heavy. Now our implementation of datetime uses built-in datetime.datetime and datetime.timedelta, as well as dateutil.relativedelta.relativedelta and some other built-in tools. It is expected that the implementation change wouldn't affect users, but some minor behavior traits were broken in this patch: - Now we rely on datetime argument validation which if differs from pandas one. For example, it doesn't allow overflows for fields. Exceptions that user may receive from internal datetime are, of course, had changed as well. - We drop the support of `__eq__` for pandas.Timestamp. We simply compared underlying pandas.Timestamp with argument one, and now it's impossible. It the feature would be useful later, we may implement its comparison in some compatible way. - __repr__ has been changed since internal representation has been changed as well. python-dateutil is a relatively small (ver. 2.8.2 wheel size on pip is 247 kB, while msgpack 1.0.5 wheel is 316 kB and pytz 2023.3 wheel is 502 kB; numpy 1.24.2 wheel is 17.3 MB and pandas 2.0.0 wheel is 12.3 MB) and a popular library to work with various datetime cases. Since working with datetime is always bothersome, I think it's preferable to rely on well-tested library rather than implement months addition from the scratch. Closes #290
1 parent 4bdbdda commit 5091232

File tree

6 files changed

+262
-72
lines changed

6 files changed

+262
-72
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Migrate to built-in `Warning` instead of a custom one.
1212
- Migrate to built-in `RecursionError` instead of a custom one.
1313
- Collect full exception traceback.
14+
- Rework `tarantool.Datetime` implementation to use built-in
15+
`datetime.datetime`. External changes are as follows. Some of them
16+
are **breaking**.
17+
- Package no longer depends on `pandas`, only on `python-dateutil`
18+
(previously it was installed as a dependency of `pandas`) (#290).
19+
- `__repr__` has been changed.
20+
- Class is no longer expected to throw `pandas.Timestamp`
21+
exceptions. `datetime.datetime` exceptions and custom exceptions will
22+
be thrown instead of them.
23+
- Input arguments are validated with `datetime.datetime` rules.
24+
- Drop the support of `__eq__` operator for `pandas.Timestamp`.
1425

1526
## 0.12.1 - 2023-02-28
1627

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@
344344
intersphinx_mapping = {
345345
'python': ('http://docs.python.org/', None),
346346
'msgpack': ('https://msgpack-python.readthedocs.io/en/latest/', None),
347-
'pandas': ('https://pandas.pydata.org/docs/', None),
348347
'pytz': ('https://pytz.sourceforge.net/', None),
349348
}
350349

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
msgpack
2-
pandas
2+
python-dateutil
33
pytz
44
dataclasses; python_version <= '3.6'

rpm/SPECS/python-tarantool.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Python client library for Tarantool.}
2929
%package -n python3-%{srcname}
3030

3131
Requires: python3-msgpack
32-
Requires: python3-pandas
32+
Requires: python3-dateutil
3333
Requires: python3-pytz
3434

3535
Summary: %{summary}

0 commit comments

Comments
 (0)