Skip to content

Commit 3012f77

Browse files
committedNov 9, 2022
release: 0.10.0
Overview This release introduces the support of extention types (decimal, uuid, error, datetime, interval) in MessagePack, various IProto features support (feature discovery and push protocol) and major infrastructure updates (scm version computation, full documentation for external and internal API both as code docstrings and readthedocs HTML, deb and RPM packages, and everything is processed with CI/CD pipelines). Breaking changes This release should not break any existing behavior. New features - Backport ConnectionPool support for Python 3.6 (PR #245). - Support iproto feature discovery (#206). - Decimal type support (#203). - UUID type support (#202). - Support extra information for iproto errors (#232). - Error extension type support (#232). - Datetime type support and tarantool.Datetime type (#204, PR #252). Tarantool datetime objects are decoded to `tarantool.Datetime` type. `tarantool.Datetime` may be encoded to Tarantool datetime objects. You can create `tarantool.Datetime` objects either from MessagePack data or by using the same API as in Tarantool: ```python dt1 = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321) dt2 = tarantool.Datetime(timestamp=1661969274) dt3 = tarantool.Datetime(timestamp=1661969274, nsec=308543321) ``` `tarantool.Datetime` exposes `year`, `month`, `day`, `hour`, `minute`, `sec`, `nsec`, `timestamp` and `value` (integer epoch time with nanoseconds precision) properties if you need to convert `tarantool.Datetime` to any other kind of datetime object: ```python pdt = pandas.Timestamp(year=dt.year, month=dt.month, day=dt.day, hour=dt.hour, minute=dt.minute, second=dt.sec, microsecond=(dt.nsec // 1000), nanosecond=(dt.nsec % 1000)) ``` Use `tzoffset` parameter to set up offset timezone: ```python dt = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321, tzoffset=180) ``` You may use `tzoffset` property to get timezone offset of a datetime object. Use `tz` parameter to set up timezone name: ```python dt = tarantool.Datetime(year=2022, month=8, day=31, hour=18, minute=7, sec=54, nsec=308543321, tz='Europe/Moscow') ``` If both `tz` and `tzoffset` is specified, `tz` is used. You may use `tz` property to get timezone name of a datetime object. `timestamp_since_utc_epoch` is a parameter to set timestamp convertion behavior for timezone-aware datetimes. If ``False`` (default), behaves similar to Tarantool `datetime.new()`: ```python >>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=False) >>> dt datetime: Timestamp('2022-01-01 00:00:00'), tz: "" >>> dt.timestamp 1640995200.0 >>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow', ... timestamp_since_utc_epoch=False) >>> dt datetime: Timestamp('2022-01-01 00:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow" >>> dt.timestamp 1640984400.0 ``` Thus, if ``False``, datetime is computed from timestamp since epoch and then timezone is applied without any convertion. In that case, `dt.timestamp` won't be equal to initialization `timestamp` for all timezones with non-zero offset. If ``True``, behaves similar to `pandas.Timestamp`: ```python >>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=True) >>> dt datetime: Timestamp('2022-01-01 00:00:00'), tz: "" >>> dt.timestamp 1640995200.0 >>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow', ... timestamp_since_utc_epoch=True) >>> dt datetime: Timestamp('2022-01-01 03:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow" >>> dt.timestamp 1640995200.0 ``` Thus, if ``True``, datetime is computed in a way that `dt.timestamp` will always be equal to initialization `timestamp`. - Datetime interval type support and tarantool.Interval type (#229). Tarantool datetime interval objects are decoded to `tarantool.Interval` type. `tarantool.Interval` may be encoded to Tarantool interval objects. You can create `tarantool.Interval` objects either from MessagePack data or by using the same API as in Tarantool: ```python di = tarantool.Interval(year=-1, month=2, day=3, hour=4, minute=-5, sec=6, nsec=308543321, adjust=tarantool.IntervalAdjust.NONE) ``` Its attributes (same as in init API) are exposed, so you can use them if needed. - Datetime interval arithmetic support (#229). Valid operations: - `tarantool.Datetime` + `tarantool.Interval` = `tarantool.Datetime` - `tarantool.Datetime` - `tarantool.Interval` = `tarantool.Datetime` - `tarantool.Datetime` - `tarantool.Datetime` = `tarantool.Interval` - `tarantool.Interval` + `tarantool.Interval` = `tarantool.Interval` - `tarantool.Interval` - `tarantool.Interval` = `tarantool.Interval` Since `tarantool.Interval` could contain `month` and `year` fields and such operations could be ambiguous, you can use `adjust` field to tune the logic. The behavior is the same as in Tarantool, see [Interval arithmetic RFC](https://github.com/tarantool/tarantool/wiki/Datetime-Internals#interval-arithmetic). - `tarantool.IntervalAdjust.NONE` -- only truncation toward the end of month performed (default mode). ```python >>> dt = tarantool.Datetime(year=2022, month=3, day=31) datetime: Timestamp('2022-03-31 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.NONE) >>> dt + di datetime: Timestamp('2022-04-30 00:00:00'), tz: "" ``` - `tarantool.IntervalAdjust.EXCESS` -- overflow mode, without any snap or truncation to the end of month, straight addition of days in month, stopping over month boundaries if there is less number of days. ```python >>> dt = tarantool.Datetime(year=2022, month=1, day=31) datetime: Timestamp('2022-01-31 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.EXCESS) >>> dt + di datetime: Timestamp('2022-03-02 00:00:00'), tz: "" ``` - `tarantool.IntervalAdjust.LAST` -- mode when day snaps to the end of month, if happens. ```python >>> dt = tarantool.Datetime(year=2022, month=2, day=28) datetime: Timestamp('2022-02-28 00:00:00'), tz: "" >>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.LAST) >>> dt + di datetime: Timestamp('2022-03-31 00:00:00'), tz: "" ``` - Full documentation of internal and external API (#67). Bugfixes - Allow any MessagePack supported type as a request key (#240). - Make connection close idempotent (#250). Infrastructure - Use git version to set package version (#238). - Test pip install from branch (PR #241). - Pack and publish pip, RPM and deb packages with GitHub Actions (#164, #198). - Publish on readthedocs with CI/CD (including PRs) (#67).
1 parent 0f89870 commit 3012f77

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed
 

‎CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
### Added
10+
11+
### Changed
12+
13+
### Fixed
14+
15+
## 0.10.0 - 2022-11-09
16+
917
### Added
1018
- Decimal type support (#203).
1119
- UUID type support (#202).

‎debian/changelog

+205
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,208 @@
1+
python3-tarantool (0.10.0-0) unstable; urgency=medium
2+
3+
## Overview
4+
5+
This release introduces the support of extention types
6+
(decimal, uuid, error, datetime, interval) in MessagePack,
7+
various IProto features support (feature discovery and push
8+
protocol) and major infrastructure updates (scm version
9+
computation, full documentation for external and internal
10+
API both as code docstrings and readthedocs HTML, deb and
11+
RPM packages, and everything is processed with CI/CD pipelines).
12+
13+
## Breaking changes
14+
15+
This release should not break any existing behavior.
16+
17+
## New features
18+
19+
- Backport ConnectionPool support for Python 3.6 (PR #245).
20+
- Support iproto feature discovery (#206).
21+
- Decimal type support (#203).
22+
- UUID type support (#202).
23+
- Support extra information for iproto errors (#232).
24+
- Error extension type support (#232).
25+
- Datetime type support and tarantool.Datetime type (#204, PR #252).
26+
27+
Tarantool datetime objects are decoded to `tarantool.Datetime`
28+
type. `tarantool.Datetime` may be encoded to Tarantool datetime
29+
objects.
30+
31+
You can create `tarantool.Datetime` objects either from
32+
MessagePack data or by using the same API as in Tarantool:
33+
34+
```python
35+
dt1 = tarantool.Datetime(year=2022, month=8, day=31,
36+
hour=18, minute=7, sec=54,
37+
nsec=308543321)
38+
39+
dt2 = tarantool.Datetime(timestamp=1661969274)
40+
41+
dt3 = tarantool.Datetime(timestamp=1661969274, nsec=308543321)
42+
```
43+
44+
`tarantool.Datetime` exposes `year`, `month`, `day`, `hour`,
45+
`minute`, `sec`, `nsec`, `timestamp` and `value` (integer epoch time
46+
with nanoseconds precision) properties if you need to convert
47+
`tarantool.Datetime` to any other kind of datetime object:
48+
49+
```python
50+
pdt = pandas.Timestamp(year=dt.year, month=dt.month, day=dt.day,
51+
hour=dt.hour, minute=dt.minute, second=dt.sec,
52+
microsecond=(dt.nsec // 1000),
53+
nanosecond=(dt.nsec % 1000))
54+
```
55+
56+
Use `tzoffset` parameter to set up offset timezone:
57+
58+
```python
59+
dt = tarantool.Datetime(year=2022, month=8, day=31,
60+
hour=18, minute=7, sec=54,
61+
nsec=308543321, tzoffset=180)
62+
```
63+
64+
You may use `tzoffset` property to get timezone offset of a datetime
65+
object.
66+
67+
68+
Use `tz` parameter to set up timezone name:
69+
70+
```python
71+
dt = tarantool.Datetime(year=2022, month=8, day=31,
72+
hour=18, minute=7, sec=54,
73+
nsec=308543321, tz='Europe/Moscow')
74+
```
75+
76+
If both `tz` and `tzoffset` is specified, `tz` is used.
77+
78+
You may use `tz` property to get timezone name of a datetime object.
79+
80+
`timestamp_since_utc_epoch` is a parameter to set timestamp
81+
convertion behavior for timezone-aware datetimes.
82+
83+
If ``False`` (default), behaves similar to Tarantool `datetime.new()`:
84+
85+
```python
86+
>>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=False)
87+
>>> dt
88+
datetime: Timestamp('2022-01-01 00:00:00'), tz: ""
89+
>>> dt.timestamp
90+
1640995200.0
91+
>>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow',
92+
... timestamp_since_utc_epoch=False)
93+
>>> dt
94+
datetime: Timestamp('2022-01-01 00:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow"
95+
>>> dt.timestamp
96+
1640984400.0
97+
```
98+
99+
Thus, if ``False``, datetime is computed from timestamp
100+
since epoch and then timezone is applied without any
101+
convertion. In that case, `dt.timestamp` won't be equal to
102+
initialization `timestamp` for all timezones with non-zero offset.
103+
104+
If ``True``, behaves similar to `pandas.Timestamp`:
105+
106+
```python
107+
>>> dt = tarantool.Datetime(timestamp=1640995200, timestamp_since_utc_epoch=True)
108+
>>> dt
109+
datetime: Timestamp('2022-01-01 00:00:00'), tz: ""
110+
>>> dt.timestamp
111+
1640995200.0
112+
>>> dt = tarantool.Datetime(timestamp=1640995200, tz='Europe/Moscow',
113+
... timestamp_since_utc_epoch=True)
114+
>>> dt
115+
datetime: Timestamp('2022-01-01 03:00:00+0300', tz='Europe/Moscow'), tz: "Europe/Moscow"
116+
>>> dt.timestamp
117+
1640995200.0
118+
```
119+
120+
Thus, if ``True``, datetime is computed in a way that `dt.timestamp` will
121+
always be equal to initialization `timestamp`.
122+
123+
- Datetime interval type support and tarantool.Interval type (#229).
124+
125+
Tarantool datetime interval objects are decoded to `tarantool.Interval`
126+
type. `tarantool.Interval` may be encoded to Tarantool interval
127+
objects.
128+
129+
You can create `tarantool.Interval` objects either from
130+
MessagePack data or by using the same API as in Tarantool:
131+
132+
```python
133+
di = tarantool.Interval(year=-1, month=2, day=3,
134+
hour=4, minute=-5, sec=6,
135+
nsec=308543321,
136+
adjust=tarantool.IntervalAdjust.NONE)
137+
```
138+
139+
Its attributes (same as in init API) are exposed, so you can
140+
use them if needed.
141+
142+
- Datetime interval arithmetic support (#229).
143+
144+
Valid operations:
145+
- `tarantool.Datetime` + `tarantool.Interval` = `tarantool.Datetime`
146+
- `tarantool.Datetime` - `tarantool.Interval` = `tarantool.Datetime`
147+
- `tarantool.Datetime` - `tarantool.Datetime` = `tarantool.Interval`
148+
- `tarantool.Interval` + `tarantool.Interval` = `tarantool.Interval`
149+
- `tarantool.Interval` - `tarantool.Interval` = `tarantool.Interval`
150+
151+
Since `tarantool.Interval` could contain `month` and `year` fields
152+
and such operations could be ambiguous, you can use `adjust` field
153+
to tune the logic. The behavior is the same as in Tarantool, see
154+
[Interval arithmetic RFC](https://github.com/tarantool/tarantool/wiki/Datetime-Internals#interval-arithmetic).
155+
156+
- `tarantool.IntervalAdjust.NONE` -- only truncation toward the end of
157+
month performed (default mode).
158+
159+
```python
160+
>>> dt = tarantool.Datetime(year=2022, month=3, day=31)
161+
datetime: Timestamp('2022-03-31 00:00:00'), tz: ""
162+
>>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.NONE)
163+
>>> dt + di
164+
datetime: Timestamp('2022-04-30 00:00:00'), tz: ""
165+
```
166+
167+
- `tarantool.IntervalAdjust.EXCESS` -- overflow mode, without any snap
168+
or truncation to the end of month, straight addition of days in month,
169+
stopping over month boundaries if there is less number of days.
170+
171+
```python
172+
>>> dt = tarantool.Datetime(year=2022, month=1, day=31)
173+
datetime: Timestamp('2022-01-31 00:00:00'), tz: ""
174+
>>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.EXCESS)
175+
>>> dt + di
176+
datetime: Timestamp('2022-03-02 00:00:00'), tz: ""
177+
```
178+
179+
- `tarantool.IntervalAdjust.LAST` -- mode when day snaps to the end of month,
180+
if happens.
181+
182+
```python
183+
>>> dt = tarantool.Datetime(year=2022, month=2, day=28)
184+
datetime: Timestamp('2022-02-28 00:00:00'), tz: ""
185+
>>> di = tarantool.Interval(month=1, adjust=tarantool.IntervalAdjust.LAST)
186+
>>> dt + di
187+
datetime: Timestamp('2022-03-31 00:00:00'), tz: ""
188+
```
189+
190+
- Full documentation of internal and external API (#67).
191+
192+
## Bugfixes
193+
194+
- Allow any MessagePack supported type as a request key (#240).
195+
- Make connection close idempotent (#250).
196+
197+
## Infrastructure
198+
199+
- Use git version to set package version (#238).
200+
- Test pip install from branch (PR #241).
201+
- Pack and publish pip, RPM and deb packages with GitHub Actions (#164, #198).
202+
- Publish on readthedocs with CI/CD (including PRs) (#67).
203+
204+
-- Georgy.moiseev <georgy.moiseev@tarantool.org> Wed, 09 Nov 2022 13:14:20 +0300
205+
1206
tarantool-python (0.9.0-0) unstable; urgency=medium
2207
## Overview
3208

0 commit comments

Comments
 (0)
Please sign in to comment.