From 9d7961a1a2e969e2b440c3a6f610b3b218eb44c3 Mon Sep 17 00:00:00 2001 From: tomaschor Date: Thu, 15 May 2025 10:54:06 -0300 Subject: [PATCH 1/3] create pyproject.toml --- pynanigans/__init__.py | 8 +++++++- pyproject.toml | 29 +++++++++++++++++++++++++++++ setup.py | 8 +++++++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml diff --git a/pynanigans/__init__.py b/pynanigans/__init__.py index e181608..4d4f7e2 100644 --- a/pynanigans/__init__.py +++ b/pynanigans/__init__.py @@ -1,4 +1,10 @@ -__version__ = "0.2.0" +import tomli +from pathlib import Path + +# Read version from pyproject.toml +with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as f: + pyproject = tomli.load(f) + __version__ = pyproject["project"]["version"] from .grids import get_metrics, get_coords, get_grid from .utils import * diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6c03557 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=45", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pynanigans" +version = "0.2.0" +description = "A Python package for working with Oceananigans data" +readme = "README.md" +requires-python = ">=3.9" +license = {text = "MIT"} +authors = [ + {name = "Tomas Chor", email = "contact@tomaschor.xyz"} +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", +] +dependencies = [ + "numpy", + "xarray", + "xgcm", + "matplotlib", +] + +[project.urls] +Homepage = "https://github.com/tomchor/pynanigans" diff --git a/setup.py b/setup.py index f6e9afa..d8710e3 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,14 @@ from setuptools import setup, find_packages +import tomli + +# Read version from pyproject.toml +with open("pyproject.toml", "rb") as f: + pyproject = tomli.load(f) + version = pyproject["project"]["version"] setup( name="pynanigans", - version="0.1.0", + version=version, packages=find_packages(), install_requires=[ "numpy", From d144e979945faaa45e8f70ea8d35b9d1625786aa Mon Sep 17 00:00:00 2001 From: tomaschor Date: Thu, 15 May 2025 10:57:52 -0300 Subject: [PATCH 2/3] add tomli to dependencies --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6c03557..07da178 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=45", "wheel"] +requires = ["setuptools>=45", "wheel", "tomli"] build-backend = "setuptools.build_meta" [project] From 44fc50c333e86d4bebca522c9bb57734fd6e3500 Mon Sep 17 00:00:00 2001 From: tomaschor Date: Thu, 15 May 2025 11:02:31 -0300 Subject: [PATCH 3/3] install tomli on github actions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a54d1be..a7da8b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest pytest-cov + pip install pytest pytest-cov tomli pip install -e . - name: Run tests