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 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 diff --git a/docs/conf.py b/docs/conf.py index 3a2d29f..303cc01 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}" ) 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"