[med-svn] [Git][python-team/packages/python-ciso8601][upstream] New upstream version 2.3.2
Alexandre Detiste (@detiste-guest)
gitlab at salsa.debian.org
Sat Mar 8 11:08:25 GMT 2025
Alexandre Detiste pushed to branch upstream at Debian Python Team / packages / python-ciso8601
Commits:
4fe01291 by Alexandre Detiste at 2025-03-08T11:49:01+01:00
New upstream version 2.3.2
- - - - -
13 changed files:
- .circleci/config.yml
- .github/workflows/build-wheels.yml
- CHANGELOG.md
- README.rst
- benchmarking/Dockerfile
- benchmarking/perform_comparison.py
- benchmarking/tox.ini
- module.c
- pyproject.toml
- setup.py
- tests/tests.py
- tox.ini
- why_ciso8601.md
Changes:
=====================================
.circleci/config.yml
=====================================
@@ -4,14 +4,23 @@ workflows:
workflow:
jobs:
- test_python_34
+ - test_old_pythons:
+ matrix:
+ parameters:
+ python_version: ["2.7", "3.5"]
- test:
matrix:
parameters:
- python_version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
+ python_version:
+ ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
+ - test_old_pypy:
+ matrix:
+ parameters:
+ python_version: ["2.7"]
- test_pypy:
matrix:
parameters:
- python_version: ["2.7", "3.7", "3.8", "3.9", "3.10"]
+ python_version: ["3.7", "3.8", "3.9", "3.10"]
- lint-rst
- clang-format
@@ -27,7 +36,7 @@ jobs:
docker:
- image: circleci/python:3.4
- test:
+ test_old_pythons: &old_python_tests
parameters:
python_version:
type: string
@@ -39,15 +48,40 @@ jobs:
docker:
- image: cimg/python:<<parameters.python_version>>
- test_pypy:
+ test_old_pypy:
+ <<: *old_python_tests
+ docker:
+ - image: pypy:<<parameters.python_version>>
+
+ test: &tests
parameters:
python_version:
type: string
steps:
- checkout
+ - run:
+ name: Install ciso8601
+ command: |
+ python -m venv venv
+ . venv/bin/activate
+ pip install --upgrade build
+ python -m build -s
+ pip install dist/ciso8601-*.tar.gz
+ - run:
+ name: Install testing dependencies
+ command: |
+ . venv/bin/activate
+ pip install pytz
- run:
name: Test
- command: pypy setup.py test
+ command: |
+ . venv/bin/activate
+ python -m unittest
+ docker:
+ - image: cimg/python:<<parameters.python_version>>
+
+ test_pypy:
+ <<: *tests
docker:
- image: pypy:<<parameters.python_version>>
@@ -67,7 +101,7 @@ jobs:
. venv/bin/activate
rst-lint --encoding=utf-8 README.rst
docker:
- - image: cimg/python:3.12
+ - image: cimg/python:3.13
clang-format:
working_directory: ~/code
@@ -91,4 +125,4 @@ jobs:
fi
done
docker:
- - image: cimg/python:3.12
+ - image: cimg/python:3.13
=====================================
.github/workflows/build-wheels.yml
=====================================
@@ -4,19 +4,19 @@ on:
workflow_dispatch:
inputs:
requested_release_tag:
- description: 'The tag to use for this release (e.g., `v2.3.1`)'
+ description: "The tag to use for this release (e.g., `v2.3.1`)"
required: true
jobs:
sanity_check:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
- - uses: actions/setup-python at v4
+ - uses: actions/setup-python at v5
name: Install Python
with:
- python-version: '3.12'
+ python-version: "3.13"
- run: |
pip install packaging
@@ -71,7 +71,7 @@ jobs:
echo -e "release_version=${{ env.release_version }}\nrelease_tag=${{ env.release_tag }}" > release_values.txt
- name: Share normalized release values
- uses: actions/upload-artifact at v3
+ uses: actions/upload-artifact at v4
with:
name: release_values
path: release_values.txt
@@ -85,15 +85,17 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
- - name: Build wheels
- uses: closeio/cibuildwheel at v2.16.2
- env:
- CIBW_SKIP: "pp*-macosx* *-win32 *-manylinux_i686"
- CIBW_ARCHS_MACOS: x86_64 arm64 universal2
+ - name: Set up QEMU # Needed to build aarch64 wheels
+ if: runner.os == 'Linux'
+ uses: docker/setup-qemu-action at v3
+ with:
+ platforms: all
+
+ - uses: closeio/cibuildwheel at v2.20.0
- - uses: actions/upload-artifact at v3
+ - uses: actions/upload-artifact at v4
with:
path: ./wheelhouse/*.whl
@@ -102,12 +104,12 @@ jobs:
needs: [sanity_check]
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout at v3
+ - uses: actions/checkout at v4
- - uses: actions/setup-python at v4
+ - uses: actions/setup-python at v5
name: Install Python
with:
- python-version: '3.12'
+ python-version: "3.13"
- name: Get build tool
run: pip install --upgrade build
@@ -115,55 +117,6 @@ jobs:
- name: Build sdist
run: python -m build
- - uses: actions/upload-artifact at v3
+ - uses: actions/upload-artifact at v4
with:
path: dist/*.tar.gz
-
- # create_or_update_draft_release:
- # # TODO: Figure out how to do this in an idempotent way
- # name: Create or update draft release in GitHub
- # needs: [build_wheels, build_sdist, sanity_check]
- # runs-on: ubuntu-latest
- # steps:
- # - name: Get normalized release values
- # uses: actions/download-artifact at v2
- # with:
- # name: release_values
-
- # - name: Load normalized release values
- # run: |
- # xargs -a release_values.txt -l -I{} bash -c 'echo {} >> $GITHUB_ENV'
-
- # - uses: actions/create-release at v1
- # env:
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
- # with:
- # tag_name: ${{ env.release_tag }}
- # commitish: master # Default branch
- # release_name: ${{ env.release_tag }}
- # body: "" # TODO: Pull this in using `changelog-cli`
- # draft: true
-
- # upload_to_pypi:
- # name: Upload wheels to PyPI
- # needs: [build_wheels, build_sdist, sanity_check]
- # runs-on: ubuntu-latest
- # steps:
- # - uses: actions/download-artifact at v2
- # with:
- # name: artifact
- # path: dist
-
- # - uses: closeio/gh-action-pypi-publish at v1.4.2
- # with:
- # user: __token__
- # password: ${{ secrets.PYPI_PASSWORD }}
- # # repository_url: https://test.pypi.org/legacy/ # Test PyPI
-
- # create_release:
- # name: Create release in GitHub
- # needs: [upload_to_pypi]
- # runs-on: ubuntu-latest
- # steps: # TODO
- # - run: |
- # echo "We're doing a release!? ${{ github.event }}"
=====================================
CHANGELOG.md
=====================================
@@ -2,6 +2,7 @@
- [Unreleased](#unreleased)
- [2.x.x](#2xx)
+ - [Version 2.3.2](#version-232)
- [Version 2.3.1](#version-231)
- [Version 2.3.0](#version-230)
- [Version 2.2.0](#version-220)
@@ -22,10 +23,17 @@
# Unreleased
-*
+* Nil.
# 2.x.x
+## Version 2.3.2
+
+* Add support for aarch64 wheels. Thank you @bbayles!
+* Add wheels for PyPy 3.10
+* Added Python 3.13 support
+* Better error message when attempting to parse a BCE year (#156). Thanks @javiabellan
+
## Version 2.3.1
* Added Python 3.12 wheels
=====================================
README.rst
=====================================
@@ -14,7 +14,7 @@ ciso8601
``ciso8601`` converts `ISO 8601`_ or `RFC 3339`_ date time strings into Python datetime objects.
Since it's written as a C module, it is much faster than other Python libraries.
-Tested with cPython 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12.
+Tested with cPython 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.
.. _ISO 8601: https://en.wikipedia.org/wiki/ISO_8601
.. _RFC 3339: https://tools.ietf.org/html/rfc3339
@@ -81,45 +81,45 @@ Parsing a timestamp with no time zone information (e.g., ``2014-01-09T21:48:00``
.. table::
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- | Module |Python 3.12|Python 3.11|Python 3.10|Python 3.9|Relative slowdown (versus ciso8601, latest Python)|…|Python 3.8|Python 3.7| Python 2.7 |
- +================================+===========+===========+===========+==========+==================================================+=+==========+==========+===============================+
- |ciso8601 |98 nsec |90 nsec |122 nsec |122 nsec |N/A |…|118 nsec |124 nsec |134 nsec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |backports.datetime_fromisoformat|N/A |N/A |112 nsec |108 nsec |0.9x |…|106 nsec |118 nsec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |datetime (builtin) |129 nsec |132 nsec |N/A |N/A |1.3x |…|N/A |N/A |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |pendulum |N/A |180 nsec |187 nsec |186 nsec |2.0x |…|196 nsec |200 nsec |8.52 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |udatetime |695 nsec |662 nsec |674 nsec |692 nsec |7.1x |…|724 nsec |713 nsec |586 nsec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |str2date |6.86 usec |5.78 usec |6.59 usec |6.4 usec |70.0x |…|6.66 usec |6.96 usec |❌ |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |iso8601utils |N/A |N/A |N/A |8.59 usec |70.5x |…|8.6 usec |9.59 usec |11.2 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |iso8601 |10 usec |8.24 usec |8.96 usec |9.21 usec |102.2x |…|9.14 usec |9.63 usec |25.7 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |isodate |11.1 usec |8.76 usec |10.2 usec |9.76 usec |113.6x |…|9.92 usec |11 usec |44.1 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |PySO8601 |17.2 usec |13.6 usec |16 usec |15.8 usec |175.3x |…|16.1 usec |17.1 usec |17.7 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |aniso8601 |22.2 usec |17.8 usec |23.2 usec |23.1 usec |227.0x |…|24.3 usec |27.2 usec |30.7 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |zulu |23.3 usec |19 usec |22 usec |21.3 usec |237.9x |…|21.6 usec |22.7 usec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |maya |N/A |36.1 usec |42.5 usec |42.7 usec |401.6x |…|41.3 usec |44.2 usec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |python-dateutil |57.6 usec |51.4 usec |63.3 usec |62.6 usec |587.7x |…|63.7 usec |67.3 usec |119 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |arrow |62 usec |54 usec |65.5 usec |65.7 usec |633.0x |…|66.6 usec |70.2 usec |78.8 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |metomi-isodatetime |1.29 msec |1.33 msec |1.76 msec |1.77 msec |13201.1x |…|1.79 msec |1.91 msec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |moment |1.81 msec |1.65 msec |1.75 msec |1.79 msec |18474.8x |…|1.78 msec |1.84 msec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
-
-ciso8601 takes 98 nsec, which is **1.3x faster than datetime (builtin)**, the next fastest Python 3.12 parser in this comparison.
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ | Module |Python 3.13|Python 3.12|Python 3.11|Python 3.10|Relative slowdown (versus ciso8601, latest Python)|…|Python 3.9|Python 3.8|
+ +================================+===========+===========+===========+===========+==================================================+=+==========+==========+
+ |ciso8601 |64.8 nsec |62.8 nsec |60.1 nsec |91.7 nsec |N/A |…|86 nsec |92.9 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |backports.datetime_fromisoformat|N/A |N/A |N/A |73.6 nsec |0.8x |…|70 nsec |75.9 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |datetime (builtin) |147 nsec |138 nsec |123 nsec |N/A |2.3x |…|N/A |N/A |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |pendulum |171 nsec |181 nsec |175 nsec |214 nsec |2.6x |…|179 nsec |180 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |udatetime |542 nsec |563 nsec |525 nsec |555 nsec |8.4x |…|551 nsec |553 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |str2date |3.29 usec |3.53 usec |3.52 usec |3.85 usec |50.8x |…|3.72 usec |3.9 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |iso8601utils |N/A |N/A |N/A |N/A |56.9x |…|4.89 usec |4.89 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |iso8601 |5.1 usec |5.4 usec |5.18 usec |5.38 usec |78.8x |…|5.36 usec |5.55 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |isodate |5.76 usec |5.85 usec |5.21 usec |5.91 usec |89.0x |…|5.97 usec |6.07 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |PySO8601 |10 usec |11.5 usec |7.99 usec |10.9 usec |155.0x |…|9.83 usec |9.81 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |aniso8601 |12.1 usec |12.5 usec |11.1 usec |15.1 usec |186.9x |…|15.4 usec |15.6 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |zulu |12.3 usec |13.6 usec |12.6 usec |14.2 usec |189.4x |…|14.5 usec |14.2 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |maya |35.9 usec |N/A |40.6 usec |46.7 usec |554.3x |…|45.4 usec |46.3 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |python-dateutil |36.2 usec |36.9 usec |36.1 usec |44 usec |558.5x |…|46.4 usec |45.2 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |arrow |42.9 usec |43.8 usec |41.2 usec |48.8 usec |662.7x |…|50.7 usec |50.1 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |metomi-isodatetime |828 usec |822 usec |791 usec |1.09 msec |12781.0x |…|1.1 msec |1.11 msec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |moment |1.28 msec |1.32 msec |1.29 msec |1.36 msec |19696.9x |…|1.37 msec |1.34 msec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+
+ciso8601 takes 64.8 nsec, which is **2.3x faster than datetime (builtin)**, the next fastest Python 3.13 parser in this comparison.
.. </include:benchmark_with_no_time_zone.rst>
@@ -129,70 +129,70 @@ Parsing a timestamp with time zone information (e.g., ``2014-01-09T21:48:00-05:3
.. table::
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- | Module |Python 3.12|Python 3.11|Python 3.10|Python 3.9|Relative slowdown (versus ciso8601, latest Python)|…|Python 3.8|Python 3.7| Python 2.7 |
- +================================+===========+===========+===========+==========+==================================================+=+==========+==========+===============================+
- |ciso8601 |95 nsec |96.8 nsec |128 nsec |123 nsec |N/A |…|125 nsec |125 nsec |140 nsec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |backports.datetime_fromisoformat|N/A |N/A |147 nsec |149 nsec |1.1x |…|138 nsec |149 nsec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |datetime (builtin) |198 nsec |207 nsec |N/A |N/A |2.1x |…|N/A |N/A |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |pendulum |N/A |225 nsec |214 nsec |211 nsec |2.3x |…|219 nsec |224 nsec |13.5 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |udatetime |799 nsec |803 nsec |805 nsec |830 nsec |8.4x |…|827 nsec |805 nsec |768 nsec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |str2date |7.73 usec |6.75 usec |7.78 usec |7.8 usec |81.4x |…|7.74 usec |8.13 usec |❌ |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |iso8601 |13.7 usec |11.3 usec |12.7 usec |12.5 usec |143.8x |…|12.4 usec |12.6 usec |31.1 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |isodate |13.7 usec |11.3 usec |12.9 usec |12.7 usec |144.0x |…|12.7 usec |13.9 usec |46.7 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |iso8601utils |N/A |N/A |N/A |21.4 usec |174.9x |…|22.1 usec |23.4 usec |28.3 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |PySO8601 |25.1 usec |20.4 usec |23.2 usec |23.8 usec |263.8x |…|23.5 usec |24.8 usec |25.3 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |zulu |26.3 usec |21.4 usec |25.7 usec |24 usec |277.2x |…|24.5 usec |25.3 usec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |aniso8601 |27.7 usec |23.7 usec |30.3 usec |30 usec |291.3x |…|31.6 usec |33.8 usec |39.2 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |maya |N/A |36 usec |41.3 usec |41.8 usec |372.0x |…|42.4 usec |42.7 usec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |python-dateutil |70.7 usec |65.1 usec |77.9 usec |80.2 usec |744.0x |…|79.4 usec |83.6 usec |100 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |arrow |73 usec |62.8 usec |74.5 usec |73.9 usec |768.6x |…|75.1 usec |80 usec |148 usec |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |metomi-isodatetime |1.22 msec |1.25 msec |1.72 msec |1.72 msec |12876.3x |…|1.76 msec |1.83 msec |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
- |moment |❌ |❌ |❌ |❌ |2305822.8x |…|❌ |❌ |N/A |
- +--------------------------------+-----------+-----------+-----------+----------+--------------------------------------------------+-+----------+----------+-------------------------------+
-
-ciso8601 takes 95 nsec, which is **2.1x faster than datetime (builtin)**, the next fastest Python 3.12 parser in this comparison.
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ | Module |Python 3.13|Python 3.12|Python 3.11|Python 3.10|Relative slowdown (versus ciso8601, latest Python)|…|Python 3.9|Python 3.8|
+ +================================+===========+===========+===========+===========+==================================================+=+==========+==========+
+ |ciso8601 |73.9 nsec |71 nsec |65.6 nsec |97.5 nsec |N/A |…|92.9 nsec |96.6 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |backports.datetime_fromisoformat|N/A |N/A |N/A |99.2 nsec |1.0x |…|93 nsec |99.4 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |datetime (builtin) |205 nsec |198 nsec |178 nsec |N/A |2.8x |…|N/A |N/A |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |pendulum |251 nsec |259 nsec |251 nsec |262 nsec |3.4x |…|264 nsec |264 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |udatetime |684 nsec |700 nsec |646 nsec |684 nsec |9.3x |…|688 nsec |676 nsec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |str2date |5.95 usec |4.34 usec |4.11 usec |4.58 usec |80.5x |…|4.6 usec |4.82 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |iso8601 |7.68 usec |8.56 usec |7.62 usec |7.99 usec |103.9x |…|7.83 usec |8.16 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |isodate |7.77 usec |8.53 usec |7.54 usec |7.88 usec |105.0x |…|8.12 usec |8.4 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |iso8601utils |N/A |N/A |N/A |N/A |152.2x |…|14.1 usec |14.6 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |zulu |17.8 usec |16.9 usec |15.7 usec |17.3 usec |241.3x |…|17.3 usec |17.6 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |aniso8601 |18 usec |18.7 usec |16.4 usec |21.5 usec |243.1x |…|22.5 usec |22.8 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |PySO8601 |18.3 usec |16.6 usec |14.3 usec |15.8 usec |247.5x |…|16.2 usec |16.4 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |maya |46.2 usec |N/A |41 usec |47.5 usec |625.0x |…|45.2 usec |47 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |python-dateutil |47.1 usec |48.2 usec |47.1 usec |57.3 usec |636.5x |…|60.4 usec |58.9 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |arrow |57.7 usec |53.8 usec |50.8 usec |60.2 usec |780.2x |…|59.4 usec |60.1 usec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |metomi-isodatetime |876 usec |823 usec |795 usec |1.09 msec |11846.4x |…|1.09 msec |1.13 msec |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+ |moment |❌ |❌ |❌ |❌ |2070678.8x |…|❌ |❌ |
+ +--------------------------------+-----------+-----------+-----------+-----------+--------------------------------------------------+-+----------+----------+
+
+ciso8601 takes 73.9 nsec, which is **2.8x faster than datetime (builtin)**, the next fastest Python 3.13 parser in this comparison.
.. </include:benchmark_with_time_zone.rst>
.. <include:benchmark_module_versions.rst>
-Tested on Linux 5.15.49-linuxkit using the following modules:
+Tested on Linux 6.11.5-orbstack-00280-g96d99c92a42b using the following modules:
.. code:: python
aniso8601==9.0.1
- arrow==1.3.0 (on Python 3.8, 3.9, 3.10, 3.11, 3.12), arrow==1.2.3 (on Python 3.7), arrow==0.17.0 (on Python 2.7)
- backports.datetime_fromisoformat==2.0.1
- ciso8601==2.3.0
- iso8601==2.1.0 (on Python 3.8, 3.9, 3.10, 3.11, 3.12), iso8601==0.1.16 (on Python 2.7)
+ arrow==1.3.0
+ backports.datetime_fromisoformat==2.0.2
+ ciso8601==2.3.1
+ iso8601==2.1.0
iso8601utils==0.1.2
- isodate==0.6.1
+ isodate==0.7.2
maya==0.6.1
metomi-isodatetime==1!3.1.0
moment==0.12.1
- pendulum==2.1.2
+ pendulum==3.0.0
PySO8601==0.2.0
- python-dateutil==2.8.2
+ python-dateutil==2.9.0.post0
str2date==0.905
udatetime==0.0.17
- zulu==2.0.0
+ zulu==2.0.1
.. </include:benchmark_module_versions.rst>
=====================================
benchmarking/Dockerfile
=====================================
@@ -8,21 +8,24 @@ RUN apt-get update && \
# Install the other dependencies
RUN apt-get install -y git curl gcc build-essential
+# Install the Rust toolchain for `pendulum`
+RUN curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y
+
# Install tzdata non-iteractively
# https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive/44333806#44333806
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
# Install the Python versions
-RUN apt install -y python2 python2-dev && \
- apt install -y python3.7 python3.7-dev python3.7-venv && \
+RUN apt install -y python3.7 python3.7-dev python3.7-venv && \
apt install -y python3.8 python3.8-dev python3.8-venv && \
apt install -y python3.9 python3.9-dev python3.9-venv && \
apt install -y python3.10 python3.10-dev python3.10-venv && \
apt install -y python3.11 python3.11-dev python3.11-venv && \
- apt install -y python3.12 python3.12-dev python3.12-venv
+ apt install -y python3.12 python3.12-dev python3.12-venv && \
+ apt install -y python3.13 python3.13-dev python3.13-venv
-# Make Python 3.12 the default `python`
-RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 10
+# Make Python 3.13 the default `python`
+RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 10
# Get pip
RUN python -m ensurepip --upgrade
@@ -41,4 +44,4 @@ RUN git clone https://github.com/closeio/ciso8601.git && \
chmod +x /ciso8601/benchmarking/run_benchmarks.sh
WORKDIR /ciso8601/benchmarking
-ENTRYPOINT ./run_benchmarks.sh
+ENTRYPOINT ["bash", "./run_benchmarks.sh"]
=====================================
benchmarking/perform_comparison.py
=====================================
@@ -23,6 +23,7 @@ ISO_8601_MODULES = {
"python-dateutil": ("import dateutil.parser", "dateutil.parser.parse('{timestamp}')"),
"iso8601": ("import iso8601", "iso8601.parse_date('{timestamp}')"),
"isodate": ("import isodate", "isodate.parse_datetime('{timestamp}')"),
+ "pendulum": ("from pendulum.parsing import parse_iso8601", "parse_iso8601('{timestamp}')"),
"PySO8601": ("import PySO8601", "PySO8601.parse('{timestamp}')"),
"str2date": ("from str2date import str2date", "str2date('{timestamp}')"),
}
@@ -59,15 +60,10 @@ if (sys.version_info.major, sys.version_info.minor) != (3, 4):
# `arrow` no longer supports Python 3.4
ISO_8601_MODULES["arrow"] = ("import arrow", "arrow.get('{timestamp}').datetime")
-if sys.version_info.major >= 3 and (sys.version_info.major, sys.version_info.minor) < (3, 12):
+if sys.version_info.major >= 3:
# `maya` uses a version of `regex` which no longer supports Python 2
- # `maya` uses `pendulum`, which doesn't yet support Python 3.12
ISO_8601_MODULES["maya"] = ("import maya", "maya.parse('{timestamp}').datetime()")
-if (sys.version_info.major, sys.version_info.minor) < (3, 12):
- # `pendulum` doesn't yet support Python 3.12
- ISO_8601_MODULES["pendulum"] = ("from pendulum.parsing import parse_iso8601", "parse_iso8601('{timestamp}')")
-
if (sys.version_info.major, sys.version_info.minor) >= (3, 5):
# `moment` is built on `times`, which is built on `arrow`, which no longer supports Python 3.4
# `moment` uses a version of `regex` which no longer supports Python 2
@@ -168,7 +164,7 @@ def run_tests(timestamp, results_directory, compare_to):
auto_range_count_filepath = os.path.join(results_directory, "auto_range_counts.csv")
test_interation_counts = auto_range_counts(auto_range_count_filepath)
- exec(ISO_8601_MODULES[compare_to][0])
+ exec(ISO_8601_MODULES[compare_to][0], globals())
expected_parse_result = eval(ISO_8601_MODULES[compare_to][1].format(timestamp=timestamp))
results = []
@@ -178,7 +174,7 @@ def run_tests(timestamp, results_directory, compare_to):
time_taken = None
exception = None
try:
- exec(setup)
+ exec(setup, globals())
parse_result = eval(stmt.format(timestamp=timestamp))
timer = timeit.Timer(stmt=stmt.format(timestamp=timestamp), setup=setup)
=====================================
benchmarking/tox.ini
=====================================
@@ -1,7 +1,7 @@
[tox]
requires =
tox>=4
-envlist = py312,py311,py310,py39,py38,py37
+envlist = py313,py312,py311,py310,py39,py38
setupdir=..
[testenv]
@@ -26,14 +26,12 @@ deps=
iso8601utils; python_version != '3.6' and python_version != '3.10'
isodate
; `maya` uses a version of `regex` which no longer supports Python 2
- ; `maya` uses `pendulum`, which doesn't yet support Python 3.12
- maya; python_version > '3' and python_version < '3.12'
+ maya; python_version > '3'
metomi-isodatetime; python_version >= '3.5'
; `moment` is built on `times`, which is built on `arrow`, which no longer supports Python 3.4
; `moment` uses a version of `regex` which no longer supports Python 2
moment; python_version >= '3.5'
- ; `pendulum` doesn't yet support Python 3.12
- pendulum; python_version < '3.12'
+ pendulum
pyso8601
python-dateutil
str2date
=====================================
module.c
=====================================
@@ -124,6 +124,14 @@ format_unexpected_character_exception(char *field_name, const char *c,
field_name, expected_character_count,
(expected_character_count != 1) ? "s" : "");
}
+ else if (*c == '-' && index == 0 && strcmp(field_name, "year") == 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "Invalid character while parsing %s ('-', Index: 0). "
+ "While valid ISO 8601 years, BCE years are not supported by "
+ "Python's `datetime` objects.",
+ field_name);
+ }
else {
#if PY_VERSION_AT_LEAST_33
PyObject *unicode_str = PyUnicode_FromString(c);
=====================================
pyproject.toml
=====================================
@@ -8,3 +8,27 @@ ignore = ["E501"]
in-place = true
recursive = true
aggressive = 3
+
+[tool.cibuildwheel]
+build = [
+ "cp38-*",
+ "cp39-*",
+ "cp310-*",
+ "cp311-*",
+ "cp312-*",
+ "pp38-*",
+ "pp39-*",
+ "pp310-*",
+]
+
+[tool.cibuildwheel.linux]
+archs = ["x86_64", "aarch64"]
+
+[tool.cibuildwheel.macos]
+archs = ["x86_64", "universal2", "arm64"]
+environment = { MACOSX_DEPLOYMENT_TARGET="11.0" }
+skip = ["pp*"]
+
+[tool.cibuildwheel.windows]
+archs = ["AMD64"]
+skip = ["pp*-win*", "*-win3"]
=====================================
setup.py
=====================================
@@ -31,7 +31,7 @@ if os.environ.get("STRICT_WARNINGS", "0") == "1":
os.environ["_CL_"] = ""
os.environ["_CL_"] += " /WX"
-VERSION = "2.3.1"
+VERSION = "2.3.2"
CISO8601_CACHING_ENABLED = int(os.environ.get('CISO8601_CACHING_ENABLED', '1') == '1')
setup(
@@ -74,6 +74,7 @@ setup(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
=====================================
tests/tests.py
=====================================
@@ -446,6 +446,17 @@ class InvalidTimestampTestCase(unittest.TestCase):
"20140102T01:02:03",
)
+ def test_bce_years(self):
+ """
+ These are technically valid ISO 8601 datetimes.
+ However, cPython cannot support values non-positive year values
+ """
+ self.assertRaisesRegex(
+ ValueError,
+ r"Invalid character while parsing year \('-', Index: 0\). While valid ISO 8601 years, BCE years are not supported by Python's `datetime` objects.",
+ parse_datetime,
+ "-2014-01-02",
+ )
class Rfc3339TestCase(unittest.TestCase):
def test_valid_rfc3339_timestamps(self):
=====================================
tox.ini
=====================================
@@ -1,7 +1,7 @@
[tox]
requires =
tox>=4
-envlist = {py27,py34,py35,py36,py37,py38,py39,py310,py311,py312}-caching_{enabled,disabled}
+envlist = {py313,py312,py311,py310,py39,py38}-caching_{enabled,disabled}
[testenv]
package = sdist
@@ -11,5 +11,4 @@ setenv =
caching_disabled: CISO8601_CACHING_ENABLED = 0
deps =
pytz
- nose
-commands=nosetests
+commands=python -m unittest
=====================================
why_ciso8601.md
=====================================
@@ -29,9 +29,9 @@ graph TD;
H--yes-->V;
H--no-->Z;
- V[Use `backports.datetime_fromisoformat`]
- Y[Use `ciso8601`]
- Z[Use `datetime.fromisoformat`]
+ V[Use backports.datetime_fromisoformat]
+ Y[Use ciso8601]
+ Z[Use datetime.fromisoformat]
```
## Do you care about the performance of timestamp parsing?
View it on GitLab: https://salsa.debian.org/python-team/packages/python-ciso8601/-/commit/4fe01291ef0780451a24500e0928788ee1e0fd33
--
View it on GitLab: https://salsa.debian.org/python-team/packages/python-ciso8601/-/commit/4fe01291ef0780451a24500e0928788ee1e0fd33
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250308/3f8fc584/attachment-0001.htm>
More information about the debian-med-commit
mailing list