Skip to content

Commit 93f6dce

Browse files
Move to hatch for building the package, and test/style/doc build scripts. Update READMEs (#11)
* Moved build action to hatch, updated dev readme * Set up hatch environments for tests, styling and docs. * Updated the documentation build action to use checkout & python setup v3. Setup ReadTheDocs. * Updated bumpversion config * Updated README.md to include a reference to s2spy, along with some stray s2spy uses * Updated readme and dev readme to include up to date hatch instructions * Removed prospector. Linting is now handled by Flake8 * Set up Sonarcloud Co-authored-by: Peter Kalverla <[email protected]>
1 parent a5aa777 commit 93f6dce

24 files changed

+241
-314
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
[bumpversion]
2-
current_version = 0.2.0
2+
current_version = 0.2.1
33

44
[comment]
5-
comment = The contents of this file cannot be merged with that of setup.cfg until https://github.com/c4urself/bump2version/issues/185 is resolved
5+
comment = The contents of this file cannot be merged with that of pyproject.toml until https://github.com/c4urself/bump2version/issues/42 is resolved
66

7-
[bumpversion:file:s2spy/__init__.py]
7+
[bumpversion:file:lilio/__init__.py]
88
search = __version__ = "{current_version}"
99
replace = __version__ = "{new_version}"
1010

11-
[bumpversion:file:setup.cfg]
12-
search = version = {current_version}
13-
replace = version = {new_version}
14-
1511
[bumpversion:file:CITATION.cff]
1612
search = version: "{current_version}"
1713
replace = version: "{new_version}"

.github/workflows/build.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
matrix:
1919
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
2020
python-version: ['3.8', '3.9', '3.10']
21+
env:
22+
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
2123
steps:
2224
- uses: actions/checkout@v3
2325
- name: Set up Python ${{ matrix.python-version }}
@@ -29,14 +31,13 @@ jobs:
2931
run: |
3032
which python3
3133
python3 --version
32-
- name: Upgrade pip and install dependencies
34+
- name: Upgrade pip and install hatch
3335
run: |
34-
python3 -m pip install --upgrade pip
35-
python3 -m pip install .[dev]
36+
python3 -m pip install --upgrade pip hatch
3637
- name: Run unit tests
37-
run: pytest -v
38+
run: hatch run test
3839
- name: Verify that we can build the package
39-
run: python3 -m build
40+
run: hatch build
4041

4142
lint:
4243
name: Linting build
@@ -54,11 +55,7 @@ jobs:
5455
run: |
5556
which python3
5657
python3 --version
57-
- name: Upgrade pip and install dependencies
58-
run: |
59-
python3 -m pip install --upgrade pip setuptools
60-
python3 -m pip install .[dev,publishing]
61-
- name: Check style against standards using prospector
62-
run: prospector
63-
- name: Check import order
64-
run: isort --check-only lilio --diff
58+
- name: Upgrade pip and install hatch
59+
run: python3 -m pip install --upgrade pip hatch
60+
- name: Check style against standards
61+
run: hatch run lint

.github/workflows/documentation.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,20 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python 3.9
20-
uses: actions/setup-python@v2
18+
- uses: actions/checkout@v3
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v3
2121
with:
22-
python-version: 3.9
22+
python-version: "3.10"
2323
- name: Python info
2424
shell: bash -l {0}
2525
run: |
2626
which python3
2727
python3 --version
28-
- name: Upgrade pip and install dependencies
28+
- name: Upgrade pip and install hatch
2929
run: |
30-
python3 -m pip install --upgrade pip setuptools
31-
python3 -m pip install .[dev,publishing]
30+
python3 -m pip install --upgrade pip hatch
3231
- name: Install pandoc using apt
3332
run: sudo apt install pandoc
3433
- name: Build documentation
35-
run: make coverage doctest html
36-
working-directory: docs
34+
run: hatch run docs:build

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ jobs:
2727
run: |
2828
which python3
2929
python3 --version
30-
- name: Install dependencies
31-
run: python3 -m pip install .[dev]
32-
- name: Check style against standards using prospector
33-
run: prospector --zero-exit --output-format grouped --output-format pylint:pylint-report.txt
30+
- name: Install hatch
31+
run: python3 -m pip install hatch
3432
- name: Run unit tests with coverage
35-
run: pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/
33+
run: hatch run coverage
3634
- name: Correct coverage paths
3735
run: sed -i "s+$PWD/++g" coverage.xml
3836
- name: SonarCloud Scan

.prospector.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ python:
1010
- method: pip
1111
path: .
1212
extra_requirements:
13-
- dev
13+
- docs

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
3939
- Implemented resampling data to the advent calendar.
4040
- Example notebooks on how to use the calendar and resampling functionalities.
4141

42-
[Unreleased]: https://github.com/AI4S2S/s2spy
42+
[Unreleased]: https://github.com/AI4S2S/lilio

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
# lilio: Calendar generator for machine learning with timeseries data
22

3-
<img align="right" width="160" alt="Logo" src="https://raw.githubusercontent.com/AI4S2S/s2spy/main/docs/assets/images/ai4s2s_logo.png">
3+
<img align="right" width="160" alt="Logo" src="https://raw.githubusercontent.com/AI4S2S/lilio/main/docs/assets/images/ai4s2s_logo.png">
44

55

66
[![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/AI4S2S/lilio)
77
[![github license badge](https://img.shields.io/github/license/AI4S2S/lilio)](https://github.com/AI4S2S/lilio)
88
[![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu)
9-
<!--
109
[![Documentation Status](https://readthedocs.org/projects/ai4s2s/badge/?version=latest)](https://ai4s2s.readthedocs.io/en/latest/?badge=latest)
1110
[![build](https://github.com/AI4S2S/lilio/actions/workflows/build.yml/badge.svg)](https://github.com/AI4S2S/lilio/actions/workflows/build.yml)
1211
[![sonarcloud](https://github.com/AI4S2S/lilio/actions/workflows/sonarcloud.yml/badge.svg)](https://github.com/AI4S2S/lilio/actions/workflows/sonarcloud.yml)
13-
[![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project=AI4S2S_ai4s2s&metric=coverage)](https://sonarcloud.io/dashboard?id=AI4S2S_ai4s2s)
14-
-->
12+
[![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project=AI4S2S_lilio&metric=coverage)](https://sonarcloud.io/dashboard?id=AI4S2S_lilio)
13+
14+
A python package for generating calendars to resample timeseries into training and target data for machine learning. Named after [the inventor](https://en.wikipedia.org/wiki/Aloysius_Lilius) of the [Gregorian Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar).
1515

16-
A python package for generating calendars to resample timeseries into training and target data for machine learning.
16+
Lilio was originally designed for use in [`s2spy`](https://github.com/AI4S2S/s2spy), a high-level python package integrating expert knowledge and artificial intelligence to boost (sub) seasonal forecasting.
1717

1818
## Installation
19-
<!--
2019
[![workflow pypi badge](https://img.shields.io/pypi/v/lilio.svg?colorB=blue)](https://pypi.python.org/project/lilio/)
2120
[![supported python versions](https://img.shields.io/pypi/pyversions/lilio)](https://pypi.python.org/project/lilio/)
2221

2322
To install the latest release of lilio, do:
2423
```console
2524
python3 -m pip install lilio
2625
```
27-
-->
2826

2927
To install the in-development version from the GitHub repository, do:
3028

@@ -33,24 +31,26 @@ python3 -m pip install git+https://github.com/AI4S2S/lilio.git
3331
```
3432

3533
### Configure the package for development and testing
34+
A more extensive developer guide can be found [here](./docs/README.dev.md).
35+
3636
The testing framework used here is [pytest](https://pytest.org). Before running the test, we get a local copy of the source code and install `lilio` via the command:
3737

3838
```py
3939
git clone https://github.com/AI4S2S/lilio.git
4040
cd lilio
41-
python3 -m pip install -e .
41+
python3 -m pip install -e .[dev]
4242
```
4343

4444
Then, run tests:
4545
```py
46-
python3 -m pytest
46+
hatch run test
4747
```
4848

4949
## How the lilio calendars work
5050
In a typical ML-based timeseries analysis, the first step is always data processing. A calendar-based datetime module `time` is implemented for time operations. For instance, a user is looking for predictors for winter climate at seasonal timescales (~180 days). First, a `calendar` object is created using `AdventCalendar`:
5151

5252
```py
53-
>>> calendar = s2spy.time.AdventCalendar(anchor="11-30", freq='180d')
53+
>>> calendar = lilio.time.AdventCalendar(anchor="11-30", freq='180d')
5454
>>> calendar = calendar.map_years(2020, 2021)
5555
>>> calendar.show()
5656
i_interval -1 1
@@ -63,7 +63,7 @@ Now, the user can load the data `input_data` (e.g. `pandas` `DataFrame`) and res
6363

6464
```py
6565
>>> calendar = calendar.map_to_data(input_data)
66-
>>> bins = s2spy.time.resample(calendar, input_data)
66+
>>> bins = lilio.time.resample(calendar, input_data)
6767
>>> bins
6868
anchor_year i_interval interval mean_data target
6969
0 2020 -1 [2020-06-03, 2020-11-30) 275.5 True
@@ -78,11 +78,11 @@ Depending on data preparations, we can choose different types of calendars e.g.
7878
## Tutorials
7979
`lilio` supports operations that are common in a machine learning pipeline of sub-seasonal to seasonal forecasting research. Tutorials covering supported methods and functionalities are listed in [notebooks](https://github.com/AI4S2S/lilio/tree/main/notebooks). To check these notebooks, users need to install [`Jupyter lab`](https://jupyter.org/). More details about each method can be found in this [API reference documentation](https://ai4s2s.readthedocs.io/en/latest/autoapi/index.html).
8080

81+
-->
8182
## Documentation
82-
[![Documentation Status](https://readthedocs.org/projects/ai4s2s/badge/?version=latest)](https://ai4s2s.readthedocs.io/en/latest/?badge=latest)
83+
[![Documentation Status](https://readthedocs.org/projects/lilio/badge/?version=latest)](https://lilio.readthedocs.io/en/latest/?badge=latest)
8384

84-
For detailed information on using `s2spy` package, visit the [documentation page](https://ai4s2s.readthedocs.io/en/latest/) hosted at Readthedocs.
85-
-->
85+
For detailed information on using `lilio` package, visit the [documentation page](https://lilio.readthedocs.io/en/latest/) hosted at Readthedocs.
8686

8787
## Contributing
8888

docs/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ This section is for maintainers of the package.
6161

6262
9. Create a PyPI release.
6363

64-
1. Create distribution archives with `python3 -m build`.
65-
2. Upload archives to PyPI with `twine upload dist/*` (use your
64+
1. Create distribution archives with `hatch build`.
65+
2. Upload archives to PyPI with `hatch publish` (use your
6666
personal PyPI account).
6767

6868
10. Verify

0 commit comments

Comments
 (0)