From b9cf112077fbb84836af894d6126c37806f5d761 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr>
Date: Sun, 19 Jan 2025 22:08:53 +0100
Subject: [PATCH 1/4] enh: enable optional fields

---
 stac_extension_genmeta/core.py | 5 ++---
 tests/extensions_test.py       | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/stac_extension_genmeta/core.py b/stac_extension_genmeta/core.py
index bcf66f3..862a0d0 100644
--- a/stac_extension_genmeta/core.py
+++ b/stac_extension_genmeta/core.py
@@ -59,9 +59,8 @@ def create_extension_cls(
                 key: self._get_property(info.alias, str)
                 for key, info in model_cls.__fields__.items()
             }
-            self.md = model_cls(**props) if all(
-                prop is not None for prop in props.values()
-            ) else None
+            props = {p: v for p, v in props.items() if v is not None}
+            self.md = model_cls(**props) if props else None
 
         def __getattr__(self, item):
             # forward getattr to self.md
diff --git a/tests/extensions_test.py b/tests/extensions_test.py
index 89e4650..85ec701 100644
--- a/tests/extensions_test.py
+++ b/tests/extensions_test.py
@@ -18,6 +18,7 @@ class MyExtensionMetadataModel(BaseModel):
     name: str = Field(title="Process name", alias=f"{PREFIX}:name")
     authors: List[str] = Field(title="Authors", alias=f"{PREFIX}:authors")
     version: str = Field(title="Process version", alias=f"{PREFIX}:version")
+    opt_field: str | None = Field(title="Some optional field", alias=f"{PREFIX}:opt_field", default=None)
 
 
 # Create the extension class
-- 
GitLab


From b948cccf53a29afb320c030bb3c7903d13f12692 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr>
Date: Sun, 19 Jan 2025 22:12:59 +0100
Subject: [PATCH 2/4] ci: use templates

---
 .gitlab-ci.yml | 45 +++++++++------------------------------------
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 92f4f55..ce4ecf7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,47 +1,20 @@
-default:
-  image: "registry.forgemia.inra.fr/cdos-pub/pycode-quality/python-venv:3.10"
-  tags: ["test"]
+include:
+  - project: "cdos-pub/pycode-quality"
+    ref: "main"
+    file:
+      - ".gitlab/ci/static-analysis.yml"
+      - ".gitlab/ci/pip.yml"
 
 stages:
-  - Code quality
+  - Static Analysis
   - Test
-  - Ship
-
-.static_analysis_base:
-  stage: Code quality
-  allow_failure: true
-  image: "registry.forgemia.inra.fr/cdos-pub/pycode-quality/python-linters:3.10"
-
-Flake8:
-  extends: .static_analysis_base
-  script:
-    - flake8 $PWD/stac_extension_genmeta
-
-Pylint:
-  extends: .static_analysis_base
-  script:
-    - pylint --disable=too-many-arguments $PWD/stac_extension_genmeta
-
-Codespell:
-  extends: .static_analysis_base
-  script:
-    - codespell --skip="*.png,*.jinja2,*venv/*"
+  - Build pip package
 
 Tests:
+  image: "registry.forgemia.inra.fr/cdos-pub/pycode-quality/python-venv:3.10"
   stage: Test
   script:
     - pip install pip --upgrade
     - pip install .
     - python3 tests/extensions_test.py
 
-Publish the package:
-  stage: Ship
-  only: [tags]
-  variables:
-    PRVTOKEN: "\"PRIVATE-TOKEN: ${CI_JOB_TOKEN}\""
-    URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
-  script:
-    - pip install build twine
-    - python -m build
-    - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --verbose --repository-url $URL dist/*
-
-- 
GitLab


From 6da66260eccf6aec65fc730f06413c750b1ee7c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr>
Date: Sun, 19 Jan 2025 22:13:08 +0100
Subject: [PATCH 3/4] bump version

---
 stac_extension_genmeta/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stac_extension_genmeta/__init__.py b/stac_extension_genmeta/__init__.py
index 885783b..0affe20 100644
--- a/stac_extension_genmeta/__init__.py
+++ b/stac_extension_genmeta/__init__.py
@@ -1,2 +1,2 @@
 from .core import create_extension_cls
-__version__ = "0.1.0"
+__version__ = "0.1.1"
-- 
GitLab


From 72d2a8df2fa6604066ba4e3cb0029160f26ff8de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi?= <remi.cresson@inrae.fr>
Date: Sun, 19 Jan 2025 22:14:14 +0100
Subject: [PATCH 4/4] ci: use templates

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ce4ecf7..4871791 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,7 +8,7 @@ include:
 stages:
   - Static Analysis
   - Test
-  - Build pip package
+  - Pip
 
 Tests:
   image: "registry.forgemia.inra.fr/cdos-pub/pycode-quality/python-venv:3.10"
-- 
GitLab