cftime 1.6.2__tar.gz → 1.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,11 @@
1
+ version 1.6.3 (release tag v1.6.3rel)
2
+ =====================================
3
+ * add support for formats without separators in strptime (e.g. '20200229', issue #301).
4
+ This required removing support for > 4 digit years.
5
+ * set the c_api_binop_methods compiler directive to True to retain Cython 0.x
6
+ behavior for arithmetic operators for Cython >= 3.0.0 (issue #271).
7
+ * support for python 3.12.
8
+
1
9
  version 1.6.2 (release tag v1.6.2rel)
2
10
  =====================================
3
11
  * num2date should not fail on an empty integer array (issue #287).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cftime
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: Time-handling functionality from netcdf4-python
5
5
  Author: Jeff Whitaker
6
6
  Author-email: jeffrey.s.whitaker@noaa.gov
@@ -11,13 +11,14 @@ Classifier: Operating System :: Microsoft :: Windows
11
11
  Classifier: Operating System :: POSIX :: Linux
12
12
  Classifier: Programming Language :: Python
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.7
15
14
  Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
18
19
  Classifier: Topic :: Scientific/Engineering
19
20
  Classifier: License :: OSI Approved :: MIT License
20
- Requires-Python: >=3.7
21
+ Requires-Python: >=3.8
21
22
  Description-Content-Type: text/markdown
22
23
  License-File: LICENSE
23
24
 
@@ -34,6 +35,8 @@ Time-handling functionality from netcdf4-python
34
35
 
35
36
  ## News
36
37
  For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).
38
+
39
+ 10/20/2023: Version 1.6.3 released. Support for python 3.12, cython 3.0, strptime formats without separators.
37
40
 
38
41
  9/18/2022: Version 1.6.2 released. strptime method added, fix for num2date failure on
39
42
  empty integer array, date2num 'longdouble' keyword added. New wheel building workflow.
@@ -11,6 +11,8 @@ Time-handling functionality from netcdf4-python
11
11
 
12
12
  ## News
13
13
  For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).
14
+
15
+ 10/20/2023: Version 1.6.3 released. Support for python 3.12, cython 3.0, strptime formats without separators.
14
16
 
15
17
  9/18/2022: Version 1.6.2 released. strptime method added, fix for num2date failure on
16
18
  empty integer array, date2num 'longdouble' keyword added. New wheel building workflow.
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ 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'"]
3
+ build-backend = "setuptools.build_meta"
@@ -1,7 +1,7 @@
1
1
  check-manifest
2
2
  coverage
3
3
  coveralls
4
- cython>0.26.1
4
+ cython>=0.29.20
5
5
  pytest
6
6
  pytest-cov
7
7
  sphinx
@@ -0,0 +1,2 @@
1
+ numpy>1.13.3; python_version<'3.12.0.rc1'
2
+ numpy>=1.26.0b1; python_version>='3.12.0.rc1'
@@ -1,5 +1,3 @@
1
- from __future__ import print_function
2
-
3
1
  import os
4
2
  import sys
5
3
  import numpy
@@ -16,7 +14,20 @@ except ImportError:
16
14
  BASEDIR = os.path.abspath(os.path.dirname(__file__))
17
15
  SRCDIR = os.path.join(BASEDIR,'src')
18
16
  CMDS_NOCYTHONIZE = ['clean','clean_cython','sdist']
19
- COMPILER_DIRECTIVES = {}
17
+ COMPILER_DIRECTIVES = {
18
+ # Cython 3.0.0 changes the default of the c_api_binop_methods directive to
19
+ # False, resulting in errors in datetime and timedelta arithmetic:
20
+ # https://github.com/Unidata/cftime/issues/271. We explicitly set it to
21
+ # True to retain Cython 0.x behavior for future Cython versions. This
22
+ # directive was added in Cython version 0.29.20.
23
+ "c_api_binop_methods": True
24
+ }
25
+ COVERAGE_COMPILER_DIRECTIVES = {
26
+ "linetrace": True,
27
+ "warn.maybe_uninitialized": False,
28
+ "warn.unreachable": False,
29
+ "warn.unused": False,
30
+ }
20
31
  DEFINE_MACROS = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
21
32
  FLAG_COVERAGE = '--cython-coverage' # custom flag enabling Cython line tracing
22
33
  NAME = 'cftime'
@@ -74,10 +85,9 @@ def description():
74
85
 
75
86
  if ((FLAG_COVERAGE in sys.argv or os.environ.get('CYTHON_COVERAGE', None))
76
87
  and cythonize):
77
- COMPILER_DIRECTIVES = {'linetrace': True,
78
- 'warn.maybe_uninitialized': False,
79
- 'warn.unreachable': False,
80
- 'warn.unused': False}
88
+ COMPILER_DIRECTIVES = {
89
+ **COMPILER_DIRECTIVES, **COVERAGE_COMPILER_DIRECTIVES
90
+ }
81
91
  DEFINE_MACROS += [('CYTHON_TRACE', '1'),
82
92
  ('CYTHON_TRACE_NOGIL', '1')]
83
93
  if FLAG_COVERAGE in sys.argv:
@@ -113,7 +123,7 @@ setup(
113
123
  install_requires=load('requirements.txt'),
114
124
  tests_require=load('requirements-dev.txt'),
115
125
  license='License :: OSI Approved :: MIT License',
116
- python_requires=">=3.7",
126
+ python_requires=">=3.8",
117
127
  classifiers=[
118
128
  'Development Status :: 5 - Production/Stable',
119
129
  'Operating System :: MacOS :: MacOS X',
@@ -121,10 +131,11 @@ setup(
121
131
  'Operating System :: POSIX :: Linux',
122
132
  'Programming Language :: Python',
123
133
  'Programming Language :: Python :: 3',
124
- 'Programming Language :: Python :: 3.7',
125
134
  'Programming Language :: Python :: 3.8',
126
135
  'Programming Language :: Python :: 3.9',
127
136
  'Programming Language :: Python :: 3.10',
137
+ 'Programming Language :: Python :: 3.11',
138
+ 'Programming Language :: Python :: 3.12',
128
139
  'Topic :: Scientific/Engineering',
129
140
  'License :: OSI Approved :: MIT License'],
130
141
  )
@@ -37,7 +37,7 @@ cdef int[12] _dayspermonth_leap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 3
37
37
  cdef int[13] _cumdayspermonth = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]
38
38
  cdef int[13] _cumdayspermonth_leap = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]
39
39
 
40
- __version__ = '1.6.2'
40
+ __version__ = '1.6.3'
41
41
 
42
42
  # Adapted from http://delete.me.uk/2005/03/iso8601.html
43
43
  # 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
1051
1051
  Gregorian calendar.
1052
1052
 
1053
1053
  Supports timedelta operations by overloading +/-, and
1054
- comparisons with other instances using the same calendar.
1054
+ comparisons with other instances (even if they use different calendars).
1055
1055
 
1056
1056
  Comparison with native python datetime instances is possible
1057
1057
  for cftime.datetime instances using
@@ -30,8 +30,10 @@ class TimeRE(dict):
30
30
  'M': r"(?P<M>[0-5]\d|\d)",
31
31
  'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
32
32
  'y': r"(?P<y>\d\d)",
33
- # 'Y': r"(?P<Y>\d\d\d\d)",
34
- 'Y': r"(?P<Y>[+-]?[0-9]+)", # handle neg and > 4 digits
33
+ 'Y': r"(?P<Y>[+-]?\d\d\d\d)", # 4 digit years, pos or neg
34
+ # the next one allows for > 4 digit years, but doesn't work without separators
35
+ # (e.g. '%Y%m%d%H', see issue #301)
36
+ # 'Y': r"(?P<Y>[+-]?[0-9]+)", # handle neg and > 4 digits
35
37
  'B': self.__seqToRE(month_name[1:], 'B'),
36
38
  'b': self.__seqToRE(month_abbr[1:], 'b'),
37
39
  '%': '%'})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cftime
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: Time-handling functionality from netcdf4-python
5
5
  Author: Jeff Whitaker
6
6
  Author-email: jeffrey.s.whitaker@noaa.gov
@@ -11,13 +11,14 @@ Classifier: Operating System :: Microsoft :: Windows
11
11
  Classifier: Operating System :: POSIX :: Linux
12
12
  Classifier: Programming Language :: Python
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.7
15
14
  Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
18
19
  Classifier: Topic :: Scientific/Engineering
19
20
  Classifier: License :: OSI Approved :: MIT License
20
- Requires-Python: >=3.7
21
+ Requires-Python: >=3.8
21
22
  Description-Content-Type: text/markdown
22
23
  License-File: LICENSE
23
24
 
@@ -34,6 +35,8 @@ Time-handling functionality from netcdf4-python
34
35
 
35
36
  ## News
36
37
  For details on the latest updates, see the [Changelog](https://github.com/Unidata/cftime/blob/master/Changelog).
38
+
39
+ 10/20/2023: Version 1.6.3 released. Support for python 3.12, cython 3.0, strptime formats without separators.
37
40
 
38
41
  9/18/2022: Version 1.6.2 released. strptime method added, fix for num2date failure on
39
42
  empty integer array, date2num 'longdouble' keyword added. New wheel building workflow.
@@ -0,0 +1,6 @@
1
+
2
+ [:python_version < "3.12.0.rc1"]
3
+ numpy>1.13.3
4
+
5
+ [:python_version >= "3.12.0.rc1"]
6
+ numpy>=1.26.0b1
@@ -1108,7 +1108,7 @@ class TestDate2index(unittest.TestCase):
1108
1108
  units = 'microseconds since 1776-07-04 00:00:00-12:00'
1109
1109
  dates = [datetime(1962, 10, 27, 6, 1, 30, 9001),
1110
1110
  datetime(1993, 11, 21, 12, 5, 25, 999),
1111
- datetime(1995, 11, 25, 18, 7, 59, 999999)]
1111
+ datetime(1995, 11, 25, 18, 7, 59, 9999)]
1112
1112
  times2 = date2num(dates, units)
1113
1113
  dates2 = num2date(times2, units)
1114
1114
  datediff = abs(dates-dates2)
@@ -1711,9 +1711,11 @@ def test_strptime():
1711
1711
  d = cftime.datetime.strptime("0000-02-30",\
1712
1712
  "%Y-%m-%d",calendar='360_day',has_year_zero=True)
1713
1713
  assert(repr(d) == "cftime.datetime(0, 2, 30, 0, 0, 0, 0, calendar='360_day', has_year_zero=True)")
1714
- d = cftime.datetime.strptime('-99999-02-29 10:18:32.926',\
1714
+ d = cftime.datetime.strptime('-9999-02-29 10:18:32.926',\
1715
1715
  '%Y-%m-%d %H:%M:%S.%f',calendar='366_day')
1716
- assert(repr(d) == "cftime.datetime(-99999, 2, 29, 10, 18, 32, 926000, calendar='all_leap', has_year_zero=True)")
1716
+ assert(repr(d) == "cftime.datetime(-9999, 2, 29, 10, 18, 32, 926000, calendar='all_leap', has_year_zero=True)")
1717
+ d = cftime.datetime.strptime("20200230", "%Y%m%d", "360_day") # no separator, issue #301
1718
+ assert(repr(d) == "cftime.datetime(2020, 2, 30, 0, 0, 0, 0, calendar='360_day', has_year_zero=True)")
1717
1719
  d = cftime.datetime.strptime('24/Aug/-4712:17:57:26', '%d/%b/%Y:%H:%M:%S',calendar='julian')
1718
1720
  assert(repr(d) == "cftime.datetime(-4712, 8, 24, 17, 57, 26, 0, calendar='julian', has_year_zero=False)")
1719
1721
  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):
2183
2185
 
2184
2186
 
2185
2187
  def test_num2date_precision():
2186
- if sys.platform.startswith("win"):
2187
- pytest.skip("skipping tests that require float128 on windows")
2188
+ if np.finfo(np.longdouble).precision < 18:
2189
+ pytest.skip("skipping tests that require extended precision longdouble type")
2188
2190
  testdates = [(1271, 3, 18, 19, 41, 33),
2189
2191
  (1271, 3, 18, 19, 41, 32, 999998)]
2190
2192
  unitinc = ['microseconds', 'seconds', 'minutes', 'hours', 'days']
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=41.2", "cython", "wheel", "oldest-supported-numpy"]
3
- build-backend = "setuptools.build_meta"
@@ -1 +0,0 @@
1
- numpy>1.13.3
@@ -1 +0,0 @@
1
- numpy>1.13.3
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes