Skip to content

Commit

Permalink
Merge pull request #88 from dh-tech/feature/pyproject-setup-refactor
Browse files Browse the repository at this point in the history
Consolidate setup.cfg and pyproject.toml; drop tox; revamp sphinx docs
  • Loading branch information
rlskoeser authored Sep 5, 2024
2 parents eaacbf2 + 129b82e commit a375e93
Show file tree
Hide file tree
Showing 30 changed files with 247 additions and 188 deletions.
13 changes: 9 additions & 4 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"contributions": [
"code",
"review",
"test"
"test",
"ideas"
]
},
{
Expand All @@ -38,7 +39,9 @@
"avatar_url": "https://avatars.githubusercontent.com/u/1488847?v=4",
"profile": "https://github.com/robcast",
"contributions": [
"data"
"data",
"ideas",
"review"
]
},
{
Expand All @@ -50,7 +53,8 @@
"code",
"review",
"test",
"eventOrganizing"
"eventOrganizing",
"ideas"
]
},
{
Expand All @@ -72,5 +76,6 @@
"repoType": "github",
"repoHost": "https://github.com",
"projectName": "undate-python",
"projectOwner": "dh-tech"
"projectOwner": "dh-tech",
"badgeTemplate": "![All Contributors](https://img.shields.io/github/all-contributors/dh-tech/undate-python?color=ee8449&style=flat-square)"
}
8 changes: 4 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
cache: 'pip'
cache-dependency-path: '**/setup.cfg'
cache-dependency-path: '**/pyproject.toml'
- name: Install package with development dependencies
run: pip install -e ".[dev]"
if: steps.python-cache.outputs.cache-hit != 'true'
Expand All @@ -29,7 +29,7 @@ jobs:

# check docs
- name: Check that documentation can be built
run: tox -e docs
run: sphinx-build docs docs/_build # --fail-on-warning

# check types with mypy
- name: Check types in python src directory; install needed types
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@ jobs:
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: '**/setup.cfg'
cache-dependency-path: '**/pyproject.toml'
- name: Install package with dependencies
run: |
pip install -e ".[dev]"
python -m pip install tox tox-gh-actions
pip install -e ".[test]"
if: steps.python-cache.outputs.cache-hit != 'true'

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

# run code coverage in one version only
- name: Run unit tests with code coverage reporting
run: tox -e coverage
run: pytest --cov=undate
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to undate - a python library for working with uncertain or partially known dates
# Contributing to undate

Hey there!

Expand All @@ -20,7 +20,7 @@ If you report a bug, please include any error messages you get and a full descri
## Submitting Use Cases and Example Data
We are particularly interested in collecting more use cases and example data where undate would be helpful!

Example data can be added to the [examples/use-cases](examples/use-cases) folder by a pull request.
Example data can be added to the [examples/](https://github.com/dh-tech/undate-python/tree/main/examples/) folder by a pull request.

## Getting Help
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".
Expand Down
14 changes: 9 additions & 5 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# Contributors
# All Contributors

We use [All Contributors](https://allcontributors.org/) because we recognize that all kinds of contributions are valuable and important.

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
![All Contributors](https://img.shields.io/github/all-contributors/dh-tech/undate-python?color=ee8449&style=flat-square)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<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></td>
<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>
<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>
<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></td>
<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></td>
<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>
<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>
<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>
</tr>
</tbody>
Expand Down
26 changes: 17 additions & 9 deletions DEVELOPER_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pull requests for new features should be made against the **develop** branch.

We recommended installing git-flow.
1. On OSX, use brew or ports, e.g.: `brew install git-flow`; on Ubuntu/Debian, `apt-get install git-flow`
2. Initialize it in your local copy of this repository: run `git flow init` and accept all the defaults.
2. Initialize it in your local copy of this repository: run `git flow init` and accept all the defaults.
3. Use `git flow feature start feature-name` to create a new feature development branch.
4. Feature branches can be merged locally with git flow or by GitHub pull request.
4. Use git flow for releases with `git flow release start x.x.x` and `git flow release finish x.x.x`, where x.x.x is the version number for the new release.
Expand All @@ -45,7 +45,7 @@ Install an editable version of the local package along with python dependencies
pip install -e ".[dev]"
```

## Install pre-commit hooks
### Install pre-commit hooks

```sh
pre-commit install
Expand All @@ -55,15 +55,15 @@ We use [pre-commit](https://pre-commit.com/) for automated checks and consistent

## Tests, documentation, and other checks

## Running unit tests
### Running unit tests

Tests can be run with either `tox` or `pytest`.
Tests can be run with `pytest`.

To run all the tests in a single test file, use pytest and specify the path to the test: `pytest tests/test_dateformat/test_base.py`
To run all the tests in a single test file, specify the path, e.g.: `pytest tests/test_dateformat/test_base.py`

To test cases by name, use pytest: `pytest -k test_str`
To test cases by method name, use `-k`: `pytest -k test_str`

## Check python types
### Check python types

Python typing is currently enforced on pull requests as part of a GitHub Actions Continuous Integration check using `mypy`.

Expand All @@ -74,8 +74,16 @@ mypy --install-types
```
2. Run `mypy src/` to check types.

### Documentation can be built with tox
### Documentation

Documentation can be built with sphinx. Make sure you have the dependencies installed:

```sh
tox -e docs
pip install -e ".[docs]"
```

```sh
sphinx-build docs docs/_build
```

HTML documentation will be generated in `docs/_build/html`
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# undate-python
# undate overview

![undate](_static/undate_logo.png)

**undate** is a python library for working with uncertain or partially known dates.

Expand All @@ -17,7 +19,7 @@ It was initially created as part of a [DH-Tech](https://dh-tech.github.io/) hack
[![codecov](https://codecov.io/gh/dh-tech/undate-python/branch/main/graph/badge.svg?token=GE7HZE8C9D)](https://codecov.io/gh/dh-tech/undate-python)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](CONTRIBUTORS.md)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Read [Contributors](CONTRIBUTORS.md) for detailed contribution information.
Expand All @@ -26,7 +28,8 @@ Read [Contributors](CONTRIBUTORS.md) for detailed contribution information.

Often humanities and cultural data include imprecise or uncertain temporal information. We want to store that information but also work with it in a structured way, not just treat it as text for display. Different projects may need to work with or convert between different date formats or even different calendars.

An `undate.Undate` is analogous to python's builtin `datetime.date` object, but with support for varying degrees of precision and unknown information. You can initialize an undate with either strings or numbers for whichever parts of the date are known or partially known. An `Undate` can take an optional label.
An `undate.Undate` is analogous to python’s builtin `datetime.date` object, but with support for varying degrees of precision and unknown information. You can initialize an undate with either strings or numbers for whichever parts of the date are known or partially known. An `Undate` can take an optional label.

```python
from undate.undate import Undate

Expand Down Expand Up @@ -153,7 +156,7 @@ You can initialize `Undate` or `UndateInterval` objects by parsing a date string

## Documentation

Project documentation is available on ReadTheDocs https://undate-python.readthedocs.io/en/latest/
Project documentation is [available on ReadTheDocs](https://undate-python.readthedocs.io/en/latest/).

For instructions on setting up for local development, see [Developer Notes](DEVELOPER_NOTES.md).

Expand Down
Binary file added _static/undate_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CONTRIBUTING.md
```
2 changes: 2 additions & 0 deletions docs/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CONTRIBUTORS.md
```
2 changes: 2 additions & 0 deletions docs/DEVELOPER_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../DEVELOPER_NOTES.md
```
4 changes: 4 additions & 0 deletions docs/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License

```{include} ../LICENSE.md
```
7 changes: 7 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

div.sphinxsidebar .powered_by a {
text-decoration: none;
border-bottom: none;
text-align: center;
}

Binary file added docs/_static/dhtech-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a375e93

Please sign in to comment.