From 9a6c6f3a53f76669dae91fd37ad9df653de69c8c Mon Sep 17 00:00:00 2001
From: Christoph Knote <christoph.knote@med.uni-augsburg.de>
Date: Mon, 21 Mar 2022 15:29:48 +0100
Subject: [PATCH] Move to poetry. Initial gitlab-ci.yaml.

---
 .gitlab-ci.yml | 44 +++++++++++++++++---------------------------
 CHANGES.md     | 15 ---------------
 INSTALL.md     |  1 -
 MANIFEST.in    |  4 ----
 README.md      | 18 +++++++++++++++++-
 pyproject.toml | 45 +++++++++++++++++++++++++++++++++++++++++----
 setup.cfg      | 33 ---------------------------------
 7 files changed, 75 insertions(+), 85 deletions(-)
 delete mode 100644 CHANGES.md
 delete mode 100644 INSTALL.md
 delete mode 100644 MANIFEST.in
 delete mode 100644 setup.cfg

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6c7a596..f532d10 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,41 +1,31 @@
-# based on https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
-
 image: python:latest
-# Change pip's cache directory to be inside the project directory since we can
-# only cache local items.
-variables:
-  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
-
-cache:
-  paths:
-    - .cache/pip
-    - venv/
 
 before_script:
-  - python3 --version
-  - python3 -m pip install --upgrade pip
-  - pip3 install virtualenv
-  - virtualenv venv
-  - source venv/bin/activate
-  - python3 -m pip install --upgrade numpy
-  - python3 -m pip install --upgrade coverage
+  - pip install poetry
+  - poetry install
+  - source `poetry env info --path`/bin/activate
+
+stages:
+  - testing
+  - build_package
+  - create_docs
 
 test:
-  script:
-    - python3 -m pip install -e .
+  stage: testing
+  script: 
     - make
 
 build_package:
+  stage: build
+  needs: [test]
   script:
-    - python3 -m pip install --upgrade build
-    - python3 -m build
-  artifacts:
-    paths:
-      - dist/*.whl
+    - poetry build
 
-pages:
+create_docs:
+  stage: create_docs
+  needs: [test]
   script:
-    - pip install sphinx sphinx-rtd-theme enum-tools sphinx-toolbox
+    - poetry install sphinx sphinx-rtd-theme enum-tools sphinx-toolbox
     - cd docs ; make html
     - mv build/html/ ../public/
   artifacts:
diff --git a/CHANGES.md b/CHANGES.md
deleted file mode 100644
index c754a6b..0000000
--- a/CHANGES.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Changelog
-
-## 2.0.0 (2022-02-x)
-
-- Compatible with ICARTT v2 standard
-- Formats 1001 and 2110
-- Complete internal overhaul
-
-## 1.0.0 (2017-12-19)
-
-- Peer-reviewed version to be published in Knote et al., GMD
-
-## 0.1.0 (2017-08-12)
-
-- Initial release
diff --git a/INSTALL.md b/INSTALL.md
deleted file mode 100644
index 6c39ecc..0000000
--- a/INSTALL.md
+++ /dev/null
@@ -1 +0,0 @@
-`pip install icartt`
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 06b0b69..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,4 +0,0 @@
-include CHANGES.md
-include INSTALL.md
-include LICENSE
-include README.md
diff --git a/README.md b/README.md
index 313eed4..f074f4b 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ If you'd like to contribute source code directly, please [create a fork](https:/
 make your changes and then [submit a merge request](https://mbees.med.uni-augsburg.de/gitlab/mbees/icartt_pypackage/-/merge_requests/new) to the original project.
 
 
-## Installation
+## Installation of the development version
 
 Clone this repository / or your fork and install as "editable":
 
@@ -23,3 +23,19 @@ git clone https://mbees.med.uni-augsburg.de/gitlab/mbees/icartt_pypackage.git or
 cd icartt_pypackage
 pip install -e .
 ```
+
+# Changelog
+
+## 2.0.0 (2022-02-x)
+
+- Compatible with ICARTT v2 standard
+- Formats 1001 and 2110
+- Complete internal overhaul
+
+## 1.0.0 (2017-12-19)
+
+- Peer-reviewed version to be published in Knote et al., GMD
+
+## 0.1.0 (2017-08-12)
+
+- Initial release
diff --git a/pyproject.toml b/pyproject.toml
index d9c84a6..2f8a363 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,42 @@
-[build-system]
-requires = [
-    "numpy", "setuptools"
+[tool.poetry]
+name = "icartt"
+version = "1.9.1"
+description = "ICARTT format reader and writer"
+license = "GPL-3.0-or-later"
+authors = ["Christoph Knote <christoph.knote@med.uni-augsburg.de>"]
+readme = "README.md"
+homepage = "https://mbees.med.uni-augsburg.de/"
+repository = "https://mbees.med.uni-augsburg.de/gitlab/mbees/icartt_pypackage"
+keywords = [ "atmosphere", "file format", "ames", "nasa" ]
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "Development Status :: 5 - Production/Stable",
+    "Environment :: Console",
+    "Intended Audience :: Developers",
+    "Intended Audience :: Education",
+    "Intended Audience :: End Users/Desktop",
+    "Intended Audience :: Science/Research",
+    "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+    "Operating System :: POSIX",
+    "Topic :: Education",
+    "Topic :: Scientific/Engineering",
+    "Topic :: Utilities",
+]
+packages = [
+    { include = "icartt", from = "src" },
 ]
-build-backend = "setuptools.build_meta"
+
+[tool.poetry.urls]
+issues = "http://mbees.med.uni-augsburg.de/gitlab/mbees/icartt_pypackage/issues"
+
+
+[tool.poetry.dependencies]
+python = "^3"
+numpy  = ">= 1.2"
+
+[tool.poetry.dev-dependencies]
+pytest = "^5.2"
+
+[build-system]
+requires = ["poetry-core>=1.0.0"]
+build-backend = "poetry.core.masonry.api"
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 78485d1..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,33 +0,0 @@
-[metadata]
-name = icartt
-version = 1.9.1
-author = Christoph Knote
-author_email = christoph.knote@med.uni-augsburg.de
-description = ICARTT format reader and writer
-long_description = file: README.md, INSTALL.md, CHANGES.md
-long_description_content_type = text/markdown
-url = https://mbees.med.uni-augsburg.de
-project_urls = 
-    Bug Tracker = http://mbees.med.uni-augsburg.de/gitlab/mbees/icartt_pypackage/issues
-classifiers = 
-    Programming Language :: Python :: 3
-    Development Status :: 5 - Production/Stable
-    Environment :: Console
-    Intended Audience :: Developers
-    Intended Audience :: Education
-    Intended Audience :: End Users/Desktop
-    Intended Audience :: Science/Research
-    License :: OSI Approved :: GNU General Public License v3 (GPLv3)
-    Operating System :: POSIX
-    Topic :: Education
-    Topic :: Scientific/Engineering
-    Topic :: Utilities
-
-[options]
-package_dir =
-    = src
-packages = find:
-python_requires = >=3.0
-
-[options.packages.find]
-where = src
-- 
GitLab