[Git][debian-gis-team/cftime][upstream] New upstream version 1.6.3

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Fri Oct 20 05:19:14 BST 2023



Bas Couwenberg pushed to branch upstream at Debian GIS Project / cftime


Commits:
da19348a by Bas Couwenberg at 2023-10-20T06:10:22+02:00
New upstream version 1.6.3
- - - - -


15 changed files:

- .github/workflows/cibuildwheel.yml
- .github/workflows/deploy-docs.yml
- .github/workflows/publish.yml
- .github/workflows/tests_conda.yml
- .github/workflows/tests_latest.yml
- Changelog
- README.md
- docs/conf.py
- pyproject.toml
- requirements-dev.txt
- requirements.txt
- setup.py
- src/cftime/_cftime.pyx
- src/cftime/_strptime.py
- test/test_cftime.py


Changes:

=====================================
.github/workflows/cibuildwheel.yml
=====================================
@@ -29,12 +29,12 @@ jobs:
           arch: AMD64
 
     steps:
-    - uses: actions/checkout at v3
+    - uses: actions/checkout at v4
       with:
         fetch-depth: 0
 
     - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels"
-      uses: pypa/cibuildwheel at v2.9.0
+      uses: pypa/cibuildwheel at v2.15.0
       env:
         # Skips pypy and musllinux for now.
         CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*"


=====================================
.github/workflows/deploy-docs.yml
=====================================
@@ -11,31 +11,33 @@ jobs:
 
     steps:
     - name: checkout
-      uses: actions/checkout at v3
+      uses: actions/checkout at v4
       with:
         fetch-depth: 0
 
     - name: Setup Mamba
-      uses: mamba-org/provision-with-micromamba at main
+      uses: mamba-org/setup-micromamba at v1
       with:
-        environment-file: false
+        environment-name: TEST
+        create-args: >-
+          python=3
+          numpy>1.13.3
+          sphinx
 
     - name: Build environment
       shell: bash -l {0}
       run: |
-        micromamba create --name TEST python=3 --file requirements.txt --file requirements-dev.txt --channel conda-forge
-        micromamba activate TEST
         python -m pip install -e . --no-deps --force-reinstall
 
     - name: Get the version
+      shell: bash -l {0}
       id: get_version
-      run: echo ::set-output name=VERSION::$(python setup.py --version)
+      run: echo "name=VERSION::$(python setup.py --version)" >> $GITHUB_OUTPUT
 
     - name: Build documentation
       shell: bash -l {0}
       run: |
         set -e
-        micromamba activate TEST
         pushd docs
         make html linkcheck O=-W
         popd


=====================================
.github/workflows/publish.yml
=====================================
@@ -6,7 +6,7 @@ jobs:
   packages:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout at v3
+    - uses: actions/checkout at v4
 
     - name: Set up Python
       uses: actions/setup-python at v4


=====================================
.github/workflows/tests_conda.yml
=====================================
@@ -11,7 +11,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: [ "3.7", "3.8", "3.9", "3.10" ]
+        python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
         os: [windows-latest, ubuntu-latest, macos-latest]
         platform: [x64, x32]
         exclude:
@@ -19,22 +19,25 @@ jobs:
             platform: x32
 
     steps:
-    - uses: actions/checkout at v3
+    - uses: actions/checkout at v4
 
-    - name: Setup Mamba
-      uses: mamba-org/provision-with-micromamba at main
+    - name: Setup micromamba Env
+      uses: mamba-org/setup-micromamba at v1
       with:
-        environment-file: false
+        environment-name: TEST
+        create-args: >-
+          python=${{ matrix.python-version }}
+          numpy>1.13.3
+          cython>=0.29.20
+          pytest
+          pytest-cov
 
-    - name: Setup micromamba Env
+    - name: Install cftime
       shell: bash -l {0}
       run: |
-        micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge
-        micromamba activate TEST
         pip install -v -e  . --no-deps --force-reinstall
 
     - name: Run Tests
       shell: bash -l {0}
       run: |
-        micromamba activate TEST
         pytest -vv test


=====================================
.github/workflows/tests_latest.yml
=====================================
@@ -6,10 +6,10 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: ["3.11-dev"]
+        python-version: ["3.12-dev"]
     steps:
 
-    - uses: actions/checkout at v3
+    - uses: actions/checkout at v4
 
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python at v4


=====================================
Changelog
=====================================
@@ -1,3 +1,11 @@
+version 1.6.3 (release tag v1.6.3rel)
+=====================================
+ * add support for formats without separators in strptime (e.g. '20200229', issue #301).
+   This required removing support for > 4 digit years.
+ * set the c_api_binop_methods compiler directive to True to retain Cython 0.x
+   behavior for arithmetic operators for Cython >= 3.0.0 (issue #271).
+ * support for python 3.12.
+
 version 1.6.2 (release tag v1.6.2rel)
 =====================================
  * num2date should not fail on an empty integer array (issue #287).


=====================================
README.md
=====================================
@@ -11,6 +11,8 @@ Time-handling functionality from netcdf4-python
 
 ## News
 For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).
+
+10/20/2023:  Version 1.6.3 released.  Support for python 3.12, cython 3.0, strptime formats without separators.
  
 9/18/2022:  Version 1.6.2 released.  strptime method added, fix for num2date failure on
 empty integer array, date2num 'longdouble' keyword added. New wheel building workflow.


=====================================
docs/conf.py
=====================================
@@ -162,4 +162,4 @@ texinfo_documents = [
 # -- Options for intersphinx extension ---------------------------------------
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'https://docs.python.org/': None}
+intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}


=====================================
pyproject.toml
=====================================
@@ -1,3 +1,3 @@
 [build-system]
-requires = ["setuptools>=41.2", "cython", "wheel", "oldest-supported-numpy"]
+requires = ["setuptools>=41.2", "cython>=0.29.20", "wheel", "oldest-supported-numpy; python_version<'3.12.0.rc1'", "numpy>=1.26.0b1; python_version>='3.12.0.rc1'"]
 build-backend = "setuptools.build_meta"


=====================================
requirements-dev.txt
=====================================
@@ -1,7 +1,7 @@
 check-manifest
 coverage
 coveralls
-cython>0.26.1
+cython>=0.29.20
 pytest
 pytest-cov
 sphinx


=====================================
requirements.txt
=====================================
@@ -1 +1,2 @@
-numpy>1.13.3
+numpy>1.13.3; python_version<'3.12.0.rc1'
+numpy>=1.26.0b1; python_version>='3.12.0.rc1'


=====================================
setup.py
=====================================
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
 import os
 import sys
 import numpy
@@ -16,7 +14,20 @@ except ImportError:
 BASEDIR = os.path.abspath(os.path.dirname(__file__))
 SRCDIR = os.path.join(BASEDIR,'src')
 CMDS_NOCYTHONIZE = ['clean','clean_cython','sdist']
-COMPILER_DIRECTIVES = {}
+COMPILER_DIRECTIVES = {
+    # Cython 3.0.0 changes the default of the c_api_binop_methods directive to
+    # False, resulting in errors in datetime and timedelta arithmetic:
+    # https://github.com/Unidata/cftime/issues/271.  We explicitly set it to
+    # True to retain Cython 0.x behavior for future Cython versions.  This
+    # directive was added in Cython version 0.29.20.
+    "c_api_binop_methods": True
+}
+COVERAGE_COMPILER_DIRECTIVES = {
+    "linetrace": True,
+    "warn.maybe_uninitialized": False,
+    "warn.unreachable": False,
+    "warn.unused": False,
+}
 DEFINE_MACROS = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] 
 FLAG_COVERAGE = '--cython-coverage'  # custom flag enabling Cython line tracing
 NAME = 'cftime'
@@ -74,10 +85,9 @@ def description():
 
 if ((FLAG_COVERAGE in sys.argv or os.environ.get('CYTHON_COVERAGE', None))
     and cythonize):
-    COMPILER_DIRECTIVES = {'linetrace': True,
-                           'warn.maybe_uninitialized': False,
-                           'warn.unreachable': False,
-                           'warn.unused': False}
+    COMPILER_DIRECTIVES = {
+        **COMPILER_DIRECTIVES, **COVERAGE_COMPILER_DIRECTIVES
+    }
     DEFINE_MACROS += [('CYTHON_TRACE', '1'),
                      ('CYTHON_TRACE_NOGIL', '1')]
     if FLAG_COVERAGE in sys.argv:
@@ -113,7 +123,7 @@ setup(
     install_requires=load('requirements.txt'),
     tests_require=load('requirements-dev.txt'),
     license='License :: OSI Approved :: MIT License',
-    python_requires=">=3.7",
+    python_requires=">=3.8",
     classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Operating System :: MacOS :: MacOS X',
@@ -121,10 +131,11 @@ setup(
         'Operating System :: POSIX :: Linux',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
+        'Programming Language :: Python :: 3.12',
         'Topic :: Scientific/Engineering',
         'License :: OSI Approved :: MIT License'],
     )


=====================================
src/cftime/_cftime.pyx
=====================================
@@ -37,7 +37,7 @@ cdef int[12] _dayspermonth_leap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 3
 cdef int[13] _cumdayspermonth = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]
 cdef int[13] _cumdayspermonth_leap = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]
 
-__version__ = '1.6.2'
+__version__ = '1.6.3'
 
 # Adapted from http://delete.me.uk/2005/03/iso8601.html
 # Note: This regex ensures that all ISO8601 timezone formats are accepted - but, due to legacy support for other timestrings, not all incorrect formats can be rejected.
@@ -1051,7 +1051,7 @@ This class mimics datetime.datetime but support calendars other than the prolept
 Gregorian calendar.
 
 Supports timedelta operations by overloading +/-, and
-comparisons with other instances using the same calendar.
+comparisons with other instances (even if they use different calendars).
 
 Comparison with native python datetime instances is possible
 for cftime.datetime instances using


=====================================
src/cftime/_strptime.py
=====================================
@@ -30,8 +30,10 @@ class TimeRE(dict):
             'M': r"(?P<M>[0-5]\d|\d)",
             'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
             'y': r"(?P<y>\d\d)",
-#           'Y': r"(?P<Y>\d\d\d\d)",
-            'Y': r"(?P<Y>[+-]?[0-9]+)", # handle neg and > 4 digits
+            'Y': r"(?P<Y>[+-]?\d\d\d\d)", # 4 digit years, pos or neg
+# the next one allows for > 4 digit years, but doesn't work without separators
+# (e.g. '%Y%m%d%H', see issue #301)
+#           'Y': r"(?P<Y>[+-]?[0-9]+)", # handle neg and > 4 digits
             'B': self.__seqToRE(month_name[1:], 'B'),
             'b': self.__seqToRE(month_abbr[1:], 'b'),
             '%': '%'})


=====================================
test/test_cftime.py
=====================================
@@ -1108,7 +1108,7 @@ class TestDate2index(unittest.TestCase):
         units = 'microseconds since 1776-07-04 00:00:00-12:00'
         dates = [datetime(1962, 10, 27, 6, 1, 30, 9001),
                  datetime(1993, 11, 21, 12, 5, 25, 999),
-                 datetime(1995, 11, 25, 18, 7, 59, 999999)]
+                 datetime(1995, 11, 25, 18, 7, 59, 9999)]
         times2 = date2num(dates, units)
         dates2 = num2date(times2, units)
         datediff = abs(dates-dates2)
@@ -1711,9 +1711,11 @@ def test_strptime():
     d = cftime.datetime.strptime("0000-02-30",\
              "%Y-%m-%d",calendar='360_day',has_year_zero=True)
     assert(repr(d) == "cftime.datetime(0, 2, 30, 0, 0, 0, 0, calendar='360_day', has_year_zero=True)")
-    d = cftime.datetime.strptime('-99999-02-29 10:18:32.926',\
+    d = cftime.datetime.strptime('-9999-02-29 10:18:32.926',\
              '%Y-%m-%d %H:%M:%S.%f',calendar='366_day')
-    assert(repr(d) == "cftime.datetime(-99999, 2, 29, 10, 18, 32, 926000, calendar='all_leap', has_year_zero=True)")
+    assert(repr(d) == "cftime.datetime(-9999, 2, 29, 10, 18, 32, 926000, calendar='all_leap', has_year_zero=True)")
+    d = cftime.datetime.strptime("20200230", "%Y%m%d", "360_day") # no separator, issue #301
+    assert(repr(d) == "cftime.datetime(2020, 2, 30, 0, 0, 0, 0, calendar='360_day', has_year_zero=True)")
     d = cftime.datetime.strptime('24/Aug/-4712:17:57:26', '%d/%b/%Y:%H:%M:%S',calendar='julian')
     assert(repr(d) == "cftime.datetime(-4712, 8, 24, 17, 57, 26, 0, calendar='julian', has_year_zero=False)")
     d = cftime.datetime.strptime('24/August/-4712:17:57:26', '%d/%B/%Y:%H:%M:%S',calendar='julian')
@@ -2183,8 +2185,8 @@ def test_date2num_unrecognized_units(units, match):
 
 
 def test_num2date_precision():
-    if sys.platform.startswith("win"):
-        pytest.skip("skipping tests that require float128 on windows")
+    if np.finfo(np.longdouble).precision < 18:
+        pytest.skip("skipping tests that require extended precision longdouble type")
     testdates = [(1271, 3, 18, 19, 41, 33),
                  (1271, 3, 18, 19, 41, 32, 999998)]
     unitinc = ['microseconds', 'seconds', 'minutes', 'hours', 'days']



View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/-/commit/da19348a04aa17247aeb7d72f18e40261769ee85

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/-/commit/da19348a04aa17247aeb7d72f18e40261769ee85
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/pkg-grass-devel/attachments/20231020/ef40c01a/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list