Skip to content

Commit 24f40f6

Browse files
committed
Merge branch 'python-pendulum-master'
2 parents aa0472f + 2242207 commit 24f40f6

File tree

30 files changed

+1052
-764
lines changed

30 files changed

+1052
-764
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
- os: ubuntu
2727
platform: linux
2828
target: ppc64le
29-
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 3.13
29+
interpreter: 3.9 3.10 3.11 3.12 3.13
3030
# mimalloc not supported on manylinux2014 cross-compile container
3131
extra-build-args: --no-default-features
3232
- os: ubuntu
3333
platform: linux
3434
target: s390x
35-
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 3.13
35+
interpreter: 3.9 3.10 3.11 3.12 3.13
3636
# mimalloc not supported on manylinux2014 cross-compile container
3737
extra-build-args: --no-default-features
3838

@@ -60,7 +60,7 @@ jobs:
6060
- os: windows
6161
target: i686
6262
python-architecture: x86
63-
interpreter: 3.8 3.9 3.10 3.11 3.12 3.13
63+
interpreter: 3.9 3.10 3.11 3.12 3.13
6464
- os: windows
6565
target: aarch64
6666
interpreter: 3.11 3.12 3.13
@@ -70,7 +70,7 @@ jobs:
7070
target: x86_64
7171
- os: macos
7272
target: aarch64
73-
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10
73+
interpreter: 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10
7474

7575

7676

@@ -90,7 +90,7 @@ jobs:
9090
target: ${{ matrix.target }}
9191
manylinux: ${{ matrix.manylinux || 'auto' }}
9292
container: ${{ matrix.container }}
93-
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.7 pypy3.8 pypy3.9 pypy3.10' }} ${{ matrix.extra-build-args }}
93+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' }} ${{ matrix.extra-build-args }}
9494
rust-toolchain: stable
9595
docker-options: -e CI
9696

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [Ubuntu, MacOS, Windows]
36-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
36+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3737
defaults:
3838
run:
3939
shell: bash

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@ format-rust:
1818
cd rust && cargo clippy --tests --fix --allow-dirty -- -D warnings
1919

2020
dev:
21-
poetry install
21+
poetry install --only main --only test --only typing --only build
22+
poetry run maturin develop
23+
24+
lint:
25+
poetry run mypy
26+
27+
test:
28+
PENDULUM_EXTENSIONS=0 poetry run pytest -q tests
29+
poetry run pytest -q tests

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ Pendulum
1111
:alt: Pendulum Build status
1212
:target: https://github.com/sdispater/pendulum/actions
1313

14-
1514
Python datetimes made easy.
1615

17-
Supports Python **3.8 and newer**.
16+
Supports Python **3.9 and newer**.
1817

1918

2019
.. code-block:: python

docs/docs/modifiers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ True
8181
'2014-01-15 12:00:00'
8282

8383
# others that are defined that are similar
84-
# and tha accept month, quarter and year units
84+
# and that accept month, quarter and year units
8585
# first_of(), last_of(), nth_of()
8686
```

poetry.lock

Lines changed: 559 additions & 573 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ name = "pendulum"
33
version = "3.0.1"
44
description = "Python datetimes made easy"
55
readme = "README.rst"
6-
requires-python = ">=3.8"
6+
requires-python = ">=3.9"
77
license = { text = "MIT License" }
88
authors = [{ name = "Sébastien Eustace", email = "[email protected]" }]
99
keywords = ['datetime', 'date', 'time']
1010

1111
classifiers = [
1212
"License :: OSI Approved :: MIT License",
1313
"Programming Language :: Python :: 3",
14-
"Programming Language :: Python :: 3.8",
1514
"Programming Language :: Python :: 3.9",
1615
"Programming Language :: Python :: 3.10",
1716
"Programming Language :: Python :: 3.11",
@@ -22,8 +21,6 @@ classifiers = [
2221
dependencies = [
2322
"python-dateutil>=2.6",
2423
"tzdata>=2020.1",
25-
'backports.zoneinfo>=0.2.1; python_version < "3.9"',
26-
'importlib-resources>=5.9.0; python_version < "3.9"',
2724
"cffi>=1.17",
2825
]
2926

@@ -47,17 +44,15 @@ keywords = ['datetime', 'date', 'time']
4744

4845

4946
[tool.poetry.dependencies]
50-
python = ">=3.8"
47+
python = ">=3.9"
5148
cffi = ">=1.17"
5249
python-dateutil = ">=2.6"
53-
"backports.zoneinfo" = { version = ">=0.2.1", python = "<3.9" }
5450
tzdata = ">=2020.1"
55-
importlib-resources = { version = ">=5.9.0", python = "<3.9" }
5651

5752
[tool.poetry.group.test.dependencies]
5853
pytest = "^7.1.2"
5954
pytz = ">=2022.1"
60-
time-machine = ">=2.6.0"
55+
time-machine = ">=2.16.0"
6156
pytest-benchmark = "^4.0.0"
6257

6358
[tool.poetry.group.doc.dependencies]
@@ -85,6 +80,7 @@ ruff = "^0.7.3"
8580

8681
[tool.poetry.group.build.dependencies]
8782
maturin = ">=1.0,<2.0"
83+
patchelf = ">=17"
8884

8985
[tool.poetry.extras]
9086
test = ["time-machine"]
@@ -98,7 +94,7 @@ fix = true
9894
unfixable = [
9995
"ERA", # do not autoremove commented out code
10096
]
101-
target-version = "py38"
97+
target-version = "py39"
10298
line-length = 88
10399
extend-select = [
104100
"B", # flake8-bugbear

rust/src/helpers.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,57 +49,57 @@ pub fn local_time(
4949
microsecond: usize,
5050
) -> (usize, usize, usize, usize, usize, usize, usize) {
5151
let mut year: usize = EPOCH_YEAR as usize;
52-
let mut seconds: isize = unix_time.floor() as isize;
52+
let mut seconds: i64 = unix_time.floor() as i64;
5353

5454
// Shift to a base year that is 400-year aligned.
5555
if seconds >= 0 {
56-
seconds -= (10957 * SECS_PER_DAY as usize) as isize;
56+
seconds -= 10957 * SECS_PER_DAY as i64;
5757
year += 30; // == 2000
5858
} else {
59-
seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
59+
seconds += (146_097 - 10957) * SECS_PER_DAY as i64;
6060
year -= 370; // == 1600
6161
}
6262

63-
seconds += utc_offset;
63+
seconds += utc_offset as i64;
6464

6565
// Handle years in chunks of 400/100/4/1
66-
year += 400 * (seconds / SECS_PER_400_YEARS as isize) as usize;
67-
seconds %= SECS_PER_400_YEARS as isize;
66+
year += 400 * (seconds / SECS_PER_400_YEARS as i64) as usize;
67+
seconds %= SECS_PER_400_YEARS as i64;
6868
if seconds < 0 {
69-
seconds += SECS_PER_400_YEARS as isize;
69+
seconds += SECS_PER_400_YEARS as i64;
7070
year -= 400;
7171
}
7272

7373
let mut leap_year = 1; // 4-century aligned
74-
let mut sec_per_100years = SECS_PER_100_YEARS[leap_year] as isize;
74+
let mut sec_per_100years = SECS_PER_100_YEARS[leap_year].try_into().unwrap();
7575

7676
while seconds >= sec_per_100years {
7777
seconds -= sec_per_100years;
7878
year += 100;
7979
leap_year = 0; // 1-century, non 4-century aligned
80-
sec_per_100years = SECS_PER_100_YEARS[leap_year] as isize;
80+
sec_per_100years = SECS_PER_100_YEARS[leap_year].try_into().unwrap();
8181
}
8282

83-
let mut sec_per_4years = SECS_PER_4_YEARS[leap_year] as isize;
83+
let mut sec_per_4years = SECS_PER_4_YEARS[leap_year].into();
8484
while seconds >= sec_per_4years {
8585
seconds -= sec_per_4years;
8686
year += 4;
8787
leap_year = 1; // 4-year, non century aligned
88-
sec_per_4years = SECS_PER_4_YEARS[leap_year] as isize;
88+
sec_per_4years = SECS_PER_4_YEARS[leap_year].into();
8989
}
9090

91-
let mut sec_per_year = SECS_PER_YEAR[leap_year] as isize;
91+
let mut sec_per_year = SECS_PER_YEAR[leap_year].into();
9292
while seconds >= sec_per_year {
9393
seconds -= sec_per_year;
9494
year += 1;
9595
leap_year = 0; // non 4-year aligned
96-
sec_per_year = SECS_PER_YEAR[leap_year] as isize;
96+
sec_per_year = SECS_PER_YEAR[leap_year].into();
9797
}
9898

9999
// Handle months and days
100100
let mut month = TM_DECEMBER + 1;
101-
let mut day: usize = (seconds / (SECS_PER_DAY as isize) + 1) as usize;
102-
seconds %= SECS_PER_DAY as isize;
101+
let mut day: usize = (seconds / (SECS_PER_DAY as i64) + 1) as usize;
102+
seconds %= SECS_PER_DAY as i64;
103103

104104
let mut month_offset: usize;
105105
while month != (TM_JANUARY + 1) {
@@ -113,10 +113,10 @@ pub fn local_time(
113113
}
114114

115115
// Handle hours, minutes and seconds
116-
let hour: usize = (seconds / SECS_PER_HOUR as isize) as usize;
117-
seconds %= SECS_PER_HOUR as isize;
118-
let minute: usize = (seconds / SECS_PER_MIN as isize) as usize;
119-
let second: usize = (seconds % SECS_PER_MIN as isize) as usize;
116+
let hour: usize = (seconds / SECS_PER_HOUR as i64) as usize;
117+
seconds %= SECS_PER_HOUR as i64;
118+
let minute: usize = (seconds / SECS_PER_MIN as i64) as usize;
119+
let second: usize = (seconds % SECS_PER_MIN as i64) as usize;
120120

121121
(year, month, day, hour, minute, second, microsecond)
122122
}

src/pendulum/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,9 @@ def duration(
325325
)
326326

327327

328-
def interval(start: DateTime, end: DateTime, absolute: bool = False) -> Interval:
328+
def interval(
329+
start: DateTime, end: DateTime, absolute: bool = False
330+
) -> Interval[DateTime]:
329331
"""
330332
Create an Interval instance.
331333
"""

src/pendulum/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import datetime
44
import math
5+
import zoneinfo
56

67
from typing import NamedTuple
78
from typing import cast
@@ -22,7 +23,6 @@
2223
from pendulum.constants import TM_DECEMBER
2324
from pendulum.constants import TM_JANUARY
2425
from pendulum.tz.timezone import Timezone
25-
from pendulum.utils._compat import zoneinfo
2626

2727

2828
class PreciseDiff(NamedTuple):

0 commit comments

Comments
 (0)