Skip to content

Commit 14cbdfd

Browse files
authored
Update dependencies & build for Python 3.11 (#6)
* Update dependencies * Add Python 3.11 to build pipeline * Update build pipeline
1 parent a1bfc0e commit 14cbdfd

File tree

4 files changed

+55
-140
lines changed

4 files changed

+55
-140
lines changed

.github/workflows/CI.yaml

Lines changed: 39 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ jobs:
1616
runs-on: macos-latest
1717
strategy:
1818
matrix:
19-
python-version: ['3.7', '3.8', '3.9', '3.10']
19+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
2020
steps:
21-
- uses: actions/checkout@v2
22-
- uses: actions/setup-python@v2
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install Rust toolchain
26-
uses: actions-rs/toolchain@v1
26+
uses: dtolnay/rust-toolchain@stable
2727
with:
28-
toolchain: stable
29-
target: aarch64-apple-darwin
30-
profile: minimal
31-
default: true
28+
targets: aarch64-apple-darwin
3229
- name: Build Rust crate
3330
run: cargo build --release
3431
- name: Run Rust unit tests
@@ -37,25 +34,25 @@ jobs:
3734
uses: messense/maturin-action@v1
3835
with:
3936
target: x86_64
40-
args: -i python --release --out dist
37+
args: -i python --release --out dist --sdist
4138
- name: Install Python wheels (x86_64)
4239
run: |
4340
pip install fastdatetime --no-index --find-links dist --force-reinstall
4441
- name: Build Python wheels (universal2)
45-
if: ${{ matrix.python-version >= '3.8' || matrix.python-version == '3.10' }}
42+
if: ${{ matrix.python-version >= '3.8' || contains(fromJson('["3.10", "3.11"]'), matrix.python-version) }}
4643
uses: messense/maturin-action@v1
4744
with:
48-
args: -i python --release --universal2 --out dist --no-sdist
45+
args: -i python --release --universal2 --out dist
4946
- name: Install Python wheels (universal2)
50-
if: ${{ matrix.python-version >= '3.8' }}
47+
if: ${{ matrix.python-version >= '3.8' || contains(fromJson('["3.10", "3.11"]'), matrix.python-version) }}
5148
run: |
5249
pip install fastdatetime --no-index --find-links dist --force-reinstall
5350
- name: Run Python unit tests
5451
run: |
5552
pip install -r python/requirements-dev.txt
5653
python -m pytest -v python/tests/unit
5754
- name: Upload Python wheels
58-
uses: actions/upload-artifact@v2
55+
uses: actions/upload-artifact@v3
5956
with:
6057
name: wheels
6158
path: dist
@@ -64,22 +61,16 @@ jobs:
6461
runs-on: windows-latest
6562
strategy:
6663
matrix:
67-
python-version: ['3.7', '3.8', '3.9', '3.10']
64+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
6865
target: [x64]
6966
steps:
70-
- uses: actions/checkout@v2
71-
- uses: actions/setup-python@v2
67+
- uses: actions/checkout@v3
68+
- uses: actions/setup-python@v4
7269
with:
7370
python-version: ${{ matrix.python-version }}
7471
architecture: ${{ matrix.target }}
75-
- name: Update rustup
76-
run: rustup self update
7772
- name: Install Rust toolchain
78-
uses: actions-rs/toolchain@v1
79-
with:
80-
toolchain: stable
81-
profile: minimal
82-
default: true
73+
uses: dtolnay/rust-toolchain@stable
8374
- name: Build Rust crate
8475
if: matrix.target == 'x64'
8576
run: cargo build --release
@@ -90,7 +81,7 @@ jobs:
9081
uses: messense/maturin-action@v1
9182
with:
9283
target: ${{ matrix.target }}
93-
args: -i python --release --out dist --no-sdist
84+
args: -i python --release --out dist
9485
- name: Install Python wheels
9586
run: |
9687
pip install fastdatetime --no-index --find-links dist --force-reinstall
@@ -99,7 +90,7 @@ jobs:
9990
pip install -r python/requirements-dev.txt
10091
python -m pytest -v python/tests/unit
10192
- name: Upload Python wheels
102-
uses: actions/upload-artifact@v2
93+
uses: actions/upload-artifact@v3
10394
with:
10495
name: wheels
10596
path: dist
@@ -108,29 +99,25 @@ jobs:
10899
runs-on: ubuntu-latest
109100
strategy:
110101
matrix:
111-
python-version: ['3.7', '3.8', '3.9', '3.10']
102+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
112103
target: [x86_64, i686]
113104
steps:
114-
- uses: actions/checkout@v2
105+
- uses: actions/checkout@v3
115106
- name: Install Rust toolchain
116-
uses: actions-rs/toolchain@v1
117-
with:
118-
toolchain: stable
119-
profile: minimal
120-
default: true
107+
uses: dtolnay/rust-toolchain@stable
121108
- name: Build Rust crate
122109
run: cargo build --release
123110
- name: Run Rust unit tests
124111
run: cargo test --no-default-features --release
125-
- uses: actions/setup-python@v2
112+
- uses: actions/setup-python@v4
126113
with:
127114
python-version: ${{ matrix.python-version }}
128115
- name: Build Python wheels
129116
uses: messense/maturin-action@v1
130117
with:
131118
target: ${{ matrix.target }}
132119
manylinux: auto
133-
args: -i python${{ matrix.python-version }} --release --out dist --no-sdist
120+
args: -i python${{ matrix.python-version }} --release --out dist
134121
- name: Run Python unit tests
135122
if: matrix.target == 'x86_64'
136123
run: |
@@ -143,7 +130,7 @@ jobs:
143130
pip install -r python/requirements-dev.txt
144131
python -m pytest -v --benchmark-only python/tests/perf
145132
- name: Upload Python wheels
146-
uses: actions/upload-artifact@v2
133+
uses: actions/upload-artifact@v3
147134
with:
148135
name: wheels
149136
path: dist
@@ -153,35 +140,22 @@ jobs:
153140
strategy:
154141
matrix:
155142
python: [
156-
{ version: '3.7', abi: 'cp37-cp37m' },
157-
{ version: '3.8', abi: 'cp38-cp38' },
158-
{ version: '3.9', abi: 'cp39-cp39' },
159-
{ version: '3.10', abi: 'cp310-cp310' },
143+
'3.7',
144+
'3.8',
145+
'3.9',
146+
'3.10',
147+
'3.11',
160148
]
161-
target: [aarch64, armv7, s390x, ppc64le, ppc64]
162-
include:
163-
- python:
164-
version: 3.7
165-
abi: pp37-pypy37_pp73
166-
target: aarch64
167-
- python:
168-
version: 3.8
169-
abi: pp38-pypy38_pp73
170-
target: aarch64
149+
target: [aarch64, armv7]
171150
steps:
172-
- uses: actions/checkout@v2
151+
- uses: actions/checkout@v3
173152
- name: Build Python wheels
174153
uses: messense/maturin-action@v1
175-
env:
176-
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}
177154
with:
178155
target: ${{ matrix.target }}
179156
manylinux: auto
180-
args: -i python3.9 --release --out dist --no-sdist
181-
- uses: uraimo/run-on-arch-action@v2.0.5
182-
# run-on-arch-action doesn't have ppc64 support
183-
# skipped cross compiled pypy wheel tests for now
184-
if: ${{ matrix.target != 'ppc64' && !startsWith(matrix.python.abi, 'pp') }}
157+
args: -i ${{ matrix.python }} --release --out dist
158+
- uses: uraimo/run-on-arch-action@v2.3.0
185159
name: Install Python wheels
186160
with:
187161
arch: ${{ matrix.target }}
@@ -195,77 +169,16 @@ jobs:
195169
apt-get install -y --no-install-recommends python3 python3-venv software-properties-common
196170
add-apt-repository ppa:deadsnakes/ppa
197171
apt-get update
198-
apt-get install -y curl python3.7-venv python3.9-venv python3.10-venv
172+
apt-get install -y curl python3.7-venv python3.9-venv python3.10-venv python3.11-venv
199173
run: |
200174
ls -lrth /artifacts
201-
PYTHON=python${{ matrix.python.version }}
175+
PYTHON=python${{ matrix.python }}
202176
$PYTHON -m venv venv
203177
venv/bin/pip install -U pip
204178
venv/bin/pip install fastdatetime --no-index --find-links /artifacts --force-reinstall
205179
venv/bin/python -c 'import fastdatetime'
206180
- name: Upload Python wheels
207-
uses: actions/upload-artifact@v2
208-
with:
209-
name: wheels
210-
path: dist
211-
212-
pypy-linux:
213-
runs-on: ubuntu-latest
214-
strategy:
215-
matrix:
216-
python: [
217-
{ version: pypy-3.7, abi: pp37-pypy37_pp73 },
218-
{ version: pypy-3.8, abi: pp38-pypy38_pp73 },
219-
]
220-
steps:
221-
- uses: actions/checkout@v2
222-
- uses: actions/setup-python@v2
223-
with:
224-
python-version: ${{ matrix.python.version }}
225-
- name: Build Pypy wheels
226-
uses: messense/maturin-action@v1
227-
with:
228-
target: ${{ matrix.target }}
229-
manylinux: auto
230-
args: -i /opt/python/${{ matrix.python.abi }}/bin/pypy --release --out dist --no-sdist
231-
- name: Run Pypy import check
232-
run: |
233-
pip install fastdatetime --no-index --find-links dist
234-
pypy -c "import fastdatetime"
235-
- name: Upload Pypy wheels
236-
uses: actions/upload-artifact@v2
237-
with:
238-
name: wheels
239-
path: dist
240-
241-
pypy-macos:
242-
runs-on: macos-latest
243-
strategy:
244-
matrix:
245-
python-version: [ pypy-3.7, pypy-3.8 ]
246-
steps:
247-
- uses: actions/checkout@v2
248-
- name: Install Rust toolchain
249-
uses: actions-rs/toolchain@v1
250-
with:
251-
toolchain: stable
252-
profile: minimal
253-
default: true
254-
- uses: actions/setup-python@v2
255-
with:
256-
python-version: ${{ matrix.python-version }}
257-
- name: Install maturin
258-
run: pip install maturin
259-
- name: Build Pypy wheels
260-
run: |
261-
maturin build -i $(which pypy) --release --out dist
262-
ls -l dist
263-
- name: Run Pypy import check
264-
run: |
265-
pip install fastdatetime --no-index --find-links dist
266-
pypy -c "import fastdatetime"
267-
- name: Upload Pypy wheels
268-
uses: actions/upload-artifact@v2
181+
uses: actions/upload-artifact@v3
269182
with:
270183
name: wheels
271184
path: dist
@@ -274,18 +187,18 @@ jobs:
274187
name: Release
275188
runs-on: ubuntu-latest
276189
if: "startsWith(github.ref, 'refs/tags/')"
277-
needs: [ macos, windows, linux, linux-cross, pypy-linux, pypy-macos ]
190+
needs: [ macos, windows, linux, linux-cross ]
278191
steps:
279-
- uses: actions/download-artifact@v2
192+
- uses: actions/download-artifact@v3
280193
with:
281194
name: wheels
282-
- uses: actions/setup-python@v2
195+
- uses: actions/setup-python@v4
283196
with:
284-
python-version: 3.9
197+
python-version: '3.10'
285198
- name: Publish to PyPi
286199
env:
287200
TWINE_USERNAME: __token__
288201
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
289202
run: |
290-
pip install --upgrade wheel pip setuptools twine
203+
pip install --upgrade twine
291204
twine upload --skip-existing *

Cargo.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
[package]
22
name = "fastdatetime"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition = "2021"
55

66
[lib]
77
name = "fastdatetime"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
pyo3 = {version = "~0.16", features = ["extension-module"]}
12-
chrono = "~0.4"
13-
time = {version = "~0.3", features = ["parsing", "formatting"]}
14-
time-fmt = "~0.3.7"
11+
pyo3 = {version = "~0.18.2", features = ["extension-module"]}
12+
chrono = "~0.4.24"
13+
time = {version = "~0.3.20", features = ["parsing", "formatting"]}
14+
time-fmt = "~0.3.8"
1515
time-tz = "~0.5"
1616
dtparse = "1.2.0"
1717

1818
[profile.release]
1919
lto = "fat"
2020
codegen-units = 1
2121
opt-level = 3
22-
23-
[package.metadata.maturin]
24-
python-source = "python"
25-
project-url = { homepage = "https://github.com/m1so/fastdatetime" }

pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[project]
22
name = "fastdatetime"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "Like datetime, but fast"
55
keywords = ["datetime", "parsing", "iso8601", "rfc3339"]
66
requires-python = ">=3.7"
7+
repository = "https://github.com/m1so/fastdatetime"
78
readme = "README.md"
89
classifiers = [
910
"Development Status :: 4 - Beta",
@@ -14,5 +15,8 @@ classifiers = [
1415
text = "MIT OR Apache-2.0"
1516

1617
[build-system]
17-
requires = ["maturin>=0.12,<0.13"]
18-
build-backend = "maturin"
18+
requires = ["maturin>=0.14,<0.15"]
19+
build-backend = "maturin"
20+
21+
[tool.maturin]
22+
python-source = "src"

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use chrono::format::{parse, Parsed, StrftimeItems};
22

3-
use pyo3::{once_cell::GILOnceCell, prelude::*};
3+
use pyo3::once_cell::GILOnceCell;
4+
use pyo3::prelude::*;
45
use time_fmt::parse::{
56
parse_date_time_maybe_with_zone, parse_strict_date_time_maybe_with_zone, TimeZoneSpecifier,
67
};
@@ -13,8 +14,9 @@ use interop::TryIntoPy;
1314

1415
static DEFAULT_PARSER: GILOnceCell<dtparse::Parser> = GILOnceCell::new();
1516

16-
#[pyfunction(date_string, "/", "*", dayfirst = "false", yearfirst = "false")]
17+
#[pyfunction]
1718
#[pyo3(name = "parse")]
19+
#[pyo3(signature = (date_string, /, *, dayfirst=false, yearfirst=false))]
1820
fn parse_from_py(
1921
py: Python<'_>,
2022
date_string: &str,

0 commit comments

Comments
 (0)