diff --git a/.gitignore b/.gitignore index b063d17b8..40577c32c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,10 +39,26 @@ htmlcov/ .coverage .coverage.* .cache +.pytest_cache/ nosetests.xml coverage.xml *,cover +# IDEs/editors +.idea/ +.vscode/ + +# Common local virtualenvs +.venv/ + +# Static analysis / formatter caches +.mypy_cache/ +.ruff_cache/ + +# Local agent/tool state (don’t commit) +.codex/ +.agents/ + # Translations *.mo *.pot diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 90f23f54a..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include versioneer.py -include thetis/_version.py diff --git a/readme.md b/README.md similarity index 97% rename from readme.md rename to README.md index c15e74e74..107bb5f24 100644 --- a/readme.md +++ b/README.md @@ -1,5 +1,6 @@ # 🌊 Thetis +[![Weekly Tests (release)](https://github.com/thetisproject/thetis/actions/workflows/weekly-release.yml/badge.svg?branch=release)](https://github.com/thetisproject/thetis/actions/workflows/weekly-release.yml) [![Weekly Tests (main)](https://github.com/thetisproject/thetis/actions/workflows/weekly-main.yml/badge.svg?branch=main)](https://github.com/thetisproject/thetis/actions/workflows/weekly-main.yml) ![Python Version](https://img.shields.io/badge/python-3.10%2B-blue) @@ -47,16 +48,13 @@ pip install -e . > The latest development branch of Thetis (main) will require the corresponding main branch of Firedrake. See the > website for more details. -### Release branch weekly status -[![Weekly Tests (release)](https://github.com/thetisproject/thetis/actions/workflows/weekly-release.yml/badge.svg?branch=release)](https://github.com/thetisproject/thetis/actions/workflows/weekly-release.yml) - --- ## Getting Started To get up and running with Thetis once it has been installed, we recommend checking out the [basic tutorials and documentation](https://thetisproject.org/documentation.html#tutorials). Further examples can then be found in the -repository at [`examples`](./examples). See [`examples/README.md`](./examples/readme.md) for +repository at [`examples`](./examples). See [`examples/README.md`](./examples/README.md) for detailed descriptions of each example script. @@ -83,4 +81,3 @@ If Thetis is helpful in your research, please cite: ## License Thetis is available under the MIT License. See the [LICENSE](./LICENSE) file for details. - diff --git a/_thetis_build_backend.py b/_thetis_build_backend.py new file mode 100644 index 000000000..332376acf --- /dev/null +++ b/_thetis_build_backend.py @@ -0,0 +1 @@ +from setuptools.build_meta import * # noqa: F401,F403 diff --git a/_thetis_version.py b/_thetis_version.py new file mode 100644 index 000000000..b2f2ff18d --- /dev/null +++ b/_thetis_version.py @@ -0,0 +1,50 @@ +from subprocess import CalledProcessError, check_output + + +def _current_month_version(): + try: + head_date = check_output( + ["git", "show", "-s", "--format=%cI", "HEAD"], + text=True, + ).strip() + year, month = (int(part) for part in head_date[:7].split("-")) + except (CalledProcessError, OSError, ValueError): + year, month = 0, 0 + + since = f"{year:04d}-{month:02d}-01T00:00:00+00:00" + try: + count = check_output( + ["git", "rev-list", "--count", f"--since={since}", "HEAD"], + text=True, + ).strip() + except (CalledProcessError, OSError): + count = "0" + return f"{year}.{month}.dev{count}" + + +def _next_release_update(version): + tag = str(version.tag) + if ".post" in tag: + base, post = tag.rsplit(".post", 1) + return f"{base}.post{int(post) + 1}" + + parts = tag.split(".") + if len(parts) >= 2: + return f"{parts[0]}.{parts[1]}.post0" + raise ValueError(f"Unsupported Thetis release tag {tag}") + + +def thetis_version_scheme(version): + if version.exact: + return str(version.tag) + + branch = version.branch or "" + if ( + branch == "release" + or branch.endswith("/release") + or branch.startswith("release-") + or branch.startswith("release/") + ): + return version.format_next_version(_next_release_update) + + return _current_month_version() diff --git a/demos/readme.md b/demos/README.md similarity index 97% rename from demos/readme.md rename to demos/README.md index 8a72ba84a..653edf99a 100644 --- a/demos/readme.md +++ b/demos/README.md @@ -29,4 +29,4 @@ Each tutorial is also available here, so you can run or modify them locally if y ## 📎 Further Examples -Once you've got to grips with the demos, check out the [Thetis examples repository](../examples/readme.md). +Once you've got to grips with the demos, check out the [Thetis examples repository](../examples/README.md). diff --git a/docs/source/_themes/thetis/layout.html b/docs/source/_themes/thetis/layout.html index 56c327333..7dfaacfd6 100644 --- a/docs/source/_themes/thetis/layout.html +++ b/docs/source/_themes/thetis/layout.html @@ -26,7 +26,8 @@