Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyproject.toml for project metadata, use modern build #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/check-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
CDSAPI_URL: https://cds.climate.copernicus.eu/api/v2
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
run: |
python setup.py develop
pip install pytest
python -m pip install --upgrade pip
pip install -e .[tests]
pytest

deploy:
Expand All @@ -78,13 +78,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
python -m build
twine check --strict dist/*
twine upload dist/*

- name: Notify climetlab
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
*.grib
*.nc
cdsapi.egg-info
.coverage
build/
dist/
.tox/
8 changes: 3 additions & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
How to develop
--------------

Install the package following README.rst and then install development dependencies::
Install the package following README.rst and then install development dependencies (``-U`` is optional)::

$ pip install -U -r tests/requirements-dev.txt
$ pip install -U -e .[test]

Unit tests can be run with `pytest <https://pytest.org>`_ with::

Expand All @@ -30,9 +30,7 @@ Please ensure the coverage at least stays the same before you submit a pull requ
Dependency management
---------------------

Update the `requirements-tests.txt` file with versions with::

pip-compile -U -o tests/requirements-tests.txt setup.py tests/requirements-tests.in # -U is optional
Update the ``tests/requirements.txt``.


Release procedure
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[build-system]
requires = ["setuptools >=62.6"]
build-backend = "setuptools.build_meta"

[project]
name = "cdsapi"
version = "0.6.1"
description = "Python API to access the Copernicus Climate Data Store (CDS)"
readme = "README.rst"
authors = [
{name = "ECMWF", email = "[email protected]"},
]
keywords = ["MODFLOW", "groundwater", "hydrogeology"]
license = {text = "Apache-2.0"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
]
requires-python = ">=3.7"
dependencies = [
"requests >=2.5.0",
"tqdm",
]
dynamic = ["optional-dependencies"]

[project.urls]
"Source Code" = "https://github.com/ecmwf/cdsapi"

[tool.setuptools.dynamic.optional-dependencies.tests]
file = "tests/requirements.txt"

[tool.setuptools.packages.find]
include = ["cdsapi", "cdsapi.*"]

[tool.black]
line-length = 120

[tool.coverage.run]
branch = true

[tool.isort]
profile = "black"
line_length = 120

[tool.pytest.ini_options]
norecursedirs = [
"build",
"dist",
".tox",
".eggs",
]
pep8maxlinelength = 109
mccabe-complexity = 10
17 changes: 0 additions & 17 deletions setup.cfg

This file was deleted.

66 changes: 0 additions & 66 deletions setup.py

This file was deleted.

11 changes: 3 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist = qc, py311, py310, py39, py38, py37, pypy3, pypy, deps

[testenv]
setenv = PYTHONPATH = {toxinidir}
deps = -r{toxinidir}/tests/requirements-tests.txt
deps = -r{toxinidir}/tests/requirements.txt
commands = pytest -v --flakes --cache-clear --basetemp={envtmpdir} {posargs}

[testenv:qc]
Expand All @@ -13,12 +13,7 @@ commands = pytest -v --pep8 --mccabe --cov=cdsapi --cov-report=html --cache-clea

[testenv:deps]
deps =
commands = python setup.py test
commands = pytest


[black]
line_length=120
[isort]
profile=black
[flake8]
max-line-length = 120
max-line-length = 120