forked from earthobservations/wetterdienst
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use pyproject.toml instead of setup.py and requirements.txt
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
Showing
10 changed files
with
204 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Coverage | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# https://cjolowicz.github.io/posts/hypermodern-python-03-linting/ | ||
import os | ||
from typing import Any | ||
import tempfile | ||
|
||
import nox | ||
from nox.sessions import Session | ||
|
||
|
||
@nox.session(python=["3.7", "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) | ||
|
||
|
||
def install_with_constraints( | ||
session: Session, *args: str, **kwargs: Any | ||
) -> None: | ||
""" | ||
Install packages constrained by Poetry's lock file. | ||
This function is a wrapper for nox.sessions.Session.install. It | ||
invokes pip to install packages inside of the session's virtualenv. | ||
Additionally, pip is passed a constraints file generated from | ||
Poetry's lock file, to ensure that the packages are pinned to the | ||
versions specified in poetry.lock. This allows you to manage the | ||
packages as Poetry development dependencies. | ||
Arguments: | ||
session: The Session object. | ||
args: Command-line arguments for pip. | ||
kwargs: Additional keyword arguments for Session.install. | ||
""" | ||
req_path = os.path.join(tempfile.gettempdir(), os.urandom(24).hex()) | ||
session.run( | ||
"poetry", | ||
"export", | ||
"--dev", | ||
"--format=requirements.txt", | ||
f"--output={req_path}", | ||
external=True, | ||
) | ||
session.install(f"--constraint={req_path}", *args, **kwargs) | ||
os.unlink(req_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.