From d2e875d8593ff8a19dfca8fcca691865c8a91685 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 5 Jan 2023 16:04:45 +0100 Subject: [PATCH] [ogstools] Replaced poetry with setuptools. --- .gitlab-ci.yml | 15 ++++++--------- README.md | 33 ++++++++++++++++++++++++++------- pyproject.toml | 34 ++++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63a0c0107..6eb365268 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,21 +11,18 @@ cache: - .cache before_script: - - | - if ! command -v poetry &> /dev/null - then - curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr python3 - - fi - - poetry install + - python -m venv .venv + - source .venv/bin/activate + - pip install -e ".[test]" build: script: - - poetry build + - pyproject-build tests (arch): tags: [shell, envinf] script: - - poetry run tox -p + - tox -p coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: reports: @@ -35,4 +32,4 @@ tests (arch): tests: script: - - poetry run tox -p + - tox -p diff --git a/README.md b/README.md index c027f340b..5216a48d0 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,22 @@ merge request option is preferred. ## Development setup -* Install [poetry](https://python-poetry.org/docs/#installation) -* Run `poetry install` -* For basic style checks setup [pre-commit](https://pre-commit.com) by enabling it (run - `poetry run pre-commit install`). -* To run cli tools, e.g.: `poetry run msh2vtu` +Create a virtual environment, activate it and install required packages: + +```bash +python -m venv .venv +source .venv/bin/activate # run this in every new shell session +pip install -e ".[test]" + +# enable basic style checks once: +pre-commit install +``` + +CLI scripts can now be simply run: + +```bash +msh2vtu --help +``` ### Testing with `tox` and `pytest` @@ -43,7 +54,7 @@ Tests are executed via [`pytest`](https://docs.pytest.org/en/7.2.x/) To run the tests: ```bash -poetry run tox # parallelize with `tox -p` +tox # parallelize with `tox -p` ``` You can view a coverage report by opening `htmlcov/index.html` in a browser. @@ -51,5 +62,13 @@ You can view a coverage report by opening `htmlcov/index.html` in a browser. You can also run a single test environment with e.g.: ```bash -poetry run tox -e py39 +tox -e py39 +``` + +### Create a package + +```bash +pyproject-build ``` + +Packages can then be found in `dist/`. diff --git a/pyproject.toml b/pyproject.toml index c947ca626..454cd6c42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,30 @@ -[tool.poetry] +[build-system] +requires = ['setuptools'] +build-backend = 'setuptools.build_meta' + +[project] name = "ogstools" version = "0.0.1" description = "A collection of Python tools aimed at evolving into a modeling toolchain around OpenGeoSys." -authors = ["OpenGeoSys Community <info@opengeosys.org>"] -license = "BSD-3-Clause" +authors = [{ name = 'OpenGeoSys Community', email = 'info@opengeosys.org' }] +license = { text = "BSD-3-Clause" } +readme = "README.md" +requires-python = '>=3.9' +dependencies = ["meshio>=5.3.0"] -[tool.poetry.dependencies] -python = "^3.9" -meshio = "^5.3.4" +[project.urls] +# Documentation = 'TODO' +"Bug Tracker" = 'https://gitlab.opengeosys.org/ogs/tools/ogstools/-/issues' +"Source Code" = 'https://gitlab.opengeosys.org/ogs/tools/ogstools' -[tool.poetry.scripts] -msh2vtu = 'ogstools.msh2vtu.cli:cli' +[tool.setuptools] +packages = ["ogstools"] -[tool.poetry.group.dev.dependencies] -pre-commit = "^2.20.0" -tox = "^4.1.3" +[project.scripts] +msh2vtu = 'ogstools.msh2vtu._cli:cli' -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +[project.optional-dependencies] +test = ["pre-commit>=2.20", "tox>=4.1", "build"] [tool.black] line-length = 80 -- GitLab