Skip to content

Commit 08d2d99

Browse files
committed
Merge branch 'release/0.3'
2 parents fe7c795 + 69eca57 commit 08d2d99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+38198
-915
lines changed

.all-contributorsrc

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"files": [
3-
"README.md"
3+
"CONTRIBUTORS.md"
44
],
55
"imageSize": 100,
66
"commit": true,
@@ -14,7 +14,8 @@
1414
"contributions": [
1515
"code",
1616
"review",
17-
"test"
17+
"test",
18+
"ideas"
1819
]
1920
},
2021
{
@@ -38,7 +39,9 @@
3839
"avatar_url": "https://avatars.githubusercontent.com/u/1488847?v=4",
3940
"profile": "https://github.com/robcast",
4041
"contributions": [
41-
"data"
42+
"data",
43+
"ideas",
44+
"review"
4245
]
4346
},
4447
{
@@ -50,7 +53,8 @@
5053
"code",
5154
"review",
5255
"test",
53-
"eventOrganizing"
56+
"eventOrganizing",
57+
"ideas"
5458
]
5559
},
5660
{
@@ -72,5 +76,6 @@
7276
"repoType": "github",
7377
"repoHost": "https://github.com",
7478
"projectName": "undate-python",
75-
"projectOwner": "dh-tech"
79+
"projectOwner": "dh-tech",
80+
"badgeTemplate": "![All Contributors](https://img.shields.io/github/all-contributors/dh-tech/undate-python?color=ee8449&style=flat-square)"
7681
}

.github/workflows/check.yml

+14-13
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Set up Python 3.10
16+
- name: Set up Python 3.12
1717
uses: actions/setup-python@v5
1818
with:
19-
python-version: "3.10"
19+
python-version: "3.12"
2020
cache: 'pip'
21-
cache-dependency-path: '**/setup.cfg'
22-
- name: Install package with dependencies
21+
cache-dependency-path: '**/pyproject.toml'
22+
- name: Install package with development dependencies
2323
run: pip install -e ".[dev]"
24-
if: steps.python-cache.outputs.cache-hit != 'true'
2524

26-
# check code style
27-
- name: Run black
28-
run: black src --check --diff
25+
# check with ruff
26+
- name: Run ruff
27+
run: ruff check
2928

30-
# check docs
31-
- name: Check that documentation can be built
32-
run: tox -e docs
29+
# check docs build
30+
- name: Check that documentation builds with no errors or warnings
31+
run: sphinx-build docs docs/_build --fail-on-warning
3332

3433
# check types with mypy
35-
- name: Install mypy
36-
run: pip install mypy
3734
- name: Check types in python src directory; install needed types
3835
run: mypy --install-types --non-interactive src
36+
37+
# use treon to make sure that example notebooks run
38+
- name: Check jupyter notebooks with treon
39+
run: treon

.github/workflows/unit_tests.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ on:
1111

1212
env:
1313
# python version used to calculate and submit code coverage
14-
COV_PYTHON_VERSION: "3.11"
14+
COV_PYTHON_VERSION: "3.12"
1515

1616
jobs:
1717
python-unit:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python: ["3.9", "3.10", "3.11", "3.12"]
21+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2222
defaults:
2323
run:
2424
working-directory: .
@@ -30,21 +30,18 @@ jobs:
3030
with:
3131
python-version: ${{ matrix.python }}
3232
cache: 'pip'
33-
cache-dependency-path: '**/setup.cfg'
33+
cache-dependency-path: '**/pyproject.toml'
3434
- name: Install package with dependencies
35-
run: |
36-
pip install -e ".[dev]"
37-
python -m pip install tox tox-gh-actions
38-
if: steps.python-cache.outputs.cache-hit != 'true'
35+
run: pip install -e ".[test]"
3936

4037
# for all versions but the one we use for code coverage, run normally
4138
- name: Run unit tests normally
42-
run: tox
39+
run: pytest
4340
if: ${{ matrix.python != env.COV_PYTHON_VERSION }}
4441

4542
# run code coverage in one version only
4643
- name: Run unit tests with code coverage reporting
47-
run: tox -e coverage
44+
run: pytest --cov=undate
4845
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
4946
- name: Upload test coverage to Codecov
5047
uses: codecov/codecov-action@v3

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ venv.bak/
3939
# code coverage
4040
.coverage
4141
coverage.xml
42+
43+
# jupyter
44+
.ipynb_checkpoints/

.pre-commit-config.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
files: \.py
22
repos:
3-
- repo: https://github.com/psf/black
4-
rev: 22.10.0
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: v0.3.4
55
hooks:
6-
- id: black
6+
- id: ruff
7+
args: [ --fix, --exit-non-zero-on-fix ]
8+
- id: ruff-format
79
- repo: https://github.com/pre-commit/pre-commit-hooks
810
rev: v4.3.0
911
hooks:
@@ -12,4 +14,9 @@ repos:
1214
- id: debug-statements
1315
- id: end-of-file-fixer
1416
- id: mixed-line-ending
15-
- id: trailing-whitespace
17+
- id: trailing-whitespace
18+
- repo: https://github.com/pre-commit/mirrors-mypy
19+
rev: v1.13.0
20+
hooks:
21+
- id: mypy
22+
additional_dependencies: [numpy]

.pythonversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Python 3.12.7

CHANGELOG.md

+26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Change Log
22

3+
## 0.3
4+
5+
- Updated to use numpy `datetime64` to support a greater range of years beyond the 4-digit years supported by python's builtin ``datetime.date`
6+
- Custom `Date` and `Timedelta` objects as shims to make numpy datetime64 and timedelta64 act more like python `datetime` objects
7+
- Renamed formatters to converters for more flexibility / scope
8+
- Support using different converters with new `format` and `parse` methods on `Undate`
9+
- Improved EDTF support:
10+
- Support 5+ digit years with leading Y (thanks to numpy.datetime64)
11+
- Jupyter notebook demonstrating / validating EDTF support
12+
- Full support for Level 0 Date and Time Interval (no Date and Time support)
13+
- Level 1:
14+
- Letter-prefixed cbalendar year
15+
- Unspecified digit from the right
16+
- Partial support for extended interval
17+
- Level 2: unspecified digit anywhere in the date
18+
- Improved readme with example usage and disclaimers about current functionality
19+
- Improved documentation for adding new converters
20+
- Improved documentation for branching guidelines in contributing
21+
- Restructured sphinx documentation and added more code documentation
22+
- Added a project logo
23+
- Switch from black to ruff for pre-commit formatting
24+
25+
### numpy impact
26+
27+
Performance differences seem to be negligible, but it does increase payloud size. The virtualenv for installing version 0.2 was 14MB; when installing the newer version with numpy, the virtualenv is 46MB (the numpy folder in site packages is 31MB on its own).
28+
329
## 0.2
430

531
- Undate and UndateInterval now include an optional label for named dates or time periods

CITATION.cff

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ authors:
2525
family-names: Casties
2626
affiliation: Max Planck Institute for the History of Science
2727
orcid: https://orcid.org/0009-0008-9370-1303
28-
version: '0.2'
29-
date-released: 2024-04-25
28+
version: '0.3'
29+
date-released: 2024-11-18
3030
repository-code: https://github.com/dh-tech/undate-python
3131
license: Apache 2

CONTRIBUTING.md

+41-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
1-
# Contributing to Undate - A fuzzy date Python library
2-
1+
# Contributing to undate
32

43
Hey there!
54

65
If you found your way here that probably means you are curious about how to contribute to this project. This is great! We are always looking for new contributors. If you can't find the information you are looking for in this document or anywhere else in the repo, please consider [opening a ticket](https://github.com/dh-tech/undate-python/issues) so we know there is something we need to address.
76

87
## Project Setup
9-
Instructions on how to set up the project locally and how to run the tests can be found [in the Readme file](README.md).
8+
Instructions on how to set up the project locally and how to run the tests can be found in [Developer Notes](DEVELOPER_NOTES.md).
109

1110
## Submitting Changes
12-
If you would like to contribute by submitting bug fixes, improvements, or new features, please fork the repository and then make a pull request to our main branch when you are ready. For details see [this description of the Forking Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow).
11+
12+
If you would like to contribute by submitting bug fixes, improvements, or new features, please fork the repository and then make a pull request to undate **develop** branch when you are ready. If you haven't contributed like this before, we recommend reading [GitHub's documentation on Contributing to a Project](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project).
13+
14+
We use **git flow** branching conventions, so the current release is on the **main** branch and new feature development happens on **develop**. Pull requests for new features or bug fixes should be made to **develop** for inclusion in the next release. For more details, read a longer explanation of the [Git Flow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)
15+
16+
Recommended branch naming conventions:
17+
18+
- For a new feature, create a branch named `feature/i##-short-name` where `##` is the relevant GitHub issue number (if there is one) and `short-name` is a brief label that relates to the changes or feature
19+
20+
In most cases branches should be created from the most recent **develop** branch. Make sure you check out develop and pull any remote changes.
21+
```sh
22+
git checkout develop
23+
git pull
24+
```
25+
26+
If you have `git flow` installed, you can start, you can use:
27+
```sh
28+
git flow feature start i##-short-name
29+
```
30+
31+
If not, you can do the same thing with git commands:
32+
```sh
33+
git checkout -b feature/i##-short-name
34+
```
35+
36+
When you are ready to contribute your changes, open a pull request from your branch to the main undate repository. Please be sure to link to the GitHub issue in your pull request comments.
37+
38+
Ideally contributions should include documentation and tests for the proposed changes, but if that is a barrier please let us know when you submit a pull request.
39+
40+
Please be aware that any contributions will fall under the existing Apache 2.0 license applied to this software.
1341

1442
## Submitting Bug Reports and Feature Requests
43+
1544
If you find a bug or can think a feature you would really like to see being implemented, you can [create a new issue](https://github.com/dh-tech/undate-python/issues). Please first look through the existing issues, however, to avoid duplication of issues.
1645

17-
If you report a bug, please include any error messages you get and a full description of the steps to reproduce the bug. For new feature requests, please clearly describe the functionality you are looking for and, if applicable, why any existing workflow does not suffice. Please also consider, fixing bugs and implementing new features yourself and submit pull request! :)
46+
If you report a bug, please include any error messages you get and a full description of the steps to reproduce the bug. For new feature requests, please clearly describe the functionality you are looking for and, if applicable, why any existing workflow does not suffice. Please also consider fixing bugs and implementing new features yourself and submitting them via pull request! :)
47+
48+
## Submitting Use Cases and Example Data
49+
50+
We are particularly interested in collecting more use cases and example data where undate would be helpful!
51+
52+
Example data can be added to the [examples/](https://github.com/dh-tech/undate-python/tree/main/examples/) folder by a pull request.
1853

1954
## Getting Help
20-
The best and recommended way to get help is to join the [DHTech Slack](https://dh-tech.github.io/join/) and ask for help there. Only in cases when this is not feasible at all, you can open a new issue and tag it with "Help Request".
55+
The best and recommended way to get help is to join the [DHTech Slack](https://dh-tech.github.io/join/) and ask for help there. Only in cases when this is not feasible at all, you can open a new issue and tag it with "Help Request".
2156

2257
## DHTech
2358
This project started during the DHTech 2022 Hackathon. If you do technical work in the digital humanities and are intersted in meeting like-minded people, [consider joining](https://dh-tech.github.io/join/)!

CONTRIBUTORS.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# All Contributors
2+
3+
We use [All Contributors](https://allcontributors.org/) because we recognize that all kinds of contributions are valuable and important.
4+
5+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
6+
![All Contributors](https://img.shields.io/github/all-contributors/dh-tech/undate-python?color=ee8449&style=flat-square)
7+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
8+
9+
## Contributors
10+
11+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
12+
<!-- prettier-ignore-start -->
13+
<!-- markdownlint-disable -->
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ColeDCrawford"><img src="https://avatars.githubusercontent.com/u/16374762?v=4?s=100" width="100px;" alt="Cole Crawford"/><br /><sub><b>Cole Crawford</b></sub></a><br /><a href="https://github.com/dh-tech/undate-python/commits?author=ColeDCrawford" title="Code">💻</a> <a href="https://github.com/dh-tech/undate-python/pulls?q=is%3Apr+reviewed-by%3AColeDCrawford" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/dh-tech/undate-python/commits?author=ColeDCrawford" title="Tests">⚠️</a> <a href="#ideas-ColeDCrawford" title="Ideas, Planning, & Feedback">🤔</a></td>
18+
<td align="center" valign="top" width="14.28%"><a href="http://rlskoeser.github.io"><img src="https://avatars.githubusercontent.com/u/691231?v=4?s=100" width="100px;" alt="Rebecca Sutton Koeser"/><br /><sub><b>Rebecca Sutton Koeser</b></sub></a><br /><a href="https://github.com/dh-tech/undate-python/commits?author=rlskoeser" title="Code">💻</a> <a href="https://github.com/dh-tech/undate-python/pulls?q=is%3Apr+reviewed-by%3Arlskoeser" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/dh-tech/undate-python/commits?author=rlskoeser" title="Tests">⚠️</a> <a href="#blog-rlskoeser" title="Blogposts">📝</a> <a href="#example-rlskoeser" title="Examples">💡</a> <a href="https://github.com/dh-tech/undate-python/commits?author=rlskoeser" title="Documentation">📖</a> <a href="#platform-rlskoeser" title="Packaging/porting to new platform">📦</a></td>
19+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/robcast"><img src="https://avatars.githubusercontent.com/u/1488847?v=4?s=100" width="100px;" alt="Robert Casties"/><br /><sub><b>Robert Casties</b></sub></a><br /><a href="#data-robcast" title="Data">🔣</a> <a href="#ideas-robcast" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/dh-tech/undate-python/pulls?q=is%3Apr+reviewed-by%3Arobcast" title="Reviewed Pull Requests">👀</a></td>
20+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jdamerow"><img src="https://avatars.githubusercontent.com/u/8881141?v=4?s=100" width="100px;" alt="Julia Damerow"/><br /><sub><b>Julia Damerow</b></sub></a><br /><a href="https://github.com/dh-tech/undate-python/commits?author=jdamerow" title="Code">💻</a> <a href="https://github.com/dh-tech/undate-python/pulls?q=is%3Apr+reviewed-by%3Ajdamerow" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/dh-tech/undate-python/commits?author=jdamerow" title="Tests">⚠️</a> <a href="#eventOrganizing-jdamerow" title="Event Organizing">📋</a> <a href="#ideas-jdamerow" title="Ideas, Planning, & Feedback">🤔</a></td>
21+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/maltevogl"><img src="https://avatars.githubusercontent.com/u/20907912?v=4?s=100" width="100px;" alt="Malte Vogl"/><br /><sub><b>Malte Vogl</b></sub></a><br /><a href="https://github.com/dh-tech/undate-python/commits?author=maltevogl" title="Code">💻</a> <a href="https://github.com/dh-tech/undate-python/pulls?q=is%3Apr+reviewed-by%3Amaltevogl" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/dh-tech/undate-python/commits?author=maltevogl" title="Tests">⚠️</a> <a href="https://github.com/dh-tech/undate-python/commits?author=maltevogl" title="Documentation">📖</a></td>
22+
</tr>
23+
</tbody>
24+
<tfoot>
25+
<tr>
26+
<td align="center" size="13px" colspan="7">
27+
<img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg">
28+
<a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
29+
</img>
30+
</td>
31+
</tr>
32+
</tfoot>
33+
</table>
34+
35+
<!-- markdownlint-restore -->
36+
<!-- prettier-ignore-end -->
37+
38+
<!-- ALL-CONTRIBUTORS-LIST:END -->
39+
<!-- prettier-ignore-start -->
40+
<!-- markdownlint-disable -->
41+
42+
<!-- markdownlint-restore -->
43+
<!-- prettier-ignore-end -->
44+
45+
<!-- ALL-CONTRIBUTORS-LIST:END -->
46+
47+
### Related blog posts
48+
49+
(blog-rlskoeser)=
50+
#### [by Rebecca Sutton Koeser](#blog-rlskoeser)
51+
- [Join me for a DHTech hackathon? It’s an un-date!](https://dh-tech.github.io/blog/2023-02-09-hackathon-summary/) 2023-02-09 on DHTech blog

0 commit comments

Comments
 (0)