From 667ccac692a9055ea0fb7d023b23dbe0cf5fad96 Mon Sep 17 00:00:00 2001 From: MacPingu Date: Wed, 4 Dec 2024 19:27:10 +0100 Subject: [PATCH] Add bump version (#10) * added bump-my-version * configure version * added project config * update pyproject.toml * added changes.md * added dev_guide * update readme: console instead of bash --- CHANGES.md | 3 + Dockerfile | 1 + README.md | 38 ++++---- docs/dev_guide.md | 51 +++++++++++ mkdocs.yml | 1 + poetry.lock | 184 +++++++++++++++++++++++++++++++++++++-- pyproject.toml | 55 +++++++++++- src/nandu/__init__.py | 1 + src/nandu/__version__.py | 9 ++ 9 files changed, 317 insertions(+), 26 deletions(-) create mode 100644 CHANGES.md create mode 100644 docs/dev_guide.md create mode 100644 src/nandu/__version__.py diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..519ecfe --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,3 @@ +## v0.1.0 (2024-12-04) + +Initial release. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 23cddc6..f59b6f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM geopython/pygeoapi:latest LABEL maintainer="Carsten Ehbrecht " +LABEL Description="nandu pygeoapi" Vendor="Birdhouse" Version="0.1.0" # Volume mapping cannot be used with webhook # https://github.com/maccyber/micro-dockerhub-hook diff --git a/README.md b/README.md index bd4c9b0..c707f80 100644 --- a/README.md +++ b/README.md @@ -14,24 +14,24 @@ ## Quick Guide Clone the repository: -```bash +```console git clone https://github.com/cehbrecht/nandu.git cd nandu ``` Create the Conda environment: -```bash +```console conda env create -f environment.yml conda activate nandu ``` You can use make to run the installation: -```bash +```console make install ``` ... and start the service: -```bash +```console make start ``` @@ -45,47 +45,47 @@ make start Clone the repository: -```bash +```console git clone https://github.com/cehbrecht/nandu.git cd nandu ``` Create the Conda environment: -```bash +```console conda env create -f environment.yml conda activate nandu ``` Install the project dependencies using Poetry: -```bash +```console poetry install ``` ## Configuration Edit pygeoapi config (optional): -```bash +```console vim pygeoapi-config.yml ``` Export paths to configs: -```bash +```console export PYGEOAPI_CONFIG=pygeoapi-config.yml export PYGEOAPI_OPENAPI=pygeoapi-openapi.yml ``` Update the OpenAPI configuration: -```bash +```console pygeoapi openapi generate $PYGEOAPI_CONFIG --output-file $PYGEOAPI_OPENAPI ``` ## Usage Start the pygeoapi server and expose the processes: -```bash +```console pygeoapi serve ``` @@ -103,7 +103,7 @@ http://localhost:5000/processes/hello-world Execute the process: -```bash +```console curl -X POST http://localhost:5000/processes/hello-world/execution \ -H "Content-Type: application/json" \ -d '{ @@ -116,20 +116,24 @@ curl -X POST http://localhost:5000/processes/hello-world/execution \ ## Development Run tests: -```bash +```console make test ``` Check coding style: -```bash +```console make lint ``` Build docs: -```bash +```console make docs ``` +## Release + +Please check the developer guide. + ## Examples See usage examples for the processes in the notebooks folder. @@ -139,12 +143,12 @@ See usage examples for the processes in the notebooks folder. You can also use a docker deployment. Build images: -```bash +```console docker-compose build ``` Start container: -```bash +```console docker-compose up ``` diff --git a/docs/dev_guide.md b/docs/dev_guide.md new file mode 100644 index 0000000..6622a6d --- /dev/null +++ b/docs/dev_guide.md @@ -0,0 +1,51 @@ +# Developer Guide + +## Building the docs + +Run the mkdocs generator: + +```console +$ make docs +``` + +## Running tests + +Run tests using [pytest](https://docs.pytest.org/en/latest/). + +```console +$ make test +$ make lint +``` + +## Prepare a release + +Update the Conda specification file to build identical +[environments](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#building-identical-conda-environments) +on a specific OS. + + +**You should run this on your target OS, in our case Linux.** + +``` console +$ conda env create -f environment.yml +$ source activate rook +ยง rm poetry.lock +$ make clean +$ make install +$ conda list -n nandu --explicit > spec-list.txt +``` + +## Bump a new version + +Make a new version of nandu in the following steps: + +- Make sure everything is commited to GitHub. +- Update `CHANGES.md` with the next version. +- Dry Run: `bump-my-version bump --dry-run --verbose --new-version 0.8.1 patch` +- Do it: `bump-my-version bump --new-version 0.8.1 patch` +- \... or: `bump-my-version bump --new-version 0.9.0 minor` +- Push it: `git push` +- Push tag: `git push --tags` + +See the [bumpversion](https://pypi.org/project/bump-my-version/) +documentation for details. diff --git a/mkdocs.yml b/mkdocs.yml index 2af5714..0e14cbe 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,5 @@ site_name: Nandu nav: - Home: index.md + - Developer Guide: dev_guide.md theme: material \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 8ab9028..9c9f0d5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -59,6 +59,29 @@ files = [ {file = "blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf"}, ] +[[package]] +name = "bump-my-version" +version = "0.10.0" +description = "Version bump your Python project" +optional = false +python-versions = ">=3.7" +files = [ + {file = "bump-my-version-0.10.0.tar.gz", hash = "sha256:f696d25ba652077b6f0e5755f775aa05425f425ce91ca2ef1c7e6f3d989fabd2"}, + {file = "bump_my_version-0.10.0-py3-none-any.whl", hash = "sha256:a18d5442c8eca1b26e07ae4b76de545b9737c09deed32d043b11ec3f93842af7"}, +] + +[package.dependencies] +click = "*" +pydantic = "<2.0.0" +rich = "*" +rich-click = "*" +tomlkit = "*" + +[package.extras] +dev = ["generate-changelog (>=0.7.6)", "git-fame (>=1.12.2)", "pip-tools", "pre-commit"] +docs = ["Sphinx (>=4.3.0)", "furo", "ghp-import", "linkify-it-py", "myst-parser", "sphinx-autodoc-typehints", "sphinx-autodoc2", "sphinx-click", "sphinx-copybutton"] +test = ["coverage", "pre-commit", "pytest", "pytest-cov", "pytest-mock"] + [[package]] name = "certifi" version = "2024.8.30" @@ -265,6 +288,17 @@ calendars = ["convertdate", "hijri-converter"] fasttext = ["fasttext"] langdetect = ["langdetect"] +[[package]] +name = "docutils" +version = "0.21.2" +description = "Docutils -- Python Documentation Utilities" +optional = false +python-versions = ">=3.9" +files = [ + {file = "docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"}, + {file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"}, +] + [[package]] name = "exceptiongroup" version = "1.2.2" @@ -317,6 +351,39 @@ Werkzeug = ">=3.1" async = ["asgiref (>=3.2)"] dotenv = ["python-dotenv"] +[[package]] +name = "flit" +version = "3.10.1" +description = "A simple packaging tool for simple packages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "flit-3.10.1-py3-none-any.whl", hash = "sha256:d79c19c2caae73cc486d3d827af6a11c1a84b9efdfab8d9683b714ec8d1dc1f1"}, + {file = "flit-3.10.1.tar.gz", hash = "sha256:9c6258ae76d218ce60f9e39a43ca42006a3abcc5c44ea6bb2a1daa13857a8f1a"}, +] + +[package.dependencies] +docutils = "*" +flit_core = ">=3.10.1" +pip = "*" +requests = "*" +tomli-w = "*" + +[package.extras] +doc = ["pygments-github-lexers", "sphinx", "sphinxcontrib_github_alt"] +test = ["pytest (>=2.7.3)", "pytest-cov", "responses", "testpath", "tomli"] + +[[package]] +name = "flit-core" +version = "3.10.1" +description = "Distribution-building parts of Flit. See flit package for more information" +optional = false +python-versions = ">=3.6" +files = [ + {file = "flit_core-3.10.1-py3-none-any.whl", hash = "sha256:cb31a76e8b31ad3351bb89e531f64ef2b05d1e65bd939183250bf81ddf4922a8"}, + {file = "flit_core-3.10.1.tar.gz", hash = "sha256:66e5b87874a0d6e39691f0e22f09306736b633548670ad3c09ec9db03c5662f7"}, +] + [[package]] name = "ghp-import" version = "2.1.0" @@ -539,6 +606,30 @@ files = [ docs = ["mdx-gh-links (>=0.2)", "mkdocs (>=1.5)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python]"] testing = ["coverage", "pyyaml"] +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.8" +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "markupsafe" version = "3.0.2" @@ -609,6 +700,17 @@ files = [ {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"}, ] +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + [[package]] name = "mergedeep" version = "1.3.4" @@ -788,6 +890,17 @@ files = [ {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] +[[package]] +name = "pip" +version = "24.3.1" +description = "The PyPA recommended tool for installing Python packages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pip-24.3.1-py3-none-any.whl", hash = "sha256:3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed"}, + {file = "pip-24.3.1.tar.gz", hash = "sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99"}, +] + [[package]] name = "platformdirs" version = "4.3.6" @@ -1347,6 +1460,45 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "rich" +version = "13.9.4" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"}, + {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" +typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.11\""} + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "rich-click" +version = "1.8.5" +description = "Format click help output nicely with rich" +optional = false +python-versions = ">=3.7" +files = [ + {file = "rich_click-1.8.5-py3-none-any.whl", hash = "sha256:0fab7bb5b66c15da17c210b4104277cd45f3653a7322e0098820a169880baee0"}, + {file = "rich_click-1.8.5.tar.gz", hash = "sha256:a3eebe81da1c9da3c32f3810017c79bd687ff1b3fa35bfc9d8a3338797f1d1a1"}, +] + +[package.dependencies] +click = ">=7" +rich = ">=10.7" +typing_extensions = ">=4" + +[package.extras] +dev = ["mypy", "packaging", "pre-commit", "pytest", "pytest-cov", "rich-codex", "ruff", "types-setuptools"] +docs = ["markdown_include", "mkdocs", "mkdocs-glightbox", "mkdocs-material-extensions", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-rss-plugin", "mkdocstrings[python]", "rich-codex"] + [[package]] name = "rpds-py" version = "0.22.3" @@ -1546,13 +1698,13 @@ test = ["pytest", "pytest-cov"] [[package]] name = "six" -version = "1.16.0" +version = "1.17.0" description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, ] [[package]] @@ -1684,6 +1836,28 @@ files = [ {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] +[[package]] +name = "tomli-w" +version = "1.1.0" +description = "A lil' TOML writer" +optional = false +python-versions = ">=3.9" +files = [ + {file = "tomli_w-1.1.0-py3-none-any.whl", hash = "sha256:1403179c78193e3184bfaade390ddbd071cba48a32a2e62ba11aae47490c63f7"}, + {file = "tomli_w-1.1.0.tar.gz", hash = "sha256:49e847a3a304d516a169a601184932ef0f6b61623fe680f836a2aa7128ed0d33"}, +] + +[[package]] +name = "tomlkit" +version = "0.13.2" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, + {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, +] + [[package]] name = "typing-extensions" version = "4.12.2" @@ -1802,4 +1976,4 @@ watchdog = ["watchdog (>=2.3)"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<4" -content-hash = "903bd311c68487a0b681b7833ce2a7efbe400198bd56b0514230a70b1d113f55" +content-hash = "1fb35f24a1e7ee1ae0f4a244c2faae66d2b244e099d72415e8ec295803aa235f" diff --git a/pyproject.toml b/pyproject.toml index 4055e0c..32783fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,34 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + [tool.poetry] name = "nandu" version = "0.1.0" description = "OGC API - Processes example with pygeoapi" authors = ["Carsten Ehbrecht "] +maintainers = [ + "Carsten Ehbrecht ", + "Trevor James Smith ", +] +readme = "README.md" +keywords = ["ogcapi-processes", "pygeoapi", "birdhouse", "nandu"] +license = "LICENSE" +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Programming Language :: Python", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Atmospheric Science" +] [tool.poetry.dependencies] python = ">=3.10,<4" @@ -15,11 +41,32 @@ numpy = "<2" pytest = ">=8.3.4" ruff = ">=0.8.1" mkdocs-material = ">=9.5.47" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +bump-my-version = ">=0.10.0" +flit = ">=3.9.0,<4.0" [tool.ruff] line-length = 150 +[tool.bumpversion] +current_version = "0.1.0" +commit = true +commit_args = "--no-verify" +tag = true +tag_name = "v{new_version}" +allow_dirty = true + +[[tool.bumpversion.files]] +filename = "pyproject.toml" +search = "version = \"{current_version}\"" +replace = "version = \"{new_version}\"" + +[[tool.bumpversion.files]] +filename = "src/nandu/__version__.py" +search = "__version__ = \"{current_version}\"" +replace = "__version__ = \"{new_version}\"" + +[[tool.bumpversion.files]] +filename = "Dockerfile" +search = "Version=\"{current_version}\"" +replace = "Version=\"{new_version}\"" + diff --git a/src/nandu/__init__.py b/src/nandu/__init__.py index e69de29..27c4ab4 100644 --- a/src/nandu/__init__.py +++ b/src/nandu/__init__.py @@ -0,0 +1 @@ +from .__version__ import __author__, __email__, __version__ # noqa: F401 diff --git a/src/nandu/__version__.py b/src/nandu/__version__.py new file mode 100644 index 0000000..a092228 --- /dev/null +++ b/src/nandu/__version__.py @@ -0,0 +1,9 @@ +"""nandu version information.""" + +# This information is located in its own file so that it can be loaded +# without importing the main package when its dependencies are not installed. +# See: https://packaging.python.org/guides/single-sourcing-package-version + +__author__ = """Carsten Ehbrecht""" +__email__ = "ehbrecht@dkrz.de" +__version__ = "0.1.0" \ No newline at end of file