Skip to content
Snippets Groups Projects
Commit 0a3b646d authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Merge branch 'TMSS-3170' into 'main'

TMSS-3170: Upgrade to newest template and use pycommon package

Closes TMSS-3170

See merge request !2
parents 0f186625 2d0d2650
Branches
Tags v2.0.0
1 merge request!2TMSS-3170: Upgrade to newest template and use pycommon package
Pipeline #107023 passed with warnings
Pipeline: LOFAR TMSS Client

#107024

    Showing
    with 871 additions and 498 deletions
    dist/*
    *.egg-info
    *.pyc
    .tox
    .coverage
    coverage.xml
    htmlcov/*
    build
    dist
    # Documentation
    docs/source/source_documentation
    !docs/source/source_documentation/index.rst
    docs/build
    # Setuptools SCM
    lofar_tmss_client/_version.py
    # IDE configuration
    .vscode
    .idea
    default:
    image: $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG
    cache:
    paths:
    - .cache/pip
    # Do not cache .tox, to recreate virtualenvs for every step
    stages:
    - prepare
    - lint
    - test
    - package
    - images
    - integration
    - publish # publish instead of deploy
    # Caching of dependencies to speed up builds
    variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    PIP_EXTRA_INDEX_URL: https://git.astron.nl/api/v4/projects/744/packages/pypi/simple https://git.astron.nl/api/v4/projects/745/packages/pypi/simple
    SECURE_LOG_LEVEL: debug
    include:
    - template: Security/SAST.gitlab-ci.yml
    - template: Security/Dependency-Scanning.gitlab-ci.yml
    - template: Security/Secret-Detection.gitlab-ci.yml
    # Prepare image to run ci on
    trigger_prepare:
    stage: prepare
    trigger:
    strategy: depend
    include: .prepare.gitlab-ci.yml
    run_black:
    stage: lint
    script:
    - tox -e black
    allow_failure: true
    run_flake8:
    stage: lint
    script:
    - tox -e pep8
    allow_failure: true
    run_pylint:
    stage: lint
    script:
    - tox -e pylint
    allow_failure: true
    sast:
    variables:
    SAST_EXCLUDED_ANALYZERS: brakeman, flawfinder, kubesec, nodejs-scan, phpcs-security-audit,
    pmd-apex, security-code-scan, sobelow, spotbugs
    stage: test
    gemnasium-python-dependency_scanning:
    before_script:
    - apt-get -qqy update && apt-get install -qqy libpq-dev
    # Basic setup for all Python versions for which we don't have a base image
    .run_unit_test_version_base:
    before_script:
    - python --version # For debugging
    - python -m pip install --upgrade pip
    - python -m pip install --upgrade tox twine
    # Run all unit tests for Python versions except the base image
    run_unit_tests:
    extends: .run_unit_test_version_base
    stage: test
    image: python:3.${PY_VERSION}
    allow_failure: true
    script:
    - tox -e py3${PY_VERSION}
    parallel:
    matrix: # use the matrix for testing
    - PY_VERSION: [10, 11, 12]
    # Run code coverage on the base image thus also performing unit tests
    run_unit_tests_coverage:
    stage: test
    allow_failure: true
    script:
    - tox -e coverage
    coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
    artifacts:
    reports:
    coverage_report:
    coverage_format: cobertura
    path: coverage.xml
    paths:
    - htmlcov/*
    package_files:
    stage: package
    artifacts:
    expire_in: 1w
    paths:
    - dist/*
    script:
    - tox -e build
    run_integration_tests:
    stage: integration
    allow_failure: true
    needs:
    - package_files
    script:
    - echo "make sure to move out of source dir"
    - echo "install package from filesystem (or use the artefact)"
    - echo "run against foreign systems (e.g. databases, cwl etc.)"
    - exit 1
    publish_on_gitlab:
    stage: publish
    environment: gitlab
    needs:
    - package_files
    when: manual
    rules:
    - if: $CI_COMMIT_TAG
    script:
    - echo "run twine for gitlab"
    - |
    TWINE_PASSWORD=${CI_JOB_TOKEN} \
    TWINE_USERNAME=gitlab-ci-token \
    python -m twine upload \
    --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
    release_job:
    stage: publish
    image: registry.gitlab.com/gitlab-org/release-cli:latest
    rules:
    - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"'
    script:
    - echo "running release_job"
    release:
    tag_name: '$CI_COMMIT_TAG'
    description: '$CI_COMMIT_TAG - $CI_COMMIT_TAG_MESSAGE'
    stages:
    - build
    build_ci_runner_image:
    stage: build
    image: docker
    tags:
    - dind
    script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - |
    if docker pull $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG; then
    docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG docker/ci-runner
    else
    docker pull $CI_REGISTRY_IMAGE/ci-build-runner:latest || true
    docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:latest --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG docker/ci-runner
    fi
    - docker push $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG # push the image
    - |
    if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
    docker image tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/ci-build-runner:latest
    docker push $CI_REGISTRY_IMAGE/ci-build-runner:latest
    fi
    This diff is collapsed.
    # LOFAR TMSS Client # LOFAR TMSS Client
    ![Build status](git.astron.nl/ro/lofar_tmss_client/badges/main/pipeline.svg) ![Build status](https://git.astron.nl/ro/lofar_tmss_client/badges/main/pipeline.svg)
    ![Test coverage](git.astron.nl/ro/lofar_tmss_client/badges/main/coverage.svg) ![Test coverage](https://git.astron.nl/ro/lofar_tmss_client/badges/main/coverage.svg)
    <!-- ![Latest release](https://git.astron.nl/templates/python-package/badges/main/release.svg) --> ![Latest release](https://git.astron.nl/templates/python-package/badges/main/release.svg)
    A package for interacting with TMSS (Telescope Manager Specification System). A package for interacting with TMSS (Telescope Manager Specification System).
    This contains the module to connect to TMSS and interact programmatically, as well as CLI utilities. This contains the module to connect to TMSS and interact programmatically, as well as CLI utilities.
    ...@@ -41,4 +41,4 @@ To automatically apply most suggested linting changes execute: ...@@ -41,4 +41,4 @@ To automatically apply most suggested linting changes execute:
    ```tox -e format``` ```tox -e format```
    ## License ## License
    This project is licensed under the Apache License Version 2.0 This project is licensed under GPLv3
    FROM python:3.12 FROM python:3.13
    RUN python -m pip install --upgrade pip RUN python -m pip install --upgrade pip
    RUN pip install --upgrade tox twine RUN pip install --upgrade tox twine
    #!/usr/bin/env python3
    # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
    # SPDX-License-Identifier: Apache-2.0
    import os
    file_dir = os.path.dirname(os.path.realpath(__file__))
    clean_dir = os.path.join(file_dir, "source", "source_documentation")
    print(f"Cleaning.. {clean_dir}/*")
    if not os.path.exists(clean_dir):
    exit()
    for file_name in os.listdir(clean_dir):
    file = os.path.join(clean_dir, file_name)
    if file_name == "index.rst":
    continue
    print(f"Removing.. {file}")
    os.remove(file)
    sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD
    sphinx-rtd-theme>=0.4.3 #MIT
    sphinxcontrib-apidoc>=0.3.0 #BSD
    myst-parser>=2.0 # MIT
    docutils>=0.17 # BSD
    # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
    # SPDX-License-Identifier: Apache-2.0
    import os
    from lofar_tmss_client import __version__
    # -- General configuration ----------------------------------------------------
    # Add any Sphinx extension module names here, as strings. They can be
    # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
    extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.viewcode",
    "sphinxcontrib.apidoc",
    "sphinx_rtd_theme",
    "myst_parser"
    ]
    # Assumes tox is used to call sphinx-build
    project_root_directory = os.getcwd()
    apidoc_module_dir = "../../lofar_tmss_client"
    apidoc_output_dir = "source_documentation"
    apidoc_excluded_paths = []
    apidoc_separate_modules = True
    apidoc_toc_file = False
    # This should include private methods but does not work
    # https://github.com/sphinx-contrib/apidoc/issues/14
    apidoc_extra_args = ["--private"]
    # The suffix of source filenames.
    source_suffix = [".rst"]
    # The master toctree document.
    master_doc = "index"
    # General information about the project.
    project = "LOFAR TMSS Client"
    copyright = "2023, ASTRON"
    # openstackdocstheme options
    repository_name = "git.astron.nl/ro/lofar_tmss_client"
    bug_project = "none"
    bug_tag = ""
    html_last_updated_fmt = "%Y-%m-%d %H:%M"
    # If true, '()' will be appended to :func: etc. cross-reference text.
    add_function_parentheses = True
    version = __version__
    modindex_common_prefix = ["lofar_tmss_client."]
    # If true, the current module name will be prepended to all description
    # unit titles (such as .. function::).
    add_module_names = True
    # The name of the Pygments (syntax highlighting) style to use.
    pygments_style = "sphinx"
    # -- Options for HTML output --------------------------------------------------
    # The theme to use for HTML and HTML Help pages. Major themes that come with
    # Sphinx are currently 'default' and 'sphinxdoc'.
    # html_theme_path = ["."]
    html_theme = "sphinx_rtd_theme"
    html_static_path = ["static"]
    html_css_files = [
    "css/custom.css",
    ]
    # Output file base name for HTML help builder.
    htmlhelp_basename = "%sdoc" % project
    # Conf.py variables exported to sphinx rst files access using |NAME|
    variables_to_export = [
    "project",
    "copyright",
    "version",
    ]
    # Write to rst_epilog to export `variables_to_export` extract using `locals()`
    # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_epilog
    frozen_locals = dict(locals())
    rst_epilog = "\n".join(
    map(
    lambda x: f".. |{x}| replace:: {frozen_locals[x]}", # noqa: F821
    variables_to_export,
    )
    )
    # Pep is not able to determine that frozen_locals always exists so noqa
    del frozen_locals
    ====================================================
    Welcome to the documentation of LOFAR TMSS Client
    ====================================================
    ..
    To define more variables see rst_epilog generation in conf.py
    Documentation for version: |version|
    Contents:
    .. toctree::
    :maxdepth: 2
    readme
    source_documentation/index
    .. include:: ../../README.md
    :parser: myst_parser.sphinx_
    Source code documentation
    =========================
    .. toctree::
    :maxdepth: 3
    lofar_tmss_client
    .orange { color: #c65d09; }
    .green { color: #5dc609; }
    .yellow { color: #c6c609; }
    .bolditalic {
    font-weight: bold;
    font-style: italic;
    }
    .rst-content code, .rst-content tt, code {
    white-space: break-spaces;
    }
    # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy) # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
    # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: GPL-3.0-or-later
    """Testing connecting with client"""
    """Testing of the Cool Module"""
    from unittest import TestCase from unittest import TestCase
    from lofar_tmss_client.tmss_http_rest_client import TMSSsession from lofar_tmss_client.tmss_http_rest_client import TMSSsession
    ......
    # Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy) # Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy)
    # SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: GPL-3.0-or-later
    """ LOFAR TMSS Client """ """ LOFAR TMSS Client """
    try:
    from importlib import metadata
    except ImportError: # for Python<3.8
    import importlib_metadata as metadata
    __version__ = metadata.version("lofar_tmss_client")
    #!/usr/bin/python3
    # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    # Script to set start and stop times of fixed-time-scheduled scheduling units
    from lofar_tmss_client.mains import main_adapt_scheduling_unit_blueprint_to_start_and_stop_times
    if __name__ == "__main__":
    main_adapt_scheduling_unit_blueprint_to_start_and_stop_times()
    #!/usr/bin/python3
    # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    # Script to set start and stop times of fixed-time-scheduled scheduling units
    from lofar_tmss_client.mains import main_adapt_scheduling_unit_draft_to_start_and_stop_times
    if __name__ == "__main__":
    main_adapt_scheduling_unit_draft_to_start_and_stop_times()
    #!/usr/bin/python3
    # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    from lofar_tmss_client.mains import main_cancel_subtask
    if __name__ == "__main__":
    main_cancel_subtask()
    #!/usr/bin/python3
    # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    from lofar_tmss_client.mains import main_create_and_process_feedback_for_subtask_from_specification_and_set_to_finished
    if __name__ == "__main__":
    main_create_and_process_feedback_for_subtask_from_specification_and_set_to_finished()
    #!/usr/bin/python3
    # Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    from lofar_tmss_client.mains import main_create_lofar2_sibling_scheduling_unit
    if __name__ == "__main__":
    main_create_lofar2_sibling_scheduling_unit()
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment