Skip to content

Commit

Permalink
32 update repos to current standards (#61)
Browse files Browse the repository at this point in the history
* from setup.py to pyproject.toml

* fixed installation and updated github links to deltares

* Bump version: 0.2.0 → 0.2.1

* enable github testbank

* added readme badges

* added pypi upload workflow
  • Loading branch information
veenstrajelmer authored Mar 11, 2024
1 parent 80fc95b commit d20d6b7
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 123 deletions.
12 changes: 12 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[bumpversion]
current_version = 0.2.1
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:ddlpy/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* Data Distributie Laag. Service from Rijkswaterstaat for distributing water quantity data. version:
* Python version:
* Operating System:
* ddlpy version:
* Python version:
* Operating System:

### Description

Expand All @@ -9,7 +9,7 @@ Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

```
```python
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
27 changes: 27 additions & 0 deletions .github/workflows/pypi-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pypi-upload

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine check dist/*
twine upload dist/*
44 changes: 44 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: pytest

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:

strategy:
fail-fast: false
matrix:
# we assume it also works for inbetween versions
python-version: ["3.8", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: list env contents
run: |
pip list
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -m "not requireslocaldata" --cov=ddlpy --cov-report xml --cov-report term
- uses: codecov/codecov-action@v1
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ deploy:
secure: PLEASE_REPLACE_ME
on:
tags: true
repo: SiggyF/ddlpy
repo: Deltares/ddlpy
python: 3.6
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Types of Contributions
Report Bugs
~~~~~~~~~~~

Report bugs at https://github.com/SiggyF/ddlpy/issues.
Report bugs at https://github.com/deltares/ddlpy/issues.

If you are reporting a bug, please include:

Expand Down Expand Up @@ -45,7 +45,7 @@ articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~

The best way to send feedback is to file an issue at https://github.com/SiggyF/ddlpy/issues.
The best way to send feedback is to file an issue at https://github.com/deltares/ddlpy/issues.

If you are proposing a feature:

Expand Down Expand Up @@ -103,7 +103,7 @@ Before you submit a pull request, check that it meets these guidelines:
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check
https://travis-ci.org/SiggyF/ddlpy/pull_requests
https://travis-ci.org/deltares/ddlpy/pull_requests
and make sure that the tests pass for all supported Python versions.

Tips
Expand Down
18 changes: 9 additions & 9 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ History

UNRELEASED
------------------
* improved nan filtering of measurements in https://github.com/openearth/ddlpy/pull/30
* add `ddlpy.measurements_available()` check in https://github.com/openearth/ddlpy/pull/33 and https://github.com/openearth/ddlpy/pull/58
* add `ddlpy.measurements_latest()` to retrieve latest measurements in https://github.com/openearth/ddlpy/pull/35
* add optional time-sorting of returned measurements dataframe and made drop_duplicates optional in https://github.com/openearth/ddlpy/pull/37
* add support for time strings in addition to `pd.Timestamp` and `dt.datetime` in https://github.com/openearth/ddlpy/pull/41
* add `ddlpy.simplify_dataframe()` function which drops constant columns and adds the properties as attrs in https://github.com/openearth/ddlpy/pull/43
* consistency improvements for `ddlpy.measurements()` output dataframe in https://github.com/openearth/ddlpy/pull/45
* add distinction for Groepering (timeseries vs. extremes) to `ddlpy.locations()` dataframe in https://github.com/openearth/ddlpy/pull/49
* drop `Tijdstip` column in `ddlpy.measurements()` output dataframe to avoid duplication with time index in https://github.com/openearth/ddlpy/pull/52 and https://github.com/openearth/ddlpy/pull/54
* improved nan filtering of measurements in https://github.com/deltares/ddlpy/pull/30
* add `ddlpy.measurements_available()` check in https://github.com/deltares/ddlpy/pull/33 and https://github.com/deltares/ddlpy/pull/58
* add `ddlpy.measurements_latest()` to retrieve latest measurements in https://github.com/deltares/ddlpy/pull/35
* add optional time-sorting of returned measurements dataframe and made drop_duplicates optional in https://github.com/deltares/ddlpy/pull/37
* add support for time strings in addition to `pd.Timestamp` and `dt.datetime` in https://github.com/deltares/ddlpy/pull/41
* add `ddlpy.simplify_dataframe()` function which drops constant columns and adds the properties as attrs in https://github.com/deltares/ddlpy/pull/43
* consistency improvements for `ddlpy.measurements()` output dataframe in https://github.com/deltares/ddlpy/pull/45
* add distinction for Groepering (timeseries vs. extremes) to `ddlpy.locations()` dataframe in https://github.com/deltares/ddlpy/pull/49
* drop `Tijdstip` column in `ddlpy.measurements()` output dataframe to avoid duplication with time index in https://github.com/deltares/ddlpy/pull/52 and https://github.com/deltares/ddlpy/pull/54

0.1.0 (2019-01-03)
------------------
Expand Down
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
[![pypi-image](https://img.shields.io/pypi/v/ddlpy.svg)](https://pypi.python.org/pypi/ddlpy)
[![image](https://img.shields.io/travis/deltares/ddlpy.svg)](https://travis-ci.org/deltares/ddlpy)
[![Documentation Status](https://readthedocs.org/projects/rws-ddlpy/badge/?version=latest)](https://rws-ddlpy.readthedocs.io/en/latest/?badge=latest)
[![Updates](https://pyup.io/repos/github/deltares/ddlpy/shield.svg)](https://pyup.io/repos/github/deltares/ddlpy/)
[![pytest](https://github.com/Deltares/ddlpy/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/Deltares/ddlpy/actions/workflows/pytest.yml)
[![codecov](https://img.shields.io/codecov/c/github/deltares/ddlpy.svg?style=flat-square)](https://app.codecov.io/gh/deltares/ddlpy?displayType=list)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares_ddlpy&metric=alert_status)](https://sonarcloud.io/summary/overall?id=Deltares_ddlpy)
[![Supported versions](https://img.shields.io/pypi/pyversions/ddlpy.svg)](https://pypi.org/project/ddlpy)
[![Downloads](https://img.shields.io/pypi/dm/ddlpy.svg)](https://pypistats.org/packages/ddlpy)

# ddlpy

(D)ata (D)istributie (L)aag is a service from Rijkswaterstaat for distributing water quantity data. This package provides an API for python.

[![pypi-image](https://img.shields.io/pypi/v/rws-ddlpy.svg)](https://pypi.python.org/pypi/rws-ddlpy)

[![image](https://img.shields.io/travis/openearth/ddlpy.svg)](https://travis-ci.org/openearth/ddlpy)

[![Documentation Status](https://readthedocs.org/projects/rws-ddlpy/badge/?version=latest)](https://rws-ddlpy.readthedocs.io/en/latest/?badge=latest)

[![Updates](https://pyup.io/repos/github/openearth/ddlpy/shield.svg)](https://pyup.io/repos/github/openearth/ddlpy/)

Service from Rijkswaterstaat for distributing water quantity data.

- Free software: GNU General Public License v3
- Documentation: <https://ddlpy.readthedocs.io>.


See also https://github.com/wstolte/rwsapi for the R API.


# Install
Make sure you have installed:

* pandas
* numpy
* click
* python-dateutil>=2.8

This text will be updated soon and a new pypi release will also happen soon.
The latest ddlpy PyPI release is outdated, but it can be installed with:

pip install rws-ddlpy

The newest version is currently installed directly from github with:

pip install git+https://github.com/openearth/ddlpy
pip install git+https://github.com/deltares/ddlpy

In the folder examples you will find the following files:

* minimal example.py -> minimal code to retrieve data.

* 1_get_data_from_water_info_parallel.py -> Code to retrieve a bulk of observations per parameter and per station.

This code is parallelized; therefore, you can specify the number of processors you want to use.

The output of this code is the data in csv format.

* 2_get_netcdf.py -> Code to transform the csv files run in the previous script into netcdf files.
Expand Down
2 changes: 1 addition & 1 deletion ddlpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = """Fedor Baart"""
__email__ = 'fedor.baart@deltares.nl'
__version__ = '0.2.0'
__version__ = '0.2.1'

from ddlpy.ddlpy import locations
from ddlpy.ddlpy import (measurements,
Expand Down
8 changes: 4 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ You can either clone the public repository:

.. code-block:: console
$ git clone git://github.com/SiggyF/ddlpy
$ git clone git://github.com/deltares/ddlpy
Or download the `tarball`_:

.. code-block:: console
$ curl -OL https://github.com/SiggyF/ddlpy/tarball/master
$ curl -OL https://github.com/deltares/ddlpy/tarball/master
Once you have a copy of the source, you can install it with:

Expand All @@ -47,5 +47,5 @@ Once you have a copy of the source, you can install it with:
$ python setup.py install
.. _Github repo: https://github.com/SiggyF/ddlpy
.. _tarball: https://github.com/SiggyF/ddlpy/tarball/master
.. _Github repo: https://github.com/deltares/ddlpy
.. _tarball: https://github.com/deltares/ddlpy/tarball/master
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[build-system]
requires = ["setuptools>=64.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ddlpy"
version = "0.2.1"
maintainers = [
{ name = "Fedor Baart", email = "fedor.baart@deltares.nl"},
{ name = "Jelmer Veenstra", email = "jelmer.veenstra@deltares.nl"},
]
description = "Service from Rijkswaterstaat for distributing water quantity data."
readme = "README.md"
keywords = ["ddlpy"]
license = { text = "GPLv3" }
requires-python = ">=3.8"
dependencies = [
#numpy 1.21 is EOL since june 2023
"numpy>=1.22",
"pandas",
"python-dateutil>=2.8",
"tqdm",
"click",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8", # TODO: update this
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Home = "https://github.com/deltares/ddlpy"
Code = "https://github.com/deltares/ddlpy"
Issues = "https://github.com/deltares/ddlpy/issues"

[project.optional-dependencies]
dev = [ #TODO: maybe remove some of these
"bump2version>=0.5.11",
"flake8",
"pytest>=3.8.2",
"pytest-cov",
"twine",
"build",
"watchdog>=0.9.0",
"flake8>=3.5.0",
"tox>=3.5.2",
"coverage>=4.5.1",
"Sphinx>=1.8.1",
"twine>=1.12.1",
"pytest-runner>=4.2",
]
examples = [
"jupyter",
"notebook",
]

[project.scripts]
ddlpy = "ddlpy.cli:cli"

[tool.setuptools]
packages = ["ddlpy"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--durations=0"

[tool.flake8]
exclude = "docs"
25 changes: 0 additions & 25 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit d20d6b7

Please sign in to comment.