Skip to content

Commit 767eda3

Browse files
pyproject definition (#1067)
* use pyproject.toml instead of setup.py for project definition * update env_climada.yml * pitch black * increase consistency, add comments in env_climada.yml * clean up * remove the 'dev' extra dependencies * update config and doc * fix ci.yml workflow * adapt install_env.sh script * reformat pip installation path * force rebuild * setuptools_scm is actually needed for package data
1 parent 1ebd005 commit 767eda3

7 files changed

Lines changed: 113 additions & 129 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
-
4848
name: Install CLIMADA
4949
run: |
50-
python -m pip install ".[test]"
50+
python -m pip install "./[dev]"
5151
-
5252
name: Run Unit Tests
5353
run: |

climada/engine/unsequa/calc_cost_benefit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def _map_costben_calc(
398398
ent_future=ent_fut,
399399
save_imp=False,
400400
assign_centroids=False,
401-
**cost_benefit_kwargs
401+
**cost_benefit_kwargs,
402402
)
403403
# Extract from climada.impact the chosen metrics
404404
uncertainty_values.append(

doc/getting-started/install.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ They are also not needed for using CLIMADA.
263263
However, if you want to develop CLIMADA, we strongly recommend you install them.
264264

265265
With the ``climada_env`` activated, enter the workspace directory and then the CLIMADA repository as above.
266-
Then, add the ``dev`` extra specification to the ``pip install`` command (**mind the quotation marks**, and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):
266+
Then, add the ``test`` extra specification to the ``pip install`` command (**mind the quotation marks**,
267+
and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):
267268

268269
.. code-block:: shell
269270
@@ -277,12 +278,10 @@ The CLIMADA Python package defines the following `extras <https://peps.python.or
277278

278279
* - Extra
279280
- Includes Dependencies...
280-
* - ``doc``
281-
- for building documentation
282-
* - ``test``
283-
- for running and evaluating tests
284281
* - ``dev``
285-
- combination of ``doc`` and ``test``, and additional tools for development
282+
- for developers, needed for running and evaluating tests and pre-commit actions
283+
* - ``doc``
284+
- for building the documentation files from in-source pydoc annotations
286285

287286
The developer dependencies also include `pre-commit <https://pre-commit.com/#intro>`_, which is used to install and run automated, so-called pre-commit hooks before a new commit.
288287
In order to use the hooks defined in ``.pre-commit-config.yaml``, you need to install the hooks first.

pyproject.toml

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
11
[build-system]
2-
requires = ["setuptools >= 64"]
2+
requires = ["setuptools >= 64", "setuptools_scm >= 8"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "climada"
7+
version = "6.0.2-dev"
8+
description = "Framework for climate risk assessment and adaptation option appraisal"
9+
readme = "README.md"
10+
requires-python = ">=3.10,<3.13"
11+
license = { text = "GNU General Public License v3 (GPLv3)" }
12+
authors = [
13+
{ name = "ETH", email = "climada-info@sympa.ethz.ch" }
14+
]
15+
keywords = ["climate", "adaptation"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Programming Language :: Python :: 3",
19+
"Topic :: Scientific/Engineering :: Atmospheric Science",
20+
"Topic :: Scientific/Engineering :: GIS",
21+
"Topic :: Scientific/Engineering :: Mathematics"
22+
]
23+
dependencies = [
24+
"bayesian-optimization",
25+
"bottleneck",
26+
"cartopy",
27+
"cfgrib",
28+
"contextily",
29+
"dask",
30+
"deprecation",
31+
"fiona",
32+
"gdal",
33+
"geopandas",
34+
"h5py",
35+
"haversine",
36+
"matplotlib",
37+
"netcdf4",
38+
"numba",
39+
"openpyxl",
40+
"overpy",
41+
"pandas",
42+
"pathos",
43+
"peewee",
44+
"pillow",
45+
"pint",
46+
"pyarrow",
47+
"pycountry",
48+
"pyproj",
49+
"rasterio",
50+
"salib",
51+
"scikit-learn",
52+
"seaborn",
53+
"sparse",
54+
"statsmodels",
55+
"tables",
56+
"tabulate",
57+
"tqdm",
58+
"xarray",
59+
"xlrd",
60+
"xlsxwriter"
61+
]
62+
63+
[project.optional-dependencies]
64+
doc = [
65+
"ipython",
66+
"myst-nb",
67+
"readthedocs-sphinx-ext>=2.2",
68+
"sphinx",
69+
"sphinx-book-theme",
70+
"sphinx-markdown-tables",
71+
"sphinx-design",
72+
"sphinx-mdinclude"
73+
]
74+
dev = [
75+
"ipython",
76+
"mccabe>=0.6",
77+
"pylint>=3.0",
78+
"pytest",
79+
"pytest-cov",
80+
"pytest-subtests",
81+
"pre-commit"
82+
]
83+
84+
[project.urls]
85+
Homepage = "https://github.com/CLIMADA-project/climada_python"
86+
87+
[tool.setuptools]
88+
include-package-data = true
89+
90+
[tool.setuptools.packages.find]
91+
include = ["climada*"]

requirements/env_climada.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,48 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- bottleneck>=1.4
6+
- bayesian-optimization>=1.5,<2.0
7+
- bottleneck>=1.5
78
- cartopy>=0.24
89
- cfgrib>=0.9
910
- contextily>=1.6
10-
- dask>=2025.2
11-
- eccodes>=2.40
11+
- dask>=2025.5
12+
- deprecation>=2.1
13+
- eccodes>=2.41
1214
- fiona>=1.10
1315
- gdal>=3.10
1416
- geopandas>=0.14
15-
- h5py>=3.12
17+
- h5py>=3.13
1618
- haversine>=2.9
1719
- matplotlib-base>=3.10
1820
- netcdf4>=1.7
1921
- numba>=0.61
2022
- numexpr>=2.10
2123
- openpyxl>=3.1
22-
- osm-flex>=1.1
24+
- osm-flex>=1.1 # this is only required for running the tutorials, not for the CLIMADA package itself
2325
- pandas>=2.1
2426
- pathos>=0.3
27+
- peewee>=3.17
2528
- pint>=0.24
2629
- pip
30+
- pyarrow>=20.0
2731
- pycountry>=24.6
2832
- pyproj>=3.7
29-
- pytables>=3.10
33+
- pytables>=3.10 # this is the name of the pypi 'tables' package on conda-forge
34+
- python>=3.10,<3.13
3035
- pyxlsb>=1.0
3136
- rasterio>=1.4
3237
- requests>=2.32
33-
- rtree>=1.3,<1.4 # 1.4.0 doesn't pass the `pip check`
38+
- rtree>=1.3,<1.4 # 1.4.0 doesn't pass the `pip check`, needed by geopandas
3439
- salib>=1.5
35-
- seaborn>=0.13
36-
- scikit-learn>=1.6
40+
- scikit-learn>=1.7
3741
- scipy>=1.14,<1.15 # 1.15 is not compatible with climada_petals, climada_petals.engine.test.test_supplychain fails with "'Series' has no attribute 'nonzero'"
38-
- sparse>=0.15
42+
- seaborn>=0.13
43+
- sparse>=0.17
3944
- statsmodels>=0.14
4045
- tabulate>=0.9
4146
- tqdm>=4.67
4247
- unittest-xml-reporting>=3.2
43-
- xarray>=2025.1
48+
- xarray>=2025.6
4449
- xlrd>=2.0
4550
- xlsxwriter>=3.2

script/jenkins/install_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mamba create -n climada_env python=3.11
55
mamba env update -n climada_env -f requirements/env_climada.yml
66

77
source activate climada_env
8-
python -m pip install -e "./[test]"
8+
python -m pip install -e "./[dev]"
99

1010
make install_test
1111

setup.py

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

0 commit comments

Comments
 (0)