Loading .copier-answers.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line # Please do not edit or delete this file. It is needed to be able to update project from template. _commit: '0.4' _src_path: https://code.ornl.gov/ndip/project-templates/python.git project_name: ctscan-viz publish_docs: false publish_to_pypi: false python_package: ctscan_viz .dockerignore 0 → 100644 +1 −0 Original line number Diff line number Diff line dockerfiles/Dockerfile .gitignore 0 → 100644 +166 −0 Original line number Diff line number Diff line # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # We ingore the whole .idea folder # For more fine tuning, JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. .idea .envrc junit.xml .gitlab-ci.yml 0 → 100644 +118 −0 Original line number Diff line number Diff line stages: - lint - test - tag - publish variables: GIT_STRATEGY: clone IMAGE_NAME: ${NDIP_DOCKER_REPOSITORY}/${CI_PROJECT_PATH} before_script: - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - source rse-bash-modules.sh - func_rse_docker_cleanup - docker login -u $NDIP_DOCKER_USER -p $NDIP_DOCKER_PASSWORD $NDIP_DOCKER_REPOSITORY - export VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"') after_script: - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - source rse-bash-modules.sh - func_rse_docker_cleanup lint-check: stage: lint script: - docker build -f dockerfiles/Dockerfile --target source -t image . - docker run -u `id -u`:`id -g` image poetry run ruff check - docker run -u `id -u`:`id -g` image poetry run ruff format --check - docker run -u `id -u`:`id -g` image poetry run mypy . - docker tag image ${IMAGE_NAME}:src-${CI_COMMIT_SHA} - docker push ${IMAGE_NAME}:src-${CI_COMMIT_SHA} tags: - rse-multi-builder unit-tests: stage: test script: - mkdir reports - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage run - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage report - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage xml -o reports/coverage.xml - sed -i "s:<source>/src:<source>${CI_BUILDS_DIR}/${CI_PROJECT_PATH}:" reports/coverage.xml coverage: '/TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: when: always reports: junit: reports/junit.xml coverage_report: coverage_format: cobertura path: reports/coverage.xml tags: - rse-multi-builder docs-test: stage: test script: - docker run -u `id -u`:`id -g` ${IMAGE_NAME}:src-${CI_COMMIT_SHA} bash build_docs.sh tags: - rse-multi-builder tag-release: stage: tag rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: always - when: never script: - git config user.email "$GITLAB_USER_EMAIL" - git config user.name "$GITLAB_USER_NAME" - > if [ -z $(git ls-remote --tags origin "$VERSION") ]; then git remote add gitlab https://oauth2:${NDIP_GROUP_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git git tag ${VERSION} git push gitlab --tags fi tags: - rse-multi-builder build-image: stage: publish variables: OVERWRITE_IMAGE: "false" when: manual script: - IMAGE_TAG=$(VERSION) - docker pull ${IMAGE_NAME}:src-${CI_COMMIT_SHA} - docker build -f dockerfiles/Dockerfile -t image . - docker tag image ${IMAGE_NAME}:bin-${CI_COMMIT_SHA} - docker push ${IMAGE_NAME}:bin-${CI_COMMIT_SHA} - docker tag image ${IMAGE_NAME}:latest - docker push ${IMAGE_NAME}:latest - > if ! docker pull ${IMAGE_NAME}:${IMAGE_TAG} || [ "$OVERWRITE_IMAGE" == "true" ]; then docker tag image ${IMAGE_NAME}:${IMAGE_TAG} docker push ${IMAGE_NAME}:${IMAGE_TAG} else echo tag ${IMAGE_TAG} already exists in ${NDIP_DOCKER_REPOSITORY}. Use OVERWRITE_IMAGE="true", delete image in the repository or change the tag exit 1 fi tags: - rse-multi-builder package-build: stage: publish script: - > docker run -u `id -u`:`id -g` ${IMAGE_NAME}:src-${CI_COMMIT_SHA} bash -c " poetry config repositories.gitlab_repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi && poetry publish -u gitlab-ci-token -p ${CI_JOB_TOKEN} -r gitlab_repo " when: manual tags: - rse-multi-builder .pre-commit-config.yaml 0 → 100644 +27 −0 Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - id: check-added-large-files args: [--maxkb=8192] - id: check-merge-conflict - id: check-yaml args: [--allow-multiple-documents] - id: end-of-file-fixer - id: check-toml - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: local hooks: - id: mypy name: mypy entry: poetry run mypy src language: system types: [python] verbose: true pass_filenames: false Loading
.copier-answers.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line # Please do not edit or delete this file. It is needed to be able to update project from template. _commit: '0.4' _src_path: https://code.ornl.gov/ndip/project-templates/python.git project_name: ctscan-viz publish_docs: false publish_to_pypi: false python_package: ctscan_viz
.dockerignore 0 → 100644 +1 −0 Original line number Diff line number Diff line dockerfiles/Dockerfile
.gitignore 0 → 100644 +166 −0 Original line number Diff line number Diff line # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # We ingore the whole .idea folder # For more fine tuning, JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. .idea .envrc junit.xml
.gitlab-ci.yml 0 → 100644 +118 −0 Original line number Diff line number Diff line stages: - lint - test - tag - publish variables: GIT_STRATEGY: clone IMAGE_NAME: ${NDIP_DOCKER_REPOSITORY}/${CI_PROJECT_PATH} before_script: - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - source rse-bash-modules.sh - func_rse_docker_cleanup - docker login -u $NDIP_DOCKER_USER -p $NDIP_DOCKER_PASSWORD $NDIP_DOCKER_REPOSITORY - export VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"') after_script: - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O - source rse-bash-modules.sh - func_rse_docker_cleanup lint-check: stage: lint script: - docker build -f dockerfiles/Dockerfile --target source -t image . - docker run -u `id -u`:`id -g` image poetry run ruff check - docker run -u `id -u`:`id -g` image poetry run ruff format --check - docker run -u `id -u`:`id -g` image poetry run mypy . - docker tag image ${IMAGE_NAME}:src-${CI_COMMIT_SHA} - docker push ${IMAGE_NAME}:src-${CI_COMMIT_SHA} tags: - rse-multi-builder unit-tests: stage: test script: - mkdir reports - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage run - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage report - docker run -u `id -u`:`id -g` -v `pwd`/reports:/src/reports ${IMAGE_NAME}:src-${CI_COMMIT_SHA} poetry run coverage xml -o reports/coverage.xml - sed -i "s:<source>/src:<source>${CI_BUILDS_DIR}/${CI_PROJECT_PATH}:" reports/coverage.xml coverage: '/TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: when: always reports: junit: reports/junit.xml coverage_report: coverage_format: cobertura path: reports/coverage.xml tags: - rse-multi-builder docs-test: stage: test script: - docker run -u `id -u`:`id -g` ${IMAGE_NAME}:src-${CI_COMMIT_SHA} bash build_docs.sh tags: - rse-multi-builder tag-release: stage: tag rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: always - when: never script: - git config user.email "$GITLAB_USER_EMAIL" - git config user.name "$GITLAB_USER_NAME" - > if [ -z $(git ls-remote --tags origin "$VERSION") ]; then git remote add gitlab https://oauth2:${NDIP_GROUP_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git git tag ${VERSION} git push gitlab --tags fi tags: - rse-multi-builder build-image: stage: publish variables: OVERWRITE_IMAGE: "false" when: manual script: - IMAGE_TAG=$(VERSION) - docker pull ${IMAGE_NAME}:src-${CI_COMMIT_SHA} - docker build -f dockerfiles/Dockerfile -t image . - docker tag image ${IMAGE_NAME}:bin-${CI_COMMIT_SHA} - docker push ${IMAGE_NAME}:bin-${CI_COMMIT_SHA} - docker tag image ${IMAGE_NAME}:latest - docker push ${IMAGE_NAME}:latest - > if ! docker pull ${IMAGE_NAME}:${IMAGE_TAG} || [ "$OVERWRITE_IMAGE" == "true" ]; then docker tag image ${IMAGE_NAME}:${IMAGE_TAG} docker push ${IMAGE_NAME}:${IMAGE_TAG} else echo tag ${IMAGE_TAG} already exists in ${NDIP_DOCKER_REPOSITORY}. Use OVERWRITE_IMAGE="true", delete image in the repository or change the tag exit 1 fi tags: - rse-multi-builder package-build: stage: publish script: - > docker run -u `id -u`:`id -g` ${IMAGE_NAME}:src-${CI_COMMIT_SHA} bash -c " poetry config repositories.gitlab_repo ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi && poetry publish -u gitlab-ci-token -p ${CI_JOB_TOKEN} -r gitlab_repo " when: manual tags: - rse-multi-builder
.pre-commit-config.yaml 0 → 100644 +27 −0 Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - id: check-added-large-files args: [--maxkb=8192] - id: check-merge-conflict - id: check-yaml args: [--allow-multiple-documents] - id: end-of-file-fixer - id: check-toml - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: local hooks: - id: mypy name: mypy entry: poetry run mypy src language: system types: [python] verbose: true pass_filenames: false