Skip to content

Commit

Permalink
use pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Apr 29, 2024
1 parent 752680f commit 67b1f1a
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 85 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Check that tag version matches code version
run: |
tag=${GITHUB_REF#refs/tags/}
version=$(python setup.py --version)
echo 'tag='$tag
echo "version file="$version
test "$tag" == "$version"
python-version: 3.x

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist
python -m build
twine upload dist/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,4 @@ _build/
?.*
~*
*.sync
_version.py
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ repos:
- --exit-non-zero-on-fix
- --preview


- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.9.1
hooks:
Expand All @@ -61,3 +62,9 @@ repos:
rev: v0.0.14
hooks:
- id: rstfmt

- repo: https://github.com/b8raoult/pre-commit-docconvert
rev: "0.1.4"
hooks:
- id: docconvert
args: ["numpy"]
8 changes: 6 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- docs
72 changes: 72 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env python
# (C) Copyright 2024 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/

[build-system]
requires = ["setuptools>=60", "setuptools-scm>=8.0"]

[project]
description = "A package to hold various functions to support training of ML models."
name = "anemoi-training"

dynamic = ["version"]
license = { file = "LICENSE" }
requires-python = ">=3.9"

authors = [
{ name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "[email protected]" },
]

keywords = ["tools", "training", "ai"]

classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"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",
]

dependencies = [

]

[project.optional-dependencies]


docs = [
# For building the documentation
]

all = [
]

dev = [
"sphinx",
"sphinx_rtd_theme",
"nbsphinx",
"pandoc",
]

[project.urls]
Homepage = "https://github.com/ecmwf/anemoi-training/"
Documentation = "https://anemoi-training.readthedocs.io/"
Repository = "https://github.com/ecmwf/anemoi-training/"
Issues = "https://github.com/ecmwf/anemoi-training/issues"
# Changelog = "https://github.com/ecmwf/anemoi-training/CHANGELOG.md"


[tool.setuptools_scm]
version_file = "src/anemoi/training/_version.py"
71 changes: 0 additions & 71 deletions setup.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# nor does it submit to any jurisdiction.


__version__ = "0.0.1"
from ._version import __version__

0 comments on commit 67b1f1a

Please sign in to comment.