Skip to content

Commit

Permalink
Use pyproject.toml instead of setup.py and requirements.txt
Browse files Browse the repository at this point in the history
As outlined within earthobservations#85, we might want to use the modern technologies
and standards for describing project metadata like PEP-517, PEP-518
and PEP-621. This is a first step and already seems to work very well.
  • Loading branch information
amotl committed Jun 23, 2020
1 parent 46f2264 commit 675ae66
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 75 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/codecov.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/coverage.yml
@@ -0,0 +1,20 @@
name: Coverage
on: [push]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Acquire sources
uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.7
architecture: x64
- name: Generate coverage report
run: |
pip install nox==2019.11.9
pip install poetry==1.0.5
- run: nox --sessions tests-3.7 coverage
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
@@ -0,0 +1,22 @@
name: Tests
on: push
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8']
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: pip install nox==2019.11.9
- run: pip install poetry==1.0.5
- run: nox
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@

Python Library For Accessing Weather Data From German Weather Service

![CI](https://github.com/earthobservations/python_dwd/workflows/CI/badge.svg?branch=master)
![Tests](https://github.com/earthobservations/python_dwd/workflows/Tests/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/earthobservations/python_dwd/branch/master/graph/badge.svg)](https://codecov.io/gh/earthobservations/python_dwd)

## 1. Introduction
Expand Down Expand Up @@ -143,6 +143,24 @@ Also this data doesn't include the **STATE** information, which sometimes can be

Feel free to use the library if you want to automate the data access and analyze the german climate. Be aware that it could happen that the server is blocking the ftp client once in a while. It could be useful though to use a try-except-block and retry to get the data. For further examples of this library check the notebook **python_dwd_example.ipynb** in the **example** folder!

## 8. Getting started

```
# Acquire sources
git clone https://github.com/earthobservations/python_dwd
cd python_dwd
# Install dependencies
poetry install
# Run tests
poetry run pytest
# Invoke comand line tool
poetry shell
dwd --help
```

____

## Docker support
Expand Down
6 changes: 6 additions & 0 deletions noxfile.py
@@ -0,0 +1,6 @@
@nox.session(python="3.8")
def coverage(session: Session) -> None:
"""Upload coverage data."""
install_with_constraints(session, "coverage[toml]", "codecov")
session.run("coverage", "xml", "--fail-under=0")
session.run("codecov", *session.posargs)
76 changes: 76 additions & 0 deletions pyproject.toml
@@ -0,0 +1,76 @@
[tool.poetry]
name = "python_dwd"
version = "0.1.0"
description = "Python Library For Accessing Weather Data From German Weather Service"
authors = ["Benjamin Gutzmann <gutzemann@gmail.com>"]
maintainers = ["Daniel Lassahn <daniel.lassahn@gmail.com>", "Andreas Motl <andreas.motl@panodata.org>"]
license = "MIT"
readme = "README.md"
include = ["LICENSE.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", "DWD_FTP_STRUCTURE.md"]
repository = "https://github.com/earthobservations/python_dwd"
keywords = ["dwd", "weather", "observations", "forecasts", "weather-data", "open-data"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT",
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"Topic :: Communications",
"Topic :: Database",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Archiving",
"Topic :: Text Processing",
"Topic :: Utilities",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS"
]

[tool.poetry.dependencies]
python = "^3.8"
pandas = "1.0.4"
tables = "3.6.1"
numpy = "1.18.3"
scipy = "1.4.1"
h5py = "2.10.0"
cachetools = "^3.1.1"
pathlib = "^1.0.1"
aiofiles = "^0.4.0"
fire = "^0.3.1"
docopt = "^0.6.2"
munch = "^2.5.0"
dateparser = "^0.7.4"

# Optional dependencies aka. "extras"
ipython = { version = "^7.10.1", optional = true }
ipython-genutils = { version = "^0.2.0", optional = true }
matplotlib = { version = "^3.0.3", optional = true }
importlib_metadata = {version = "^1.6.1", python = "<3.8"}

[tool.poetry.extras]
ipython = ["ipython", "ipython-genutils", "matplotlib"]

[tool.poetry.dev-dependencies]
pytest = "^5.4"
mock = "^4.0"
codecov = "^2.1.7"

[tool.poetry.scripts]
dwd = 'python_dwd.cli:run'

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
15 changes: 13 additions & 2 deletions python_dwd/__init__.py
@@ -1,5 +1,3 @@
from python_dwd.version import __version__

from python_dwd.metadata_dwd import metadata_for_dwd_data
from python_dwd.file_path_handling.file_list_creation import \
create_file_list_for_dwd_server
Expand All @@ -9,3 +7,16 @@
from python_dwd.additionals.geo_location import get_nearest_station
from python_dwd.data_collection import collect_dwd_data
from python_dwd.dwd_station_request import DWDStationRequest


# Single-sourcing the package version
# https://cjolowicz.github.io/posts/hypermodern-python-06-ci-cd/
try:
from importlib.metadata import version, PackageNotFoundError # type: ignore
except ImportError: # pragma: no cover
from importlib_metadata import version, PackageNotFoundError # type: ignore

try:
__version__ = version(__name__)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
1 change: 0 additions & 1 deletion python_dwd/version.py

This file was deleted.

17 changes: 0 additions & 17 deletions requirements.txt

This file was deleted.

23 changes: 0 additions & 23 deletions setup.py

This file was deleted.

0 comments on commit 675ae66

Please sign in to comment.