From 08baf0bdf59453b5b6fe335368be8d54509a87c1 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:12:44 +0200 Subject: [PATCH 1/4] Add git_archival file as per https://setuptools-scm.readthedocs.io/en/latest/usage/#git-archives --- .git_archival.txt | 3 +++ .gitattributes | 1 + 2 files changed, 4 insertions(+) create mode 100644 .git_archival.txt create mode 100644 .gitattributes diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..7c51009 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,3 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a7b00 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst From 24f087cb849b8ab71e13742de768f0f39c284d56 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:51:24 +0200 Subject: [PATCH 2/4] disable codecov comments --- codecov.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..e460ba2 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,5 @@ +comment: + false + +# When modifying this file, please validate using +# curl -X POST --data-binary @codecov.yml https://codecov.io/validate From 3aeeabcc236a7fc6a6ad5a5b04a6089fd2aefa4d Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:05:53 +0200 Subject: [PATCH 3/4] update linkcode resolve --- docs/conf.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 3a2d29f..82a8fb5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -86,6 +86,13 @@ myst_enable_extensions = ["dollarmath", "amsmath"] +def is_non_standard_version(version): + """ + Determine if the given version string has more than 3 components (e.g., from a developer version). + """ + + return len(version.split(".")) > 3 + # based on pandas doc/source/conf.py def linkcode_resolve(domain, info): """Determine the URL corresponding to Python object.""" @@ -136,10 +143,10 @@ def linkcode_resolve(domain, info): fn = os.path.relpath(fn, start=os.path.dirname(plasticparcels.__file__)) - if "-" in plasticparcels.__version__: - return f"https://github.com/OceanParcels/plasticparcels/blob/master/plasticparcels/{fn}{linespec}" + if is_non_standard_version(plasticparcels.__version__): + return f"https://github.com/OceanParcels/plasticparcels/blob/main/plasticparcels/{fn}{linespec}" else: return ( f"https://github.com/OceanParcels/plasticparcels/blob/" - f"{plasticparcels.__version__}/plasticparcels/{fn}{linespec}" + f"v{plasticparcels.__version__}/plasticparcels/{fn}{linespec}" ) From 34bce7aa01234807b94c065443957d51a92ab20d Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:12:43 +0200 Subject: [PATCH 4/4] Update versioning --- docs/conf.py | 2 +- plasticparcels/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 82a8fb5..303cc01 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -91,7 +91,7 @@ def is_non_standard_version(version): Determine if the given version string has more than 3 components (e.g., from a developer version). """ - return len(version.split(".")) > 3 + return len(version.split(".")) != 3 # based on pandas doc/source/conf.py def linkcode_resolve(domain, info): diff --git a/plasticparcels/__init__.py b/plasticparcels/__init__.py index 33ee3f8..f2caa7e 100644 --- a/plasticparcels/__init__.py +++ b/plasticparcels/__init__.py @@ -2,4 +2,7 @@ from plasticparcels.particlefile import * # noqa from plasticparcels.utils import * # noqa -from plasticparcels._version_setup import __version__, __version_tuple__ # noqa +try: + from plasticparcels._version_setup import __version__ # noqa +except ModuleNotFoundError: + __version__ = "unknown"