diff --git a/.github/workflows/bps-common.yml b/.github/workflows/bps-common.yml index afae39ba..951a899f 100644 --- a/.github/workflows/bps-common.yml +++ b/.github/workflows/bps-common.yml @@ -12,7 +12,7 @@ on: - ".github/workflows/python-package-reusable.yml" - ".github/actions/install-subpackage/action.yml" - "ruff.toml" - - "scripts/fawltydeps.toml" + - "fawltydeps.toml" pull_request: paths: - "bps-common/**" @@ -20,7 +20,7 @@ on: - ".github/workflows/python-package-reusable.yml" - ".github/actions/install-subpackage/action.yml" - "ruff.toml" - - "scripts/fawltydeps.toml" + - "fawltydeps.toml" workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l1_core_processor.yml b/.github/workflows/bps-l1_core_processor.yml index 2d3e7d81..bb0a9a52 100644 --- a/.github/workflows/bps-l1_core_processor.yml +++ b/.github/workflows/bps-l1_core_processor.yml @@ -11,7 +11,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -22,7 +22,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l1_framing_processor.yml b/.github/workflows/bps-l1_framing_processor.yml index 1f532e83..de0b62c7 100644 --- a/.github/workflows/bps-l1_framing_processor.yml +++ b/.github/workflows/bps-l1_framing_processor.yml @@ -10,7 +10,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -20,7 +20,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l1_geocoding_tool.yml b/.github/workflows/bps-l1_geocoding_tool.yml index 88da7af9..deba0c28 100644 --- a/.github/workflows/bps-l1_geocoding_tool.yml +++ b/.github/workflows/bps-l1_geocoding_tool.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l1_pre_processor.yml b/.github/workflows/bps-l1_pre_processor.yml index 4a4d7063..d59e336b 100644 --- a/.github/workflows/bps-l1_pre_processor.yml +++ b/.github/workflows/bps-l1_pre_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l1_processor.yml b/.github/workflows/bps-l1_processor.yml index 72db473b..c362b755 100644 --- a/.github/workflows/bps-l1_processor.yml +++ b/.github/workflows/bps-l1_processor.yml @@ -14,7 +14,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -28,7 +28,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l2a_processor.yml b/.github/workflows/bps-l2a_processor.yml index 32c6ba65..04465200 100644 --- a/.github/workflows/bps-l2a_processor.yml +++ b/.github/workflows/bps-l2a_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l2b_agb_processor.yml b/.github/workflows/bps-l2b_agb_processor.yml index 0a1d755b..8da52690 100644 --- a/.github/workflows/bps-l2b_agb_processor.yml +++ b/.github/workflows/bps-l2b_agb_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l2b_fd_processor.yml b/.github/workflows/bps-l2b_fd_processor.yml index 6bd5fdd8..0d3b80f4 100644 --- a/.github/workflows/bps-l2b_fd_processor.yml +++ b/.github/workflows/bps-l2b_fd_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-l2b_fh_processor.yml b/.github/workflows/bps-l2b_fh_processor.yml index f88a7912..d7af46d2 100644 --- a/.github/workflows/bps-l2b_fh_processor.yml +++ b/.github/workflows/bps-l2b_fh_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-stack_cal_processor.yml b/.github/workflows/bps-stack_cal_processor.yml index 2ac63d3b..be27f29e 100644 --- a/.github/workflows/bps-stack_cal_processor.yml +++ b/.github/workflows/bps-stack_cal_processor.yml @@ -11,7 +11,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -22,7 +22,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-stack_coreg_processor.yml b/.github/workflows/bps-stack_coreg_processor.yml index 09684f41..3fb92967 100644 --- a/.github/workflows/bps-stack_coreg_processor.yml +++ b/.github/workflows/bps-stack_coreg_processor.yml @@ -12,7 +12,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -24,7 +24,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-stack_pre_processor.yml b/.github/workflows/bps-stack_pre_processor.yml index 9de6d5f8..9ada1fc1 100644 --- a/.github/workflows/bps-stack_pre_processor.yml +++ b/.github/workflows/bps-stack_pre_processor.yml @@ -11,7 +11,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -22,7 +22,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-stack_processor.yml b/.github/workflows/bps-stack_processor.yml index 75831a51..9ae40d37 100644 --- a/.github/workflows/bps-stack_processor.yml +++ b/.github/workflows/bps-stack_processor.yml @@ -10,7 +10,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -20,7 +20,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/bps-transcoder.yml b/.github/workflows/bps-transcoder.yml index f488f6a1..569f15d9 100644 --- a/.github/workflows/bps-transcoder.yml +++ b/.github/workflows/bps-transcoder.yml @@ -11,7 +11,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] pull_request: paths: @@ -22,7 +22,7 @@ on: ".github/workflows/python-package-reusable.yml", ".github/actions/install-subpackage/action.yml", "ruff.toml", - "scripts/fawltydeps.toml", + "fawltydeps.toml", ] workflow_dispatch: permissions: diff --git a/.github/workflows/python-package-reusable.yml b/.github/workflows/python-package-reusable.yml index a21a7757..6919d66a 100644 --- a/.github/workflows/python-package-reusable.yml +++ b/.github/workflows/python-package-reusable.yml @@ -69,7 +69,7 @@ jobs: - run: python -m pip install FawltyDeps - name: Check dependencies working-directory: ${{ inputs.subproject }} - run: python -m fawltydeps --code bps --detailed --config-file ../scripts/fawltydeps.toml + run: python -m fawltydeps --code bps --detailed --config-file ../fawltydeps.toml unittest-linux: if: inputs.run-tests diff --git a/.gitlab-ci-common.yml b/.gitlab-ci-common.yml index e79d1903..fb842f99 100644 --- a/.gitlab-ci-common.yml +++ b/.gitlab-ci-common.yml @@ -18,8 +18,7 @@ variables: image: python:3.14-slim-bookworm script: - cd $SUBPROJECT - - python3.14 -m pip install nox - - python3.14 -m nox -s check_xsd + - python3.14 ../scripts/xsd_alignment.py check "$SUBPROJECT" .ruff: stage: analysis @@ -58,7 +57,7 @@ variables: script: - cd $SUBPROJECT - python3.14 -m pip install FawltyDeps - - python3.14 -m fawltydeps --code bps --detailed --config-file ../scripts/fawltydeps.toml + - python3.14 -m fawltydeps --code bps --detailed --config-file ../fawltydeps.toml .build: stage: build diff --git a/bps-common/noxfile.py b/bps-common/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-common/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-common/pyproject.toml b/bps-common/pyproject.toml index 3be6ecdd..82b23281 100644 --- a/bps-common/pyproject.toml +++ b/bps-common/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l1_core_processor/noxfile.py b/bps-l1_core_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-l1_core_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-l1_core_processor/pyproject.toml b/bps-l1_core_processor/pyproject.toml index 2e5c933b..45e0b8c6 100644 --- a/bps-l1_core_processor/pyproject.toml +++ b/bps-l1_core_processor/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l1_framing_processor/noxfile.py b/bps-l1_framing_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-l1_framing_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-l1_framing_processor/pyproject.toml b/bps-l1_framing_processor/pyproject.toml index 6fe45310..c3167f93 100644 --- a/bps-l1_framing_processor/pyproject.toml +++ b/bps-l1_framing_processor/pyproject.toml @@ -34,7 +34,7 @@ classifiers = [ bps_l1_framing_processor = "bps.l1_framing_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l1_geocoding_tool/noxfile.py b/bps-l1_geocoding_tool/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-l1_geocoding_tool/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-l1_geocoding_tool/pyproject.toml b/bps-l1_geocoding_tool/pyproject.toml index 1fca9691..3c0a8648 100644 --- a/bps-l1_geocoding_tool/pyproject.toml +++ b/bps-l1_geocoding_tool/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ bps_l1_geocoding_tool = "bps.l1_geocoding_tool.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l1_pre_processor/noxfile.py b/bps-l1_pre_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-l1_pre_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-l1_pre_processor/pyproject.toml b/bps-l1_pre_processor/pyproject.toml index e5323a35..f577d9c8 100644 --- a/bps-l1_pre_processor/pyproject.toml +++ b/bps-l1_pre_processor/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l1_processor/noxfile.py b/bps-l1_processor/noxfile.py deleted file mode 100644 index 4497971e..00000000 --- a/bps-l1_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pp1.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "l1_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "l1_processor", XSD_FILES) diff --git a/bps-l1_processor/pyproject.toml b/bps-l1_processor/pyproject.toml index 3cae53f4..beac4a8a 100644 --- a/bps-l1_processor/pyproject.toml +++ b/bps-l1_processor/pyproject.toml @@ -40,7 +40,7 @@ classifiers = [ bps_l1_processor = "bps.l1_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l2a_processor/noxfile.py b/bps-l2a_processor/noxfile.py deleted file mode 100644 index 5f336cdc..00000000 --- a/bps-l2a_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pp2_2a.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "l2a_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "l2a_processor", XSD_FILES) diff --git a/bps-l2a_processor/pyproject.toml b/bps-l2a_processor/pyproject.toml index 405192b5..40887f2b 100644 --- a/bps-l2a_processor/pyproject.toml +++ b/bps-l2a_processor/pyproject.toml @@ -38,7 +38,7 @@ classifiers = [ bps_l2a_processor = "bps.l2a_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l2b_agb_processor/noxfile.py b/bps-l2b_agb_processor/noxfile.py deleted file mode 100644 index be2f8401..00000000 --- a/bps-l2b_agb_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pp2_ab.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "l2b_agb_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "l2b_agb_processor", XSD_FILES) diff --git a/bps-l2b_agb_processor/pyproject.toml b/bps-l2b_agb_processor/pyproject.toml index 6e0ccf78..82690a6c 100644 --- a/bps-l2b_agb_processor/pyproject.toml +++ b/bps-l2b_agb_processor/pyproject.toml @@ -34,7 +34,7 @@ classifiers = [ bps_l2b_agb_processor = "bps.l2b_agb_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l2b_fd_processor/noxfile.py b/bps-l2b_fd_processor/noxfile.py deleted file mode 100644 index a32552a8..00000000 --- a/bps-l2b_fd_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pp2_fd.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "l2b_fd_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "l2b_fd_processor", XSD_FILES) diff --git a/bps-l2b_fd_processor/pyproject.toml b/bps-l2b_fd_processor/pyproject.toml index bdb75ad9..0072a7e0 100644 --- a/bps-l2b_fd_processor/pyproject.toml +++ b/bps-l2b_fd_processor/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ bps_l2b_fd_processor = "bps.l2b_fd_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-l2b_fh_processor/noxfile.py b/bps-l2b_fh_processor/noxfile.py deleted file mode 100644 index 2835700f..00000000 --- a/bps-l2b_fh_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pp2_fh.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "l2b_fh_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "l2b_fh_processor", XSD_FILES) diff --git a/bps-l2b_fh_processor/pyproject.toml b/bps-l2b_fh_processor/pyproject.toml index bedb9d77..15d3b0fe 100644 --- a/bps-l2b_fh_processor/pyproject.toml +++ b/bps-l2b_fh_processor/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ bps_l2b_fh_processor = "bps.l2b_fh_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-stack_cal_processor/noxfile.py b/bps-stack_cal_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-stack_cal_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-stack_cal_processor/pyproject.toml b/bps-stack_cal_processor/pyproject.toml index 96c9006b..6f311963 100644 --- a/bps-stack_cal_processor/pyproject.toml +++ b/bps-stack_cal_processor/pyproject.toml @@ -31,7 +31,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-stack_coreg_processor/noxfile.py b/bps-stack_coreg_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-stack_coreg_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-stack_coreg_processor/pyproject.toml b/bps-stack_coreg_processor/pyproject.toml index 320b1f11..1a2238ff 100644 --- a/bps-stack_coreg_processor/pyproject.toml +++ b/bps-stack_coreg_processor/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-stack_pre_processor/noxfile.py b/bps-stack_pre_processor/noxfile.py deleted file mode 100644 index 61ace1c8..00000000 --- a/bps-stack_pre_processor/noxfile.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Automation file""" - -import sys - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common # noqa: F401 diff --git a/bps-stack_pre_processor/pyproject.toml b/bps-stack_pre_processor/pyproject.toml index ee4e4c51..3f25eddc 100644 --- a/bps-stack_pre_processor/pyproject.toml +++ b/bps-stack_pre_processor/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-stack_processor/noxfile.py b/bps-stack_processor/noxfile.py deleted file mode 100644 index 334cdf28..00000000 --- a/bps-stack_processor/noxfile.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -XSD_FILES = [ - "bio-aux-pps.xsd", - "bio-common-types.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "stack_processor", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "stack_processor", XSD_FILES) diff --git a/bps-stack_processor/pyproject.toml b/bps-stack_processor/pyproject.toml index 53765a20..9bd603d2 100644 --- a/bps-stack_processor/pyproject.toml +++ b/bps-stack_processor/pyproject.toml @@ -38,7 +38,7 @@ classifiers = [ bps_stack_processor = "bps.stack_processor.__main__:main" [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/bps-task-tables/.gitlab-ci.yml b/bps-task-tables/.gitlab-ci.yml index 24c06dac..5593b335 100644 --- a/bps-task-tables/.gitlab-ci.yml +++ b/bps-task-tables/.gitlab-ci.yml @@ -15,9 +15,7 @@ TaskTable_and_PMM_xml_validation: before_script: - apt-get update && apt-get install -y --no-install-recommends libxml2-utils script: - - cd $SUBPROJECT - - python3.14 -m pip install nox - - python3.14 -m nox -s validate_task_tables validate_product_metadata_mapping + - python3.14 scripts/validate_task_tables.py deploy: stage: deploy diff --git a/bps-task-tables/noxfile.py b/bps-task-tables/noxfile.py deleted file mode 100644 index 4e850576..00000000 --- a/bps-task-tables/noxfile.py +++ /dev/null @@ -1,147 +0,0 @@ -""" -Automation file ---------------- -""" - -from pathlib import Path - -import nox -import nox.command - - -def is_valid(session: nox.Session, xml_file: Path, schema: Path) -> bool: - """Wether xml is valid against scheme""" - try: - session.run( - *f"xmllint {xml_file} --noout --schema {schema}".split(), - external=True, - ) - except nox.command.CommandFailed: - return False - return True - - -@nox.session() -def validate_task_tables(session: nox.Session) -> None: - """Validate all task tables against XSD""" - task_tables = Path().rglob("*TaskTable*.xml") - - schema_reference = Path( - "..", - "xsd", - "icd-xsd", - "generic", - "tasktable", - "v1_4", - "IF_PF_Proc_Task_Table.xsd", - ) - - invalid_task_tables = list(filter(lambda jo: not is_valid(session, jo, schema_reference), task_tables)) - if invalid_task_tables: - for table in invalid_task_tables: - session.warn(f"Invalid TaskTable file: {table}") - session.error(f"Found {len(invalid_task_tables)} invalid Task Tables") - - -@nox.session() -def validate_product_metadata_mapping(session: nox.Session) -> None: - """Validate all pmm against XSD""" - pmm_files = Path().rglob("*ProductMetadataMapping.xml") - - schema_reference = Path( - "..", - "xsd", - "icd-xsd", - "generic", - "tasktable", - "v1_4", - "IF_PF_Proc_ProductMetadataMapping.xsd", - ) - - invalid_pmm = list(filter(lambda jo: not is_valid(session, jo, schema_reference), pmm_files)) - if invalid_pmm: - for pmm in invalid_pmm: - session.warn(f"Invalid ProductMetadataMapping file: {pmm}") - session.error(f"Found {len(invalid_pmm)} invalid ProductMetadataMapping files") - - -@nox.session() -def version_update(session: nox.Session) -> None: - """rename tt and update content: nox -s version_update -- 02.21 02.22""" - if len(session.posargs) != 2: - raise RuntimeError( - "Unexpected number of input arguments, usage: " + "'python -m nox -s version_update -- 02.00 02.12" - ) - - current_version, new_version = session.posargs[0:2] - session.log(f"Bumping version from {current_version} to {new_version}") - - proc_tag_old = f"{current_version}" - proc_tag_new = f"{new_version}" - sw_tag_old = f"{current_version}" - sw_tag_new = f"{new_version}" - task_tag_old = f"{current_version}" - task_tag_new = f"{new_version}" - - task_tables = list(Path().rglob("*TaskTable*.xml")) - task_tables_renamed = 0 - task_tables_updated = 0 - for file in task_tables: - text = file.read_text(encoding="utf-8") - - update_file = False - if proc_tag_old in text: - update_file = True - text = text.replace(proc_tag_old, proc_tag_new) - - if sw_tag_old in text: - update_file = True - text = text.replace(sw_tag_old, sw_tag_new) - - if task_tag_old in text: - update_file = True - text = text.replace(task_tag_old, task_tag_new) - - if update_file: - file.write_text(text, encoding="utf-8") - session.run("git", "add", str(file), external=True) - task_tables_updated += 1 - - file_name = file.name - new_file_name = file_name.replace(current_version, new_version) - if new_file_name != file_name: - new_file = file.with_name(new_file_name) - session.run("git", "mv", "-f", str(file), str(new_file), external=True) - task_tables_renamed += 1 - - session.log(f"{task_tables_updated} task tables updates") - session.log(f"{task_tables_renamed} task tables renamed") - - proc_tag_old = f"{current_version}" - proc_tag_new = f"{new_version}" - - pmm_files = Path().rglob("*ProductMetadataMapping*.xml") - pmm_renamed = 0 - pmm_updated = 0 - for file in pmm_files: - text = file.read_text(encoding="utf-8") - - update_file = False - if proc_tag_old in text: - update_file = True - text = text.replace(proc_tag_old, proc_tag_new) - - if update_file: - file.write_text(text, encoding="utf-8") - session.run("git", "add", str(file), external=True) - pmm_updated += 1 - - file_name = file.name - new_file_name = file_name.replace(current_version, new_version) - if new_file_name != file_name: - new_file = file.with_name(new_file_name) - session.run("git", "mv", "-f", str(file), str(new_file), external=True) - pmm_renamed += 1 - - session.log(f"{pmm_updated} product metadata mapping updates") - session.log(f"{pmm_renamed} product metadata mapping renamed") diff --git a/bps-transcoder/noxfile.py b/bps-transcoder/noxfile.py deleted file mode 100644 index 36c4b387..00000000 --- a/bps-transcoder/noxfile.py +++ /dev/null @@ -1,48 +0,0 @@ -"""Automation file""" - -import sys - -import nox - -# Import common utilities from scripts folder -sys.path.append("../scripts") -import noxfile_common - -annotation_dir = "annotation/v4.5.0/" -XSD_FILES = [ - annotation_dir + "bio-l1ab-main-annotation.xsd", - annotation_dir + "bio-l1c-main-annotation.xsd", - annotation_dir + "bio-l1-annotations.xsd", - annotation_dir + "bio-l2a-fd-main-annotation.xsd", - annotation_dir + "bio-l2a-fh-main-annotation.xsd", - annotation_dir + "bio-l2a-tfh-main-annotation.xsd", - annotation_dir + "bio-l2a-gn-main-annotation.xsd", - annotation_dir + "bio-l2b-agb-main-annotation.xsd", - annotation_dir + "bio-l2b-fd-main-annotation.xsd", - annotation_dir + "bio-l2b-fh-main-annotation.xsd", - annotation_dir + "bio-l2l3-fd-proc-annotations.xsd", - annotation_dir + "bio-l2l3-fh-proc-annotations.xsd", - annotation_dir + "bio-l2l3-tfh-proc-annotations.xsd", - annotation_dir + "bio-l2l3-agb-proc-annotations.xsd", - annotation_dir + "bio-l2l3-common-annotations.xsd", - annotation_dir + "bio-common-types.xsd", - "bio-l1-overlay-support.xsd", - "bio-l1-overlay.xsd", - "bio-l1-vrt.xsd", - "bio-aux-orbit.xsd", - "bio-aux-attitude.xsd", -] - - -@nox.session -def check_xsd(session: nox.Session): - """Check that XSD inside package are aligned with those main folder""" - - noxfile_common.run_check_xsd(session, "transcoder", XSD_FILES) - - -@nox.session -def align_xsd(session: nox.Session): - """Align XSD inside package with those main folder""" - - noxfile_common.run_align_xsd(session, "transcoder", XSD_FILES) diff --git a/bps-transcoder/pyproject.toml b/bps-transcoder/pyproject.toml index 785dc2e0..96893abc 100644 --- a/bps-transcoder/pyproject.toml +++ b/bps-transcoder/pyproject.toml @@ -34,7 +34,7 @@ classifiers = [ ] [project.optional-dependencies] -dev = ["nox", "ruff==0.17.4", "pyrefly==1.4.1"] +dev = ["ruff==0.17.4", "pyrefly==1.4.1"] test = ["unittest-xml-reporting", "coverage"] [build-system] diff --git a/scripts/fawltydeps.toml b/fawltydeps.toml similarity index 94% rename from scripts/fawltydeps.toml rename to fawltydeps.toml index fc9c9518..73682dda 100644 --- a/scripts/fawltydeps.toml +++ b/fawltydeps.toml @@ -13,7 +13,6 @@ ignore_unused = [ 'coverage', # dev dependency 'ruff', # dev dependency 'pyrefly', # dev dependency - 'nox', # dev dependency 'unittest-xml-reporting', # dev dependency ] verbosity = 1 diff --git a/noxfile.py b/noxfile.py deleted file mode 100644 index fd162667..00000000 --- a/noxfile.py +++ /dev/null @@ -1,165 +0,0 @@ -# Project: BIOMASS Processing Suite (BPS) -# -# Copyright (c) 2025, ARESYS S.r.l. -# Developed under contract with the European Space Agency (ESA) -# -# SPDX-License-Identifier: MIT - -""" -BPS nox automation file ------------------------ -""" - -import sys -from collections.abc import Callable -from pathlib import Path - -import nox - -# Import xsd generation helper module from scripts folder -sys.path.append("scripts") -import noxfile_common -import xsd_generation_helper - -RUFF_VERSION = noxfile_common.RUFF_VERSION - - -@nox.session -def align_xsd(session: nox.Session): - """Align xsd in the "subpackages""" - session.install("nox") - for package in [ - "bps-transcoder", - "bps-l1_processor", - "bps-stack_processor", - "bps-l2a_processor", - "bps-l2b_fh_processor", - "bps-l2b_fd_processor", - "bps-l2b_agb_processor", - ]: - session.chdir(package) - session.run("python", "-m", "nox", "-s", "align_xsd") - session.chdir("..") - - -@nox.session -def generate_xsd_models(session: nox.Session): - """Generate XSD models with xsdata - - Usage: - python -m nox -r -s generate_xsd_models - - Before xsd models generation, it is necessary to provide the - xsd files describing Aresys BrickSAR configurations and interfaces. - They have to be placed in the xsd/bricksar-xsd directory. - Use scripts\restrict_xsd_to_bps.py to restrict the xsd files to - the relevant BPS content. - """ - session.install("xsdata[cli]", f"ruff=={RUFF_VERSION}") - xsd_generation_helper.generate_xsd_models(session) - - -def walk_with_filter( - path: Path, - *, - relevant_file: Callable[[Path], bool] | None = None, - relevant_dir: Callable[[Path], bool] | None = None, -): - """Generator that yields all the relevant files inside a given directory""" - if path.is_file(): - if relevant_file and not relevant_file(path): - return - yield path - else: - if relevant_dir and not relevant_dir(path): - return - for item in path.iterdir(): - yield from walk_with_filter(item, relevant_file=relevant_file, relevant_dir=relevant_dir) - - -def get_bps_common_version_no_install() -> str: - """Get bps-common version by parsing of the init""" - - content = Path("bps-common", "bps", "common", "__init__.py").read_text(encoding="utf-8") - - current_version: str | None = None - for line in content.splitlines(): - result = line.split("__version__ = ") - if len(result) == 2: - current_version = result[1].replace('"', "") - break - - assert current_version - return current_version - - -def get_version_in_bps_format(version: str) -> str: - """Convert a version to the BPS format""" - major, minor, patch = (int(x) for x in version.split(".")[0:3]) - if minor > 9 or patch > 9: - raise RuntimeError(f"Minor and patch version cannot exceed '9': {version}") - - minor_bps = minor * 10 + patch - assert minor_bps < 99 - return f"{major:02d}.{minor_bps:02d}" - - -@nox.session() -def version_update(session: nox.Session) -> None: - """Update BPS version""" - if len(session.posargs) != 1: - raise RuntimeError("Unexpected number of input arguments, usage: 'nox -s version_update -- 1.0.0'") - - new_version = session.posargs[0] - current_version = get_bps_common_version_no_install() - session.log(f"Bumping version from {current_version} to {new_version}") - - def relevant_file(path: Path) -> bool: - if any(path.parts[index : index + 2] == ("transcoder", "io") for index in range(len(path.parts) - 1)): - return False - if path.name == "__init__.py": - return True - if path.name == "pyproject.toml": - return True - return path.name == "meta.yaml" - - def relevant_dir(path: Path) -> bool: - name = path.resolve().name - return name != "build" and not name.startswith(".") - - updated_files = 0 - for file in walk_with_filter(Path.cwd(), relevant_file=relevant_file, relevant_dir=relevant_dir): - text = file.read_text(encoding="utf-8") - if current_version in text: - new_text = text.replace(current_version, new_version) - if new_text == text: - session.log(f"No version update needed in {file}") - continue - updated_files += 1 - session.log(f"Updating version in {file}") - file.write_text(new_text, encoding="utf-8") - session.log(f"{updated_files} files updated") - - new_version_bps = get_version_in_bps_format(new_version) - current_version_bps = get_version_in_bps_format(current_version) - if new_version_bps == current_version_bps: - session.log(f"BPS version {current_version_bps} requires no update") - return - - session.log(f"Bumping BPS version from {current_version_bps} to {new_version_bps}") - updated_files = 0 - for file in walk_with_filter(Path.cwd(), relevant_file=relevant_file, relevant_dir=relevant_dir): - text = file.read_text(encoding="utf-8") - if current_version_bps in text: - updated_files += 1 - new_text = text.replace(current_version_bps, new_version_bps) - if text == new_text: - session.log(f"No BPS version update needed in {file}") - continue - session.log(f"Updating BPS version in {file}") - file.write_text(new_text, encoding="utf-8") - session.log(f"{updated_files} files updated") - - with session.chdir("bps-task-tables"): - session.install("nox") - session.run(*f"python -m nox -r -s version_update -- {current_version_bps} {new_version_bps}".split()) diff --git a/pyrefly.toml b/pyrefly.toml index 55dfb8ba..dcd58ed9 100644 --- a/pyrefly.toml +++ b/pyrefly.toml @@ -8,10 +8,8 @@ project-excludes = [ "bps-common/bps/common/mask_io.py", "bps-common/bps/common/toi_utils.py", "bps-common/bps/common/utils.py", - "bps-common/noxfile.py", "bps-common/test/test_roi_utils.py", "bps-common/test/test_toi_utils.py", - "bps-l1_core_processor/noxfile.py", "bps-l1_framing_processor/bps/l1_framing_processor/commands.py", "bps-l1_framing_processor/bps/l1_framing_processor/l1_framer/l1_framer.py", "bps-l1_framing_processor/bps/l1_framing_processor/l1_vfra_product/l1_vfra_product.py", @@ -20,20 +18,17 @@ project-excludes = [ "bps-l1_framing_processor/bps/l1_framing_processor/orbit/xl.py", "bps-l1_framing_processor/bps/l1_framing_processor/orbit/xorb.py", "bps-l1_framing_processor/bps/l1_framing_processor/utils/time_conversions.py", - "bps-l1_framing_processor/noxfile.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/__main__.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/biomass_l1geoproduct_writer.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/biomass_l1product_reader.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/cli.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/geocoding_utils.py", "bps-l1_geocoding_tool/bps/l1_geocoding_tool/main.py", - "bps-l1_geocoding_tool/noxfile.py", "bps-l1_geocoding_tool/test/test_cli.py", "bps-l1_pre_processor/bps/l1_pre_processor/aux_ins/estimated_noise.py", "bps-l1_pre_processor/bps/l1_pre_processor/aux_ins/netcdf_utils.py", "bps-l1_pre_processor/bps/l1_pre_processor/aux_ins/pattern.py", "bps-l1_pre_processor/bps/l1_pre_processor/translate.py", - "bps-l1_pre_processor/noxfile.py", "bps-l1_processor/bps/l1_processor/autofocus/af_lib.py", "bps-l1_processor/bps/l1_processor/autofocus/signalproclib.py", "bps-l1_processor/bps/l1_processor/cli.py", @@ -46,7 +41,6 @@ project-excludes = [ "bps-l1_processor/bps/l1_processor/post/run.py", "bps-l1_processor/bps/l1_processor/processor_interface/xsd_validation.py", "bps-l1_processor/bps/l1_processor/scene_center.py", - "bps-l1_processor/noxfile.py", "bps-l1_processor/tests/test_rfi_activation_mask.py", "bps-l2a_processor/bps/l2a_processor/commands.py", "bps-l2a_processor/bps/l2a_processor/core/translate_aux_pp2_2a.py", @@ -57,22 +51,18 @@ project-excludes = [ "bps-l2a_processor/bps/l2a_processor/l2a_common_functionalities.py", "bps-l2a_processor/bps/l2a_processor/processor_interface/xsd_validation.py", "bps-l2a_processor/bps/l2a_processor/tomo_fh/tomo_fh_commands.py", - "bps-l2a_processor/noxfile.py", "bps-l2b_agb_processor/bps/l2b_agb_processor/agb/agb_commands.py", "bps-l2b_agb_processor/bps/l2b_agb_processor/commands.py", "bps-l2b_agb_processor/bps/l2b_agb_processor/l2b_common_functionalities.py", "bps-l2b_agb_processor/bps/l2b_agb_processor/processor_interface/xsd_validation.py", - "bps-l2b_agb_processor/noxfile.py", "bps-l2b_fd_processor/bps/l2b_fd_processor/commands.py", "bps-l2b_fd_processor/bps/l2b_fd_processor/fd/fd_commands.py", "bps-l2b_fd_processor/bps/l2b_fd_processor/l2b_common_functionalities.py", "bps-l2b_fd_processor/bps/l2b_fd_processor/processor_interface/xsd_validation.py", - "bps-l2b_fd_processor/noxfile.py", "bps-l2b_fh_processor/bps/l2b_fh_processor/commands.py", "bps-l2b_fh_processor/bps/l2b_fh_processor/fh/fh_commands.py", "bps-l2b_fh_processor/bps/l2b_fh_processor/l2b_common_functionalities.py", "bps-l2b_fh_processor/bps/l2b_fh_processor/processor_interface/xsd_validation.py", - "bps-l2b_fh_processor/noxfile.py", "bps-stack_cal_processor/bps/stack_cal_processor/configuration.py", "bps-stack_cal_processor/bps/stack_cal_processor/core/azf/azimuthfilter.py", "bps-stack_cal_processor/bps/stack_cal_processor/core/azf/utils.py", @@ -106,7 +96,6 @@ project-excludes = [ "bps-stack_cal_processor/bps/stack_cal_processor/core/skp/utils.py", "bps-stack_cal_processor/bps/stack_cal_processor/core/utils.py", "bps-stack_cal_processor/bps/stack_cal_processor/input_manager.py", - "bps-stack_cal_processor/noxfile.py", "bps-stack_cal_processor/test/test_input_manager.py", "bps-stack_cal_processor/test/test_mpmb.py", "bps-stack_cal_processor/test/test_signal_processing.py", @@ -117,13 +106,11 @@ project-excludes = [ "bps-stack_coreg_processor/bps/stack_coreg_processor/core/interpolation.py", "bps-stack_coreg_processor/bps/stack_coreg_processor/core/shifting.py", "bps-stack_coreg_processor/bps/stack_coreg_processor/translate.py", - "bps-stack_coreg_processor/noxfile.py", "bps-stack_coreg_processor/test/test_shifting.py", "bps-stack_pre_processor/bps/stack_pre_processor/core/geometry.py", "bps-stack_pre_processor/bps/stack_pre_processor/core/preprocessing.py", "bps-stack_pre_processor/bps/stack_pre_processor/core/utils.py", "bps-stack_pre_processor/bps/stack_pre_processor/interface.py", - "bps-stack_pre_processor/noxfile.py", "bps-stack_pre_processor/test/test_geometry.py", "bps-stack_pre_processor/test/test_preprocessing.py", "bps-stack_pre_processor/test/test_utils.py", @@ -139,7 +126,6 @@ project-excludes = [ "bps-stack_processor/bps/stack_processor/run_stack_processor.py", "bps-stack_processor/bps/stack_processor/utils/memorycheck.py", "bps-stack_processor/bps/stack_processor/utils/numba_utils.py", - "bps-stack_processor/noxfile.py", "bps-transcoder/bps/transcoder/orbit/eoorbit.py", "bps-transcoder/bps/transcoder/orbit/orbit.py", "bps-transcoder/bps/transcoder/sarproduct/biomass_l1product_reader.py", @@ -167,12 +153,10 @@ project-excludes = [ "bps-transcoder/bps/transcoder/utils/quality_index.py", "bps-transcoder/bps/transcoder/utils/quicklook_utils.py", "bps-transcoder/bps/transcoder/utils/xsd_schema_attacher.py", - "bps-transcoder/noxfile.py", "bps-transcoder/test/io_/test_translate_common_annotations_l1.py", "bps-transcoder/test/io_/test_translate_common.py", "bps-transcoder/test/test_product_name.py", "bps-transcoder/test/test_quality_index_utils.py", - "noxfile.py", "test/integration/suite/base/bps-l1-iri.py", "test/integration/suite/e2e/bps-e2e.py", "test/integration/suite/l1/l1p/bps-l1p.py", diff --git a/ruff.toml b/ruff.toml index a5cb2f83..34da25ff 100644 --- a/ruff.toml +++ b/ruff.toml @@ -21,4 +21,3 @@ line-ending = "lf" "test/*.py" = ["CPY"] "*/test/*.py" = ["CPY"] "*/tests/*.py" = ["CPY"] -"noxfile.py" = ["CPY"] diff --git a/scripts/xsd_generation_helper.py b/scripts/generate_xsd_models.py similarity index 91% rename from scripts/xsd_generation_helper.py rename to scripts/generate_xsd_models.py index 84ea75e6..6a0558ba 100644 --- a/scripts/xsd_generation_helper.py +++ b/scripts/generate_xsd_models.py @@ -5,21 +5,19 @@ # # SPDX-License-Identifier: MIT -""" -XSD models generation helper module ------------------------------------ -""" +"""Generate Python models from the configured XSD files.""" +import argparse import ast import contextlib import os +import subprocess +import sys from collections.abc import Iterable from dataclasses import dataclass, field from pathlib import Path from typing import Any -import nox - LICENSE_HEADER = """# Project: BIOMASS Processing Suite (BPS) # # Copyright (c) 2025, ARESYS S.r.l. @@ -29,11 +27,7 @@ """ -# NOTE: To (re)generate the BrickSAR's XSD models, uncomment relevant line -# below: -# -# # XSD_FILES += XSD_FILES_BRICKSAR -# +ROOT = Path(__file__).resolve().parent.parent @dataclass @@ -53,7 +47,7 @@ class XSDInfo: module_docstring: str = field(init=False) def __post_init__(self): - self.namespace_base_dir = Path(f"bps-{self.namespace}").absolute() + self.namespace_base_dir = ROOT / f"bps-{self.namespace}" self.package_dir = self.namespace_base_dir.joinpath("bps", self.namespace, "io", *self.subpackage.split(".")) self.models_file = self.package_dir.joinpath("models.py") self.init_file = self.package_dir.joinpath("__init__.py") @@ -62,7 +56,7 @@ def __post_init__(self): self.module_docstring = '"""\n' + self.description + "\n" + len(self.description) * "-" + '\n"""\n' -XSD_SOURCE_DIR = Path("xsd").absolute() +XSD_SOURCE_DIR = ROOT / "xsd" BRICKSAR_XSD = XSD_SOURCE_DIR.joinpath("bricksar-xsd") BIOMASS_XSD = XSD_SOURCE_DIR.joinpath("biomass-xsd") ANNOTATION_XSD = BIOMASS_XSD.joinpath("annotation") @@ -330,8 +324,6 @@ def __post_init__(self): XSD_FILES: list[XSDInfo] = [] XSD_FILES += XSD_FILES_BIOMASS -# XSD_FILES += XSD_FILES_BRICKSAR -# XSD_FILES += XSD_FILES_ICD for version in VERSIONS: XSD_FILES += XSD_ANNOTATION[version] @@ -371,20 +363,25 @@ def exclude(xsd_files: list[XSDInfo], subpackages: set[str]) -> list[XSDInfo]: return [xsd_file for xsd_file in xsd_files if xsd_file.subpackage not in subpackages] -def generate_xsd_models(session: nox.Session): - """XSD Models generation core function""" +def generate_xsd_models() -> None: + """Generate XSD models; requires xsdata[cli] and ruff in the active environment.""" for xsd_file in XSD_FILES: with contextlib.chdir(xsd_file.namespace_base_dir): - command = ( - "xsdata generate" - + f" --package {xsd_file.package}" - + " --structure-style single-package" - + f" --config {XSDATA_CONFIG_FILE}" - + f" {xsd_file.xsd_path}" + subprocess.run( + [ + "xsdata", + "generate", + "--package", + xsd_file.package, + "--structure-style", + "single-package", + "--config", + str(XSDATA_CONFIG_FILE), + str(xsd_file.xsd_path), + ], + check=True, ) - session.run(*command.split()) - # BPS is a namespace: it should not contain __init__.py, but xsdata generates it extra_init_file = xsd_file.namespace_base_dir.joinpath("bps", "__init__.py") assert extra_init_file.read_text(encoding="utf-8") == "# nothing here\n" @@ -418,8 +415,8 @@ def generate_xsd_models(session: nox.Session): files = [str(xsd_file.models_file) for xsd_file in XSD_FILES] files += [str(xsd_file.init_file) for xsd_file in XSD_FILES] - session.run("python", "-m", "ruff", "format", *files) - session.run("python", "-m", "ruff", "check", *files, "--select", "I", "--fix") + subprocess.run([sys.executable, "-m", "ruff", "format", *files], check=True) + subprocess.run([sys.executable, "-m", "ruff", "check", *files, "--select", "I", "--fix"], check=True) def index_from_right(input_list: list, value: Any) -> int: @@ -462,7 +459,7 @@ def move_definitions_to_common_file(common_module_file, common_module_init_file, module_classes = get_classes(module_ast) module_classes_to_be_moved = filter( - lambda element: str(element.name).lower() in class_to_move and element.name not in common_classes_names, + lambda element: element.name.lower() in class_to_move and element.name not in common_classes_names, module_classes, ) @@ -551,3 +548,16 @@ def restore_original_formatting(module: str) -> str: module = module.replace(*replace_item) return module + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate Python models from the configured XSD files.") + parser.add_argument("--bs", action="store_true", default=False, help="Include BrickSAR XSD models") + parser.add_argument("--icd", action="store_true", default=False, help="Include ICD XSD models") + parser.add_argument("--all", action="store_true", default=False, help="Include both BrickSAR and ICD XSD models") + args = parser.parse_args() + if args.bs or args.all: + XSD_FILES += XSD_FILES_BRICKSAR + if args.icd or args.all: + XSD_FILES += XSD_FILES_ICD + generate_xsd_models() diff --git a/scripts/noxfile_common.py b/scripts/noxfile_common.py deleted file mode 100644 index 2e2584b1..00000000 --- a/scripts/noxfile_common.py +++ /dev/null @@ -1,73 +0,0 @@ -# Project: BIOMASS Processing Suite (BPS) -# -# Copyright (c) 2025, ARESYS S.r.l. -# Developed under contract with the European Space Agency (ESA) -# -# SPDX-License-Identifier: MIT - -""" -BPS nox automation utilities file ---------------------------------- -""" - -import shutil -from pathlib import Path - -import nox - -RUFF_VERSION = "0.17.4" - - -def run_format_fix(session: nox.Session): - """Fix files: format and sort import""" - session.install(f"ruff=={RUFF_VERSION}") - session.run("python", "-m", "ruff", "format", ".") - session.run("python", "-m", "ruff", "check", ".", "--select", "I", "--fix") - - -def run_check_xsd(session: nox.Session, package: str, file_list: list[str]): - """Check that XSD inside package are aligned with those main folder""" - - package_root = Path(__file__).resolve().parent.parent - - package_xsd_dir = Path("bps", package, "xsd", "biomass-xsd") - package_xsd_dir.mkdir(exist_ok=True, parents=True) - reference_xsd_dir = package_root / "xsd" / "biomass-xsd" - - fail = False - for xsd in file_list: - reference_xsd = reference_xsd_dir / xsd - package_xsd = package_xsd_dir / reference_xsd.name - if not package_xsd.exists(): - session.warn(f"xsd: {xsd} is not in the package folder") - fail = True - elif reference_xsd.read_bytes() != package_xsd.read_bytes(): - session.warn(f"xsd: {xsd} is not aligned") - fail = True - - if fail: - session.error(f"xsd inside package are not aligned: run 'cd {package}; nox -s align_xsd") - - -def run_align_xsd(session: nox.Session, package: str, file_list: list[str]): - """Align XSD inside package with those main folder""" - - package_root = Path(__file__).resolve().parent.parent - - package_xsd_dir = Path("bps", package, "xsd", "biomass-xsd") - package_xsd_dir.mkdir(exist_ok=True, parents=True) - reference_xsd_dir = package_root / "xsd" / "biomass-xsd" - - for xsd in file_list: - reference_xsd = reference_xsd_dir / xsd - package_xsd = package_xsd_dir / reference_xsd.name - - session.log(f"Copy {reference_xsd} onto {package_xsd}") - shutil.copyfile(reference_xsd, package_xsd) - - -# Default sessions -@nox.session() -def format_fix(session: nox.Session): - """Fix files: format and sort import""" - run_format_fix(session) diff --git a/scripts/validate_task_tables.py b/scripts/validate_task_tables.py new file mode 100644 index 00000000..9c9e0660 --- /dev/null +++ b/scripts/validate_task_tables.py @@ -0,0 +1,61 @@ +# Project: BIOMASS Processing Suite (BPS) +# +# Copyright (c) 2025, ARESYS S.r.l. +# Developed under contract with the European Space Agency (ESA) +# +# SPDX-License-Identifier: MIT + +"""Validate task-table and product-metadata XML files against their XSDs.""" + +import subprocess +import sys +from pathlib import Path + + +def validate_group( + script_dir: Path, + pattern: str, + schema: Path, + label: str, +) -> int: + """Validate matching XML files and return the number of failures.""" + invalid = 0 + for xml_file in sorted(script_dir.rglob(pattern)): + result = subprocess.run( + ["xmllint", str(xml_file), "--noout", "--schema", str(schema)], + check=False, + ) + if result.returncode != 0: + print(f"Invalid {label} file: {xml_file}", file=sys.stderr) + invalid += 1 + + if invalid: + print(f"Found {invalid} invalid {label} file(s)", file=sys.stderr) + + return invalid + + +def main() -> int: + root_dir = Path(__file__).resolve().parent.parent + task_table_dir = root_dir / "bps-task-tables" + schema_dir = root_dir / "xsd" / "icd-xsd" / "generic" / "tasktable" / "v1_4" + + invalid = validate_group( + task_table_dir, + "*TaskTable*.xml", + schema_dir / "IF_PF_Proc_Task_Table.xsd", + "TaskTable", + ) + + invalid += validate_group( + task_table_dir, + "*ProductMetadataMapping.xml", + schema_dir / "IF_PF_Proc_ProductMetadataMapping.xsd", + "ProductMetadataMapping", + ) + + return 1 if invalid else 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/version_update.py b/scripts/version_update.py new file mode 100644 index 00000000..5fae48fa --- /dev/null +++ b/scripts/version_update.py @@ -0,0 +1,189 @@ +# Project: BIOMASS Processing Suite (BPS) +# +# Copyright (c) 2025, ARESYS S.r.l. +# Developed under contract with the European Space Agency (ESA) +# +# SPDX-License-Identifier: MIT + +"""Update BPS package versions and task-table versions. + +Run with: + python scripts/version_update.py 1.2.3 +""" + +from __future__ import annotations + +import re +import subprocess +import sys +from collections.abc import Callable, Iterator +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent + + +def walk_with_filter( + path: Path, + *, + relevant_file: Callable[[Path], bool] | None = None, + relevant_dir: Callable[[Path], bool] | None = None, +) -> Iterator[Path]: + """Yield the relevant files below a directory.""" + if path.is_file(): + if relevant_file is None or relevant_file(path): + yield path + return + + if relevant_dir is not None and not relevant_dir(path): + return + for item in path.iterdir(): + yield from walk_with_filter(item, relevant_file=relevant_file, relevant_dir=relevant_dir) + + +def get_bps_common_version() -> str: + """Read the current version from bps-common.""" + init_file = ROOT / "bps-common" / "bps" / "common" / "__init__.py" + content = init_file.read_text(encoding="utf-8") + match = re.search(r"^\s*__version__\s*=\s*['\"]([^'\"]+)['\"]", content, re.MULTILINE) + if match is None: + raise RuntimeError(f"Could not find __version__ in {init_file}") + return match.group(1) + + +def get_version_in_bps_format(version: str) -> str: + """Convert a version's numeric components to the BPS two-component format.""" + components = version.split(".")[:3] + if len(components) != 3: + raise ValueError(f"Version must start with major.minor.patch: {version}") + try: + major, minor, patch = (int(component) for component in components) + except ValueError as error: + raise ValueError(f"Version must start with major.minor.patch: {version}") from error + + if minor > 9 or patch > 9: + raise ValueError(f"Minor and patch version cannot exceed '9': {version}") + + minor_bps = minor * 10 + patch + if minor_bps >= 99: + raise ValueError(f"BPS minor version must be less than '99': {version}") + return f"{major:02d}.{minor_bps:02d}" + + +def relevant_file(path: Path) -> bool: + """Select package version metadata, excluding transcoder I/O modules.""" + if any(path.parts[index : index + 2] == ("transcoder", "io") for index in range(len(path.parts) - 1)): + return False + return path.name in {"__init__.py", "pyproject.toml", "meta.yaml"} + + +def relevant_dir(path: Path) -> bool: + """Skip generated build trees and hidden directories.""" + name = path.name + return name != "build" and not name.startswith(".") + + +def replace_version(old_version: str, new_version: str, *, log_prefix: str = "") -> int: + """Replace a version in relevant files and return the number changed.""" + updated_files = 0 + for file in walk_with_filter(ROOT, relevant_file=relevant_file, relevant_dir=relevant_dir): + text = file.read_text(encoding="utf-8") + new_text = text.replace(old_version, new_version) + if new_text == text: + continue + print(f"Updating {log_prefix}version in {file.relative_to(ROOT)}") + file.write_text(new_text, encoding="utf-8") + updated_files += 1 + return updated_files + + +def update_task_table_files(task_tables_dir: Path, current_version: str, new_version: str) -> None: + """Update and rename task tables and product metadata mapping files.""" + + def run_git(*args: str) -> None: + subprocess.run(["git", *args], cwd=task_tables_dir, check=True) + + print(f"Bumping task-table version from {current_version} to {new_version}") + proc_tag_old = f"{current_version}" + proc_tag_new = f"{new_version}" + sw_tag_old = f"{current_version}" + sw_tag_new = f"{new_version}" + task_tag_old = f"{current_version}" + task_tag_new = f"{new_version}" + + task_tables = list(task_tables_dir.rglob("*TaskTable*.xml")) + task_tables_renamed = 0 + task_tables_updated = 0 + for file in task_tables: + text = file.read_text(encoding="utf-8") + updated_text = ( + text.replace(proc_tag_old, proc_tag_new).replace(sw_tag_old, sw_tag_new).replace(task_tag_old, task_tag_new) + ) + relative_file = file.relative_to(task_tables_dir) + + if updated_text != text: + file.write_text(updated_text, encoding="utf-8") + run_git("add", "--", str(relative_file)) + task_tables_updated += 1 + + new_file = file.with_name(file.name.replace(current_version, new_version)) + if new_file != file: + run_git("mv", "-f", "--", str(relative_file), str(new_file.relative_to(task_tables_dir))) + task_tables_renamed += 1 + + print(f"{task_tables_updated} task tables updated") + print(f"{task_tables_renamed} task tables renamed") + + proc_tag_old = f"{current_version}" + proc_tag_new = f"{new_version}" + pmm_files = list(task_tables_dir.rglob("*ProductMetadataMapping*.xml")) + pmm_renamed = 0 + pmm_updated = 0 + for file in pmm_files: + text = file.read_text(encoding="utf-8") + updated_text = text.replace(proc_tag_old, proc_tag_new) + relative_file = file.relative_to(task_tables_dir) + + if updated_text != text: + file.write_text(updated_text, encoding="utf-8") + run_git("add", "--", str(relative_file)) + pmm_updated += 1 + + new_file = file.with_name(file.name.replace(current_version, new_version)) + if new_file != file: + run_git("mv", "-f", "--", str(relative_file), str(new_file.relative_to(task_tables_dir))) + pmm_renamed += 1 + + print(f"{pmm_updated} product metadata mappings updated") + print(f"{pmm_renamed} product metadata mappings renamed") + + +def update(new_version: str) -> None: + """Update package metadata, task tables, and product metadata mappings.""" + current_version = get_bps_common_version() + current_version_bps = get_version_in_bps_format(current_version) + new_version_bps = get_version_in_bps_format(new_version) + + print(f"Bumping version from {current_version} to {new_version}") + updated = replace_version(current_version, new_version) + print(f"{updated} files updated") + + if new_version_bps == current_version_bps: + print(f"BPS version {current_version_bps} requires no update") + return + + print(f"Bumping BPS version from {current_version_bps} to {new_version_bps}") + updated = replace_version(current_version_bps, new_version_bps, log_prefix="BPS ") + print(f"{updated} files updated") + + task_tables_dir = ROOT / "bps-task-tables" + update_task_table_files(task_tables_dir, current_version_bps, new_version_bps) + + +def main() -> None: + if len(sys.argv) != 2: + raise SystemExit("Usage: python scripts/version_update.py major.minor.patch") + update(sys.argv[1]) + + +if __name__ == "__main__": + main() diff --git a/scripts/xsd_alignment.py b/scripts/xsd_alignment.py new file mode 100644 index 00000000..638d7b39 --- /dev/null +++ b/scripts/xsd_alignment.py @@ -0,0 +1,145 @@ +# Project: BIOMASS Processing Suite (BPS) +# +# Copyright (c) 2025, ARESYS S.r.l. +# Developed under contract with the European Space Agency (ESA) +# +# SPDX-License-Identifier: MIT + +"""Check or align package XSD files with the repository's reference XSD files.""" + +import argparse +import shutil +import sys +from pathlib import Path + +PACKAGE_XSD_FILES = { + "l1_processor": [ + "bio-aux-pp1.xsd", + "bio-common-types.xsd", + ], + "l2a_processor": [ + "bio-aux-pp2_2a.xsd", + "bio-common-types.xsd", + ], + "l2b_agb_processor": [ + "bio-aux-pp2_ab.xsd", + "bio-common-types.xsd", + ], + "l2b_fd_processor": [ + "bio-aux-pp2_fd.xsd", + "bio-common-types.xsd", + ], + "l2b_fh_processor": [ + "bio-aux-pp2_fh.xsd", + "bio-common-types.xsd", + ], + "stack_processor": [ + "bio-aux-pps.xsd", + "bio-common-types.xsd", + ], + "transcoder": [ + "annotation/v4.5.0/bio-l1ab-main-annotation.xsd", + "annotation/v4.5.0/bio-l1c-main-annotation.xsd", + "annotation/v4.5.0/bio-l1-annotations.xsd", + "annotation/v4.5.0/bio-l2a-fd-main-annotation.xsd", + "annotation/v4.5.0/bio-l2a-fh-main-annotation.xsd", + "annotation/v4.5.0/bio-l2a-tfh-main-annotation.xsd", + "annotation/v4.5.0/bio-l2a-gn-main-annotation.xsd", + "annotation/v4.5.0/bio-l2b-agb-main-annotation.xsd", + "annotation/v4.5.0/bio-l2b-fd-main-annotation.xsd", + "annotation/v4.5.0/bio-l2b-fh-main-annotation.xsd", + "annotation/v4.5.0/bio-l2l3-fd-proc-annotations.xsd", + "annotation/v4.5.0/bio-l2l3-fh-proc-annotations.xsd", + "annotation/v4.5.0/bio-l2l3-tfh-proc-annotations.xsd", + "annotation/v4.5.0/bio-l2l3-agb-proc-annotations.xsd", + "annotation/v4.5.0/bio-l2l3-common-annotations.xsd", + "annotation/v4.5.0/bio-common-types.xsd", + "bio-l1-overlay-support.xsd", + "bio-l1-overlay.xsd", + "bio-l1-vrt.xsd", + "bio-aux-orbit.xsd", + "bio-aux-attitude.xsd", + ], +} +SUBPROJECT_TO_PACKAGE = {f"bps-{package}": package for package in PACKAGE_XSD_FILES} + + +def _get_xsd_directories(package: str) -> tuple[Path, Path]: + repository_root = Path(__file__).resolve().parent.parent + package_xsd_dir = repository_root / f"bps-{package}" / "bps" / package / "xsd" / "biomass-xsd" + reference_xsd_dir = repository_root / "xsd" / "biomass-xsd" + return package_xsd_dir, reference_xsd_dir + + +def check_xsd_alignment(package: str) -> bool: + """Return whether the selected package XSD files match their references.""" + + package_xsd_dir, reference_xsd_dir = _get_xsd_directories(package) + aligned = True + + for xsd in PACKAGE_XSD_FILES[package]: + reference_xsd = reference_xsd_dir / xsd + package_xsd = package_xsd_dir / reference_xsd.name + + if not reference_xsd.is_file(): + print(f"Reference XSD does not exist: {reference_xsd}", file=sys.stderr) + aligned = False + elif not package_xsd.is_file(): + print(f"XSD is not in the package folder: {package_xsd}", file=sys.stderr) + aligned = False + elif reference_xsd.read_bytes() != package_xsd.read_bytes(): + print(f"XSD is not aligned: {xsd}", file=sys.stderr) + aligned = False + + return aligned + + +def align_xsd(package: str) -> bool: + """Copy the selected package's reference XSD files into the package.""" + + package_xsd_dir, reference_xsd_dir = _get_xsd_directories(package) + package_xsd_dir.mkdir(exist_ok=True, parents=True) + aligned = True + + for xsd in PACKAGE_XSD_FILES[package]: + reference_xsd = reference_xsd_dir / xsd + package_xsd = package_xsd_dir / reference_xsd.name + + if not reference_xsd.is_file(): + print(f"Reference XSD does not exist: {reference_xsd}", file=sys.stderr) + aligned = False + continue + + print(f"Copy {reference_xsd} onto {package_xsd}") + shutil.copyfile(reference_xsd, package_xsd) + + return aligned + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + subparsers = parser.add_subparsers(dest="command", required=True) + + for command in ("check", "align"): + subparser = subparsers.add_parser(command) + subparser.add_argument("subproject", choices=SUBPROJECT_TO_PACKAGE, help="subproject to process") + + args = parser.parse_args() + package = SUBPROJECT_TO_PACKAGE[args.subproject] + + if args.command == "align": + if not align_xsd(package): + return 1 + print(f"XSD files inside subproject {args.subproject!r} aligned successfully.") + return 0 + + if not check_xsd_alignment(package): + print(f"XSD files inside subproject {args.subproject!r} are not aligned.", file=sys.stderr) + return 1 + + print(f"XSD files inside subproject {args.subproject!r} are aligned.") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())