dately 3.2.4__tar.gz → 3.3.0__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.
- dately-3.3.0/LICENSE +21 -0
- dately-3.3.0/MANIFEST.in +13 -0
- dately-3.3.0/PKG-INFO +178 -0
- dately-3.3.0/README.md +131 -0
- {dately-3.2.4/dately → dately-3.3.0}/__init__.py +282 -269
- dately-3.3.0/_api.py +85 -0
- {dately-3.2.4/dately → dately-3.3.0}/_connect.py +466 -411
- {dately-3.2.4/dately → dately-3.3.0}/_datetime_scan.py +1664 -1683
- {dately-3.2.4/dately → dately-3.3.0}/_holiday.py +391 -399
- dately-3.3.0/_log.py +51 -0
- {dately-3.2.4/dately → dately-3.3.0}/_mskutils.py +156 -123
- dately-3.3.0/_proxy.py +86 -0
- {dately-3.2.4/dately → dately-3.3.0}/_sysutils.py +239 -207
- {dately-3.2.4/dately → dately-3.3.0}/_temporal_scan.py +2581 -2770
- {dately-3.2.4/dately → dately-3.3.0}/_timeutils.py +449 -360
- {dately-3.2.4/dately → dately-3.3.0}/_timezone.py +348 -313
- {dately-3.2.4/dately → dately-3.3.0}/_utils.py +139 -103
- dately-3.3.0/_vendor/__init__.py +46 -0
- dately-3.3.0/_vendor/agent_profile/__init__.py +59 -0
- dately-3.3.0/_vendor/agent_profile/scripts/__init__.py +47 -0
- {dately-3.2.4/dately/dt_nlp → dately-3.3.0/_vendor/agent_profile/scripts/user_agent}/__init__.py +47 -44
- dately-3.3.0/_vendor/agent_profile/scripts/user_agent/generate.py +113 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/README.md +37 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/__init__.py +52 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/browser_versions/__init__.py +45 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/browser_versions/chrome.py +204 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/browser_versions/edge.py +592 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/browser_versions/safari.py +90 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/generator.py +244 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/headers.py +130 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/http_session.py +96 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/update_versions.py +119 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/version.py +51 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/version_sources/__init__.py +45 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/version_sources/apple.py +102 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/version_sources/chrome.py +85 -0
- dately-3.3.0/_vendor/agent_profile/user_agent/version_sources/edge.py +189 -0
- dately-3.3.0/_version.py +49 -0
- dately-3.3.0/_webutils.py +144 -0
- dately-3.3.0/assets/dately-logo-icon-1024.png +0 -0
- dately-3.3.0/assets/dately-logo-lockup-1600.png +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/core.py +717 -721
- dately-3.3.0/dately.egg-info/PKG-INFO +178 -0
- dately-3.3.0/dately.egg-info/SOURCES.txt +179 -0
- dately-3.3.0/dately.egg-info/not-zip-safe +1 -0
- {dately-3.2.4 → dately-3.3.0}/dately.egg-info/requires.txt +3 -3
- dately-3.3.0/docs/distribution-builds.md +45 -0
- dately-3.3.0/docs/free-data-sources.html +444 -0
- dately-3.3.0/docs/issue-fix-log.md +50 -0
- dately-3.3.0/dt_nlp/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/arithmetic.py +1309 -1347
- dately-3.3.0/dt_nlp/lexical_validation/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/lexical_validation/vocabulary_checks.py +114 -121
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/quantified_time.py +208 -233
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/relative_time.py +422 -433
- dately-3.3.0/dt_nlp/semantic_validation/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/semantic_validation/unit_bounds.py +380 -395
- dately-3.3.0/dt_nlp/string_similarity/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/string_similarity/spell_correction.py +802 -893
- dately-3.3.0/dt_nlp/syntactic_validation/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/syntactic_validation/structure_validator.py +320 -333
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/syntactic_validation/temporal_structure_rules.py +543 -613
- dately-3.3.0/dt_nlp/temporal_core/__init__.py +44 -0
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/temporal_core/temporal_units.py +339 -347
- {dately-3.2.4/dately → dately-3.3.0}/dt_nlp/temporal_preprocessing.py +1389 -1406
- dately-3.3.0/examples/convert_dates.py +256 -0
- dately-3.3.0/examples/nlp_parsing.py +92 -0
- dately-3.3.0/examples/replace_datestring.py +118 -0
- dately-3.3.0/examples/timezone_operations.py +118 -0
- dately-3.3.0/files/__init__.py +44 -0
- dately-3.3.0/mold/__init__.py +44 -0
- dately-3.3.0/mold/pyd/__init__.py +44 -0
- dately-3.3.0/mold/pyd/cdatetime/__init__.py +44 -0
- dately-3.3.0/mold/pyx/Compiled.c +13556 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/pyx/Compiled.pyx +162 -201
- dately-3.3.0/mold/pyx/UniversalDateFormatter.c +17915 -0
- dately-3.3.0/mold/pyx/UniversalDateFormatter.pyx +179 -0
- dately-3.3.0/mold/pyx/clean_str.c +8086 -0
- dately-3.3.0/mold/pyx/clean_str.pyx +9 -0
- dately-3.3.0/mold/pyx/iso8601T.c +8036 -0
- dately-3.3.0/mold/pyx/iso8601Z.c +8129 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/pyx/iso8601Z.pyx +10 -12
- dately-3.3.0/mold/pyx/time_zones.c +7775 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/pyx/time_zones.pyx +38 -41
- dately-3.3.0/mold/pyx/whichformat.c +20065 -0
- dately-3.3.0/mold/pyx/whichformat.pyx +324 -0
- dately-3.3.0/pyproject.toml +17 -0
- dately-3.3.0/setup.py +153 -0
- dately-3.3.0/tests/conftest.py +68 -0
- dately-3.3.0/tests/test_connect.py +156 -0
- dately-3.3.0/tests/test_regressions.py +145 -0
- dately-3.2.4/MANIFEST.in +0 -1
- dately-3.2.4/PKG-INFO +0 -105
- dately-3.2.4/README.md +0 -84
- dately-3.2.4/dately/__envutils.py +0 -41
- dately-3.2.4/dately/__os_config.py +0 -105
- dately-3.2.4/dately/__user_agents_config.py +0 -48
- dately-3.2.4/dately/_api.py +0 -52
- dately-3.2.4/dately/_log.py +0 -14
- dately-3.2.4/dately/_proxy.py +0 -43
- dately-3.2.4/dately/_version.py +0 -12
- dately-3.2.4/dately/_webutils.py +0 -199
- dately-3.2.4/dately/dt_nlp/lexical_validation/__init__.py +0 -0
- dately-3.2.4/dately/dt_nlp/semantic_validation/__init__.py +0 -0
- dately-3.2.4/dately/dt_nlp/string_similarity/__init__.py +0 -0
- dately-3.2.4/dately/dt_nlp/syntactic_validation/__init__.py +0 -0
- dately-3.2.4/dately/dt_nlp/temporal_core/__init__.py +0 -0
- dately-3.2.4/dately/files/__init__.py +0 -0
- dately-3.2.4/dately/files/os_versions.json +0 -5
- dately-3.2.4/dately/files/user_agents.json +0 -26
- dately-3.2.4/dately/mold/__init__.py +0 -0
- dately-3.2.4/dately/mold/include/root_dir_search.h +0 -14
- dately-3.2.4/dately/mold/pyd/Compiled.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/__init__.py +0 -0
- dately-3.2.4/dately/mold/pyd/cdatetime/UniversalDateFormatter.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/cdatetime/__init__.py +0 -0
- dately-3.2.4/dately/mold/pyd/cdatetime/iso8601T.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/cdatetime/iso8601Z.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/cdatetime/whichformat.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/clean_str.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyd/time_zones.cp38-win_amd64.pyd +0 -0
- dately-3.2.4/dately/mold/pyx/UniversalDateFormatter.pyx +0 -388
- dately-3.2.4/dately/mold/pyx/clean_str.pyx +0 -10
- dately-3.2.4/dately/mold/pyx/whichformat.pyx +0 -911
- dately-3.2.4/dately/mold/src/Compiled.c +0 -13474
- dately-3.2.4/dately/mold/src/UniversalDateFormatter.c +0 -15740
- dately-3.2.4/dately/mold/src/clean_str.c +0 -6572
- dately-3.2.4/dately/mold/src/iso8601T.c +0 -6178
- dately-3.2.4/dately/mold/src/iso8601Z.c +0 -6275
- dately-3.2.4/dately/mold/src/root_dir_search_impl.c +0 -53
- dately-3.2.4/dately/mold/src/time_zones.c +0 -6234
- dately-3.2.4/dately/mold/src/whichformat.c +0 -18038
- dately-3.2.4/dately/tests/__init__.py +0 -1
- dately-3.2.4/dately/tests/test_parse.py +0 -39
- dately-3.2.4/dately.egg-info/PKG-INFO +0 -105
- dately-3.2.4/dately.egg-info/SOURCES.txt +0 -85
- dately-3.2.4/setup.py +0 -205
- {dately-3.2.4 → dately-3.3.0}/dately.egg-info/dependency_links.txt +0 -0
- {dately-3.2.4 → dately-3.3.0}/dately.egg-info/top_level.txt +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/files/country_variants.json +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/files/holiday.json +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/files/timezone_data.json +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/include/clean_str.h +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/include/iso8601T.h +0 -0
- /dately-3.2.4/dately/mold/include/iso8601Z.h → /dately-3.3.0/mold/include/iso8601z.h +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/include/time_zones.h +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/pyx/iso8601T.pyx +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/src/clean_str_impl.c +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/src/iso8601T_impl.c +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/src/iso8601Z_impl.c +0 -0
- {dately-3.2.4/dately → dately-3.3.0}/mold/src/time_zones_impl.c +0 -0
- {dately-3.2.4 → dately-3.3.0}/setup.cfg +0 -0
dately-3.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Cedric Moore Jr.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dately-3.3.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
recursive-include mold/include *.h
|
|
4
|
+
recursive-include mold/src *_impl.c
|
|
5
|
+
recursive-include mold/pyx *.pyx
|
|
6
|
+
recursive-include assets *.png
|
|
7
|
+
include files/country_variants.json
|
|
8
|
+
include files/holiday.json
|
|
9
|
+
include files/timezone_data.json
|
|
10
|
+
recursive-include _vendor *.md
|
|
11
|
+
recursive-include docs *.md *.html
|
|
12
|
+
recursive-include examples *.py
|
|
13
|
+
recursive-include tests *.py
|
dately-3.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dately
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: Deterministic date, time, timezone, holiday, and temporal-language processing.
|
|
5
|
+
Home-page: https://github.com/cedricmoorejr/dately
|
|
6
|
+
Author: cedricmoorejunior
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Documentation, https://github.com/cedricmoorejr/dately#readme
|
|
9
|
+
Project-URL: Issues, https://github.com/cedricmoorejr/dately/issues
|
|
10
|
+
Project-URL: Source, https://github.com/cedricmoorejr/dately
|
|
11
|
+
Platform: Windows
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
25
|
+
Requires-Python: >=3.8,<3.15
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: importlib-resources; python_version < "3.9"
|
|
29
|
+
Requires-Dist: numbr
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: pandas
|
|
32
|
+
Requires-Dist: pytz
|
|
33
|
+
Requires-Dist: requests
|
|
34
|
+
Requires-Dist: requests-cache
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description
|
|
38
|
+
Dynamic: description-content-type
|
|
39
|
+
Dynamic: home-page
|
|
40
|
+
Dynamic: license
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: platform
|
|
43
|
+
Dynamic: project-url
|
|
44
|
+
Dynamic: requires-dist
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
Dynamic: summary
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="https://raw.githubusercontent.com/cedricmoorejr/dately/main/assets/dately-logo-lockup-1600.png" alt="dately" width="700">
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
Deterministic date, time, timezone, holiday, and natural-language temporal processing for Python.
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<a href="https://pypi.org/project/dately/"><img src="https://img.shields.io/pypi/v/dately" alt="PyPI version"></a>
|
|
58
|
+
<a href="https://pypi.org/project/dately/"><img src="https://img.shields.io/pypi/pyversions/dately" alt="Supported Python versions"></a>
|
|
59
|
+
<a href="https://pepy.tech/project/dately"><img src="https://static.pepy.tech/badge/dately" alt="Downloads"></a>
|
|
60
|
+
<a href="https://doydl.com"><img src="https://img.shields.io/badge/Powered%20by-DOYDL%20Technologies-blue" alt="Powered by DOYDL Technologies"></a>
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
## Overview
|
|
64
|
+
|
|
65
|
+
`dately` parses, detects, converts, replaces, and normalizes date and time values. It accepts individual strings as well as lists, dictionaries, NumPy arrays, and pandas Series. Its rule-based NLP engine also resolves expressions such as:
|
|
66
|
+
|
|
67
|
+
- `first Monday of next month`
|
|
68
|
+
- `last 5 weekends`
|
|
69
|
+
- `Q3 of last year`
|
|
70
|
+
- `3 days ago starting from April 10`
|
|
71
|
+
|
|
72
|
+
The library includes Cython extensions for frequently used parsing operations and compatibility handling for platform-specific date-format behavior.
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
Install the latest published release from PyPI:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
python -m pip install dately
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
To test a local checkout in an isolated environment:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python -m venv .venv-test
|
|
86
|
+
source .venv-test/Scripts/activate
|
|
87
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
88
|
+
python -m pip install -e .
|
|
89
|
+
python -m pytest -q
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Release downloads provide Windows x64 wheels for supported CPython versions and a source distribution. See [Distribution builds](docs/distribution-builds.md) for the artifact matrix and release procedure.
|
|
93
|
+
|
|
94
|
+
## Quick start
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import dately as dtly
|
|
98
|
+
|
|
99
|
+
dtly.detect_date_format("2024-03-13T14:30:00")
|
|
100
|
+
# '%Y-%m-%dT%H:%M:%S'
|
|
101
|
+
|
|
102
|
+
dtly.replace_datestring(
|
|
103
|
+
"2024-03-13T14:30:00",
|
|
104
|
+
year=2025,
|
|
105
|
+
month=12,
|
|
106
|
+
day=25,
|
|
107
|
+
)
|
|
108
|
+
# '2025-12-25T14:30:00'
|
|
109
|
+
|
|
110
|
+
dtly.replace_timestring(
|
|
111
|
+
"2024-03-13 T14:30:00",
|
|
112
|
+
hour=9,
|
|
113
|
+
minute=15,
|
|
114
|
+
tzinfo="Europe/London",
|
|
115
|
+
)
|
|
116
|
+
# '2024-03-13 T09:15:00 Europe/London'
|
|
117
|
+
|
|
118
|
+
dtly.parse("first Monday of next month")
|
|
119
|
+
# datetime.date(...) relative to the current date
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Capabilities
|
|
123
|
+
|
|
124
|
+
### Format detection and conversion
|
|
125
|
+
|
|
126
|
+
- Detect common and custom date/time formats.
|
|
127
|
+
- Convert values to a requested output format.
|
|
128
|
+
- Extract individual year, month, day, time, and timezone components.
|
|
129
|
+
- Process scalar values and nested collections.
|
|
130
|
+
|
|
131
|
+
### Date and time replacement
|
|
132
|
+
|
|
133
|
+
- Replace selected date or time components without rebuilding the input manually.
|
|
134
|
+
- Preserve the original date/time separator where supported.
|
|
135
|
+
- Work with ISO-8601 and non-ISO strings.
|
|
136
|
+
|
|
137
|
+
### Natural-language parsing
|
|
138
|
+
|
|
139
|
+
- Resolve relative, ordinal, anchored, and range expressions.
|
|
140
|
+
- Interpret quarters, weeks, weekends, weekdays, months, and years.
|
|
141
|
+
- Configure the first day of the week with `set_week_start()`.
|
|
142
|
+
- Return exact dates or date ranges through a deterministic rule-based pipeline.
|
|
143
|
+
|
|
144
|
+
### Timezones and holidays
|
|
145
|
+
|
|
146
|
+
`TimeZoner` and `Holidate` are exposed as lazy-loaded public objects:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
import dately as dtly
|
|
150
|
+
|
|
151
|
+
country_codes = dtly.TimeZoner.CountryCodes
|
|
152
|
+
zones = dtly.TimeZoner.Zones
|
|
153
|
+
holidays = dtly.Holidate
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Bundled timezone and holiday properties work with local data. Operations that request current remote information still depend on their respective external services being available. See the [issue and fix log](docs/issue-fix-log.md) for implementation details.
|
|
157
|
+
|
|
158
|
+
### Cross-platform formatting
|
|
159
|
+
|
|
160
|
+
Windows and Unix-like platforms differ in their support for flags that suppress leading zeros in `strftime` directives. `dately` detects and normalizes these cases so formatting behavior remains consistent across supported platforms.
|
|
161
|
+
|
|
162
|
+
## Examples
|
|
163
|
+
|
|
164
|
+
Runnable examples with expected output are available in the [`examples`](examples/) directory:
|
|
165
|
+
|
|
166
|
+
- [Date conversion and formatting](examples/convert_dates.py)
|
|
167
|
+
- [Replacing date and time components](examples/replace_datestring.py)
|
|
168
|
+
- [Timezone operations](examples/timezone_operations.py)
|
|
169
|
+
- [Natural-language parsing](examples/nlp_parsing.py)
|
|
170
|
+
|
|
171
|
+
## Documentation
|
|
172
|
+
|
|
173
|
+
- [Distribution builds](docs/distribution-builds.md)
|
|
174
|
+
- [Issue and fix log](docs/issue-fix-log.md)
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
`dately` is distributed under the MIT License. See [LICENSE](LICENSE) for details.
|
dately-3.3.0/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/cedricmoorejr/dately/main/assets/dately-logo-lockup-1600.png" alt="dately" width="700">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
Deterministic date, time, timezone, holiday, and natural-language temporal processing for Python.
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://pypi.org/project/dately/"><img src="https://img.shields.io/pypi/v/dately" alt="PyPI version"></a>
|
|
11
|
+
<a href="https://pypi.org/project/dately/"><img src="https://img.shields.io/pypi/pyversions/dately" alt="Supported Python versions"></a>
|
|
12
|
+
<a href="https://pepy.tech/project/dately"><img src="https://static.pepy.tech/badge/dately" alt="Downloads"></a>
|
|
13
|
+
<a href="https://doydl.com"><img src="https://img.shields.io/badge/Powered%20by-DOYDL%20Technologies-blue" alt="Powered by DOYDL Technologies"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
`dately` parses, detects, converts, replaces, and normalizes date and time values. It accepts individual strings as well as lists, dictionaries, NumPy arrays, and pandas Series. Its rule-based NLP engine also resolves expressions such as:
|
|
19
|
+
|
|
20
|
+
- `first Monday of next month`
|
|
21
|
+
- `last 5 weekends`
|
|
22
|
+
- `Q3 of last year`
|
|
23
|
+
- `3 days ago starting from April 10`
|
|
24
|
+
|
|
25
|
+
The library includes Cython extensions for frequently used parsing operations and compatibility handling for platform-specific date-format behavior.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install the latest published release from PyPI:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python -m pip install dately
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To test a local checkout in an isolated environment:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python -m venv .venv-test
|
|
39
|
+
source .venv-test/Scripts/activate
|
|
40
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
41
|
+
python -m pip install -e .
|
|
42
|
+
python -m pytest -q
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Release downloads provide Windows x64 wheels for supported CPython versions and a source distribution. See [Distribution builds](docs/distribution-builds.md) for the artifact matrix and release procedure.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import dately as dtly
|
|
51
|
+
|
|
52
|
+
dtly.detect_date_format("2024-03-13T14:30:00")
|
|
53
|
+
# '%Y-%m-%dT%H:%M:%S'
|
|
54
|
+
|
|
55
|
+
dtly.replace_datestring(
|
|
56
|
+
"2024-03-13T14:30:00",
|
|
57
|
+
year=2025,
|
|
58
|
+
month=12,
|
|
59
|
+
day=25,
|
|
60
|
+
)
|
|
61
|
+
# '2025-12-25T14:30:00'
|
|
62
|
+
|
|
63
|
+
dtly.replace_timestring(
|
|
64
|
+
"2024-03-13 T14:30:00",
|
|
65
|
+
hour=9,
|
|
66
|
+
minute=15,
|
|
67
|
+
tzinfo="Europe/London",
|
|
68
|
+
)
|
|
69
|
+
# '2024-03-13 T09:15:00 Europe/London'
|
|
70
|
+
|
|
71
|
+
dtly.parse("first Monday of next month")
|
|
72
|
+
# datetime.date(...) relative to the current date
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Capabilities
|
|
76
|
+
|
|
77
|
+
### Format detection and conversion
|
|
78
|
+
|
|
79
|
+
- Detect common and custom date/time formats.
|
|
80
|
+
- Convert values to a requested output format.
|
|
81
|
+
- Extract individual year, month, day, time, and timezone components.
|
|
82
|
+
- Process scalar values and nested collections.
|
|
83
|
+
|
|
84
|
+
### Date and time replacement
|
|
85
|
+
|
|
86
|
+
- Replace selected date or time components without rebuilding the input manually.
|
|
87
|
+
- Preserve the original date/time separator where supported.
|
|
88
|
+
- Work with ISO-8601 and non-ISO strings.
|
|
89
|
+
|
|
90
|
+
### Natural-language parsing
|
|
91
|
+
|
|
92
|
+
- Resolve relative, ordinal, anchored, and range expressions.
|
|
93
|
+
- Interpret quarters, weeks, weekends, weekdays, months, and years.
|
|
94
|
+
- Configure the first day of the week with `set_week_start()`.
|
|
95
|
+
- Return exact dates or date ranges through a deterministic rule-based pipeline.
|
|
96
|
+
|
|
97
|
+
### Timezones and holidays
|
|
98
|
+
|
|
99
|
+
`TimeZoner` and `Holidate` are exposed as lazy-loaded public objects:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import dately as dtly
|
|
103
|
+
|
|
104
|
+
country_codes = dtly.TimeZoner.CountryCodes
|
|
105
|
+
zones = dtly.TimeZoner.Zones
|
|
106
|
+
holidays = dtly.Holidate
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Bundled timezone and holiday properties work with local data. Operations that request current remote information still depend on their respective external services being available. See the [issue and fix log](docs/issue-fix-log.md) for implementation details.
|
|
110
|
+
|
|
111
|
+
### Cross-platform formatting
|
|
112
|
+
|
|
113
|
+
Windows and Unix-like platforms differ in their support for flags that suppress leading zeros in `strftime` directives. `dately` detects and normalizes these cases so formatting behavior remains consistent across supported platforms.
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
Runnable examples with expected output are available in the [`examples`](examples/) directory:
|
|
118
|
+
|
|
119
|
+
- [Date conversion and formatting](examples/convert_dates.py)
|
|
120
|
+
- [Replacing date and time components](examples/replace_datestring.py)
|
|
121
|
+
- [Timezone operations](examples/timezone_operations.py)
|
|
122
|
+
- [Natural-language parsing](examples/nlp_parsing.py)
|
|
123
|
+
|
|
124
|
+
## Documentation
|
|
125
|
+
|
|
126
|
+
- [Distribution builds](docs/distribution-builds.md)
|
|
127
|
+
- [Issue and fix log](docs/issue-fix-log.md)
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
`dately` is distributed under the MIT License. See [LICENSE](LICENSE) for details.
|