From 18292331b32b394d61b051e97295b1acdfe69593 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 08:46:07 -0500 Subject: [PATCH 01/25] Added config file --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5c552b1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,23 @@ +--- +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml +include: + - project: nci-gdc/gitlab-templates + ref: master + file: + - templates/global/full.yaml + - templates/python/full.yaml + +variables: + BASE_CONTAINER_VERSION: "latest" + +tox: + before_script: + - mkdir -p /usr/share/man/man1 + +.python_versions: + parallel: + matrix: + - REPO_PY_VERSION: [python38] From 574045755537ed18e7bfe44cdbe0a7cb49aeddc0 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:19:53 -0500 Subject: [PATCH 02/25] Removed old files --- .pre-commit-config.yaml | 14 +++++++------- Jenkinsfile | 6 ------ setup.cfg | 25 ------------------------- setup.py | 10 ---------- 4 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 Jenkinsfile delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b6065d..51c23bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,13 @@ default_language_version: python_venv: python3.8 repos: - - repo: git@github.com:Yelp/detect-secrets - rev: v1.0.3 + - repo: https://github.com/Yelp/detect-secrets + rev: v1.2.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v4.2.0 hooks: - id: check-yaml - id: check-toml @@ -17,18 +17,18 @@ repos: - id: detect-aws-credentials args: ["--allow-missing-credentials"] - id: detect-private-key + - id: end-of-file-fixer - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.10.1 hooks: - id: isort name: isort - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: '3.9.2' + rev: '4.0.1' hooks: - id: flake8 additional_dependencies: [flake8-docstrings] - diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 62e0b85..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,6 +0,0 @@ -#!groovy - -library identifier: "jenkins-lib@master" -bioScriptedLibPipeline { - testRunner = 'tox' -} diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fdbe74f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,25 +0,0 @@ -[metadata] -name = bioinf_maflib -description = Maflib -url = https://github.com/NCI-GDC/maf-lib -author = Charles Czysz -author_email = czysz@uchicago.edu -python_requires = >=3.8 -license_files = - LICENSE -long_description = file:README.md -long_description_content_type = text/markdown -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - -[options] -install_requires = - -zip_safe = False -include_package_data = True -packages = find: - -[options.entry_points] -console_scripts = - maflib = maflib.__main__:main diff --git a/setup.py b/setup.py deleted file mode 100644 index f205a47..0000000 --- a/setup.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - -setup( - use_scm_version=True, - setup_requires=['setuptools_scm'], -) - -# __END__ From bb6ed4a104b52bfbb2490efaaf03cbbbfd41e8ee Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:20:19 -0500 Subject: [PATCH 03/25] Ignore gitlab file --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 4bf6500..9ec9301 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,6 @@ ENV/ # VSCode .vscode/ test-reports/ + +# Gitlab +vars.env From 594a4c7b5d7d7b27cf1fd083d97714d0d7e563f5 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:20:33 -0500 Subject: [PATCH 04/25] Update pyproject --- pyproject.toml | 51 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 34deae0..d3a7f83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,53 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] -build-backend = "setuptools.build_meta" +requires = ["flit_scm"] +build-backend = "flit_scm:buildapi" + +[project] +name = "maflib" +description = "MAF library" +authors = [ + {name = "Charles Czysz", email = "czysz@uchicago.edu"} +] +dependencies = [] + +readme = "README.md" +requires-python = ">=3.8" +license = {file = "LICENSE"} +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only" +] +dynamic = ["version"] + +[project.urls] +homepage = "https://github.com/NCI-GDC/maf-lib" + +[project.scripts] +maflib = "maflib.__main__:main" [tool.setuptools_scm] -local_scheme = "dirty-tag" -version_scheme = "release-branch-semver" write_to = "maflib/_version.py" +local_scheme = "dirty-tag" +version_scheme = "python-simplified-semver" fallback_version = "0" +[tool.coverage.run] +source = ["maflib"] +branch = true +parallel = true + +[tool.flit.sdist] +include = ["maflib/_version.py"] +exclude = [ + ".*", + "dev-requirements.*", + "Dockerfile", + "Jenkinsfile", + "*travis.yml", + "tox.ini", +] + [tool.black] line-length = 88 skip-string-normalization = true @@ -25,3 +65,6 @@ python_version = 3.8 disallow_untyped_defs = true warn_return_any = true warn_unused_configs = true + +[tool.coverage.report] +show_missing = true From f1180695241c8a2cb604847c0ad73cc6fe2758e6 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:20:48 -0500 Subject: [PATCH 05/25] Add new Makefile target for venv --- Makefile | 71 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index ab166aa..b31f473 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,22 @@ REPO = maf-lib + MODULE = maflib -GIT_SHORT_HASH:=$(shell git rev-parse --short HEAD) -GIT_COMMIT_HASH:=$(shell git rev-parse HEAD) -GIT_DESCRIBE:=$(shell git describe --tags) +# Redirect error when run in container +COMMIT_HASH:=$(shell git rev-parse HEAD 2>/dev/null) +GIT_DESCRIBE:=$(shell git describe --tags 2>/dev/null) DOCKER_REPO := quay.io/ncigdc -DOCKER_IMAGE_COMMIT := ${DOCKER_REPO}/${REPO}:${GIT_COMMIT_HASH} -DOCKER_IMAGE_LATEST := ${DOCKER_REPO}/${REPO}:latest +DOCKER_IMAGE_COMMIT := ${DOCKER_REPO}/${REPO}:${COMMIT_HASH} DOCKER_IMAGE_DESCRIBE := ${DOCKER_REPO}/${REPO}:${GIT_DESCRIBE} - -TWINE_REPOSITORY_URL?="" +DOCKER_IMAGE_LATEST := ${DOCKER_REPO}/${REPO}:latest .PHONY: version version-* version: @python setup.py --version version-docker: - @echo ${DOCKER_IMAGE_COMMIT} + @echo ${DOCKER_IMAGE_DESCRIBE} version-docker-tag: @echo @@ -26,15 +25,19 @@ version-docker-tag: docker-login: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io +.PHONY: venv +venv: + @echo + rm -rf .venv/ + tox -r -e dev --devenv .venv .PHONY: init init-* init: init-pip init-hooks - init-pip: @echo @echo -- Installing pip packages -- pip-sync requirements.txt dev-requirements.txt - python setup.py develop + python -m pip install -e . init-hooks: @echo @@ -47,69 +50,75 @@ init-venv: .PHONY: clean clean-* clean: clean-dirs - clean-dirs: rm -rf ./build/ rm -rf ./dist/ rm -rf ./*.egg-info/ - rm -rf ./.tox/ - rm -rf ./htmlcov + rm -rf ./test-reports/ + rm -rf ./htmlcov/ clean-docker: - @docker rmi -f ${DOCKER_IMAGE_COMMIT} + @echo + .PHONY: requirements requirements-* requirements: init-venv requirements-prod requirements-dev +requirements-dev: + pip-compile -o dev-requirements.txt dev-requirements.in requirements-prod: pip-compile -o requirements.txt -requirements-dev: - pip-compile -o dev-requirements.txt dev-requirements.in - .PHONY: build build-* build: build-docker build-docker: clean + @echo @echo -- Building docker -- - docker build . -f Dockerfile \ + docker build . \ + --file ./Dockerfile \ --build-arg http_proxy=${PROXY} \ --build-arg https_proxy=${PROXY} \ -t "${DOCKER_IMAGE_COMMIT}" \ -t "${DOCKER_IMAGE_LATEST}" build-pypi: clean - @tox -e check_dist + @echo + tox -e check_dist + +.PHONY: run run-* +run: + @echo + +run-docker: + @echo + docker run --rm "${DOCKER_IMAGE_COMMIT}" .PHONY: lint test test-* tox test: tox +lint: + @echo + @echo -- Lint -- + tox -p -e flake8 test-unit: - @echo - @echo -- Unit Test -- - tox -e py36 + pytest tests/ test-docker: @echo tox: - @echo Running tox - tox -p all - -lint: @echo - @echo -- Lint -- - tox -p -e flake8 + TOX_PARALLEL_NO_SPINNER=1 tox -p --recreate .PHONY: publish-* publish-docker: - docker tag ${DOCKER_IMAGE_LATEST} ${DOCKER_IMAGE_DESCRIBE} + docker tag ${DOCKER_IMAGE_COMMIT} ${DOCKER_IMAGE_DESCRIBE} docker push ${DOCKER_IMAGE_COMMIT} docker push ${DOCKER_IMAGE_DESCRIBE} publish-pypi: @echo - @echo Publishing dists - @python3 -m pip install --user --upgrade twine + @echo Publishing wheel python3 -m twine upload dist/* From e97fca60642afa33fb1935571bb32ddfae218a3d Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:21:12 -0500 Subject: [PATCH 06/25] Update tox --- tox.ini | 139 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 41 deletions(-) diff --git a/tox.ini b/tox.ini index 8cd249b..1782a7f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,58 +1,115 @@ [tox] -envlist = py38,flake8,check_dist,type -isolated_build = True - -[flake8] -ignore = C901,D100,D104,E501,E302,E502,E126,E731,F841,W503,W605 -extend_ignore = D tests/ -exclude = - .tox, - .git, - .direnv, - __pycache__, - build, - dist, - *.pyc, - *.egg-info, - .eggs -docstring-convention=google +envlist = py3,help,version,flake8,type,cov +isolated_build = true [testenv] +# update me +setenv = + package = maflib + PYTHONHASHSEED = 0 +passenv = PIP_EXTRA_INDEX_URL +skip_install = + false +install_command = python -m pip install {opts} {packages} +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = pytest \ + --cov={env:package} \ + --cov-append \ + --cov-report=xml \ + --junit-xml=test-reports/results.xml + {posargs} + +[testenv:dev] +basepython = python3.8 + +[testenv:requirements] +deps = pip-tools +skip_install = + true +commands = + pip-compile -o dev-requirements.txt dev-requirements.in + +[testenv:help] +skip_install = + false deps = -rdev-requirements.txt -rrequirements.txt commands = - pytest -lvv \ - --cov-report=term-missing \ - --cov-report=html \ - --junitxml=test-reports/results.xml \ - --cov=maflib \ - tests/ + python -m {env:package} --help + +[testenv:cov] +skip_install=True +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = + coverage run -m pytest tests/ + coverage combine + coverage report -m + coverage xml [testenv:flake8] -skip_install = true +skip_install=True +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = + flake8 {env:package}/ tests/ + +[testenv:type] +skip_install = false deps= - flake8 + -rrequirements.txt + -rdev-requirements.txt commands = - flake8 maflib/ tests/ setup.py + python -m mypy {env:package}/ + +[testenv:build] +skip_install=True +install_command = python -m pip install {opts} {packages} +deps= + flit +commands = + python -m flit build -[testenv:check_dist] -skip_install = true +[testenv:publish] +skip_install=True +passenv = + TWINE_USERNAME + TWINE_PASSWORD + TWINE_REPOSITORY_URL +install_command = python -m pip install {opts} {packages} deps= - setuptools_scm - wheel + flit + flit-scm twine -whitelist_externals = rm commands = - python setup.py -q clean --all - python setup.py -q egg_info - python setup.py -q sdist --formats gztar bdist_wheel - twine check dist/* + python -m flit build + twine check dist/* + twine upload dist/* -[testenv:type] -skip_install = true -deps= - mypy -commands = - python -m mypy maflib/ +[testenv:version] +skip_install=True +install_command = python -m pip install {opts} {packages} +allowlist_externals = + git +commands = + git describe --tags +[flake8] +ignore = C901,D100,D104,E501,E302,E502,E126,E731,F841,W503,W605 +extend_ignore = D tests/ +exclude = + .tox, + .git, + .direnv, + __pycache__, + build, + dist, + *.pyc, + *.egg-info, + .eggs +docstring-convention=google From 1ebff78446e2d6ed80727cdee54cb6758c9756b1 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 09:21:21 -0500 Subject: [PATCH 07/25] Update Dockerfile --- Dockerfile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10e3ecd..6db3c88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,23 +4,18 @@ COPY ./ /opt WORKDIR /opt -RUN python -m pip install tox && tox - -# tox step builds sdist +RUN pip install tox && tox -e build FROM quay.io/ncigdc/python38 COPY --from=builder /opt/dist/*.tar.gz /opt -COPY ./requirements.txt /opt/requirements.txt - -ENV BINARY=maflib +COPY requirements.txt /opt WORKDIR /opt -# Install package from sdist -RUN pip install -r requirements.txt \ - && pip install *.tar.gz \ - && rm -rf *.tar.gz requirements.txt +RUN pip install --no-deps -r requirements.txt \ + && pip install --no-deps *.tar.gz \ + && rm -f *.tar.gz requirements.txt ENTRYPOINT ["maflib"] From d1fdd9b6e73e5272a859e54814dc2a0b3fd8f086 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 10:01:04 -0500 Subject: [PATCH 08/25] Linting --- maflib/column_types.py | 2 +- maflib/record.py | 2 +- maflib/validation.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maflib/column_types.py b/maflib/column_types.py index 4e0dc3e..46cc66f 100644 --- a/maflib/column_types.py +++ b/maflib/column_types.py @@ -101,7 +101,7 @@ def __validate__(self) -> Optional[str]: class StringColumn(NullableStringColumn): - """ A column where the value must be a non-empty string""" + """A column where the value must be a non-empty string""" EmptyStringMessage = "Empty string is not allowed" diff --git a/maflib/record.py b/maflib/record.py index 72f2a32..65c8a99 100644 --- a/maflib/record.py +++ b/maflib/record.py @@ -256,7 +256,7 @@ def value(self, key: TKey) -> Any: return None def column_values(self) -> List[Optional[Any]]: - """Gets the values for all columns in order. """ + """Gets the values for all columns in order.""" return [ (column.value if column is not None else None) for column in self.values() ] diff --git a/maflib/validation.py b/maflib/validation.py index fee18b1..6ce0691 100644 --- a/maflib/validation.py +++ b/maflib/validation.py @@ -82,7 +82,7 @@ def __str__(self) -> str: class MafValidationError: - """Stores a specific validation error and type """ + """Stores a specific validation error and type""" __IgnoringMessageFormat = "Ignoring MAF validation error: %s" From 740d049935099bb4eb3e00df712294f4105013a3 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 10:39:34 -0500 Subject: [PATCH 09/25] Test git settings --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c552b1..aaefc7c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ include: variables: BASE_CONTAINER_VERSION: "latest" + GIT_DEPTH: 10 + GIT_FETCH_EXTRA_FLAGS: --tags + GIT_STRATEGY: fetch tox: before_script: From 9dbebb5e1b05dbc15475f79b97f88eb1fe634978 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 10:46:08 -0500 Subject: [PATCH 10/25] Test fetch all --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aaefc7c..c4b45ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ include: variables: BASE_CONTAINER_VERSION: "latest" - GIT_DEPTH: 10 + GIT_DEPTH: 0 GIT_FETCH_EXTRA_FLAGS: --tags GIT_STRATEGY: fetch From c5d0faea28fcf369d63b65e7b7bcbfaddcc5e231 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 10:53:20 -0500 Subject: [PATCH 11/25] Git clone strategy --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4b45ef..e4b808d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,9 +12,9 @@ include: variables: BASE_CONTAINER_VERSION: "latest" - GIT_DEPTH: 0 + GIT_DEPTH: "0" GIT_FETCH_EXTRA_FLAGS: --tags - GIT_STRATEGY: fetch + GIT_STRATEGY: clone tox: before_script: From 98ccf696a177381707742a6bbfb29d1d6266bbba Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Thu, 12 May 2022 11:13:41 -0500 Subject: [PATCH 12/25] Remove override variables --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4b808d..5c552b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,9 +12,6 @@ include: variables: BASE_CONTAINER_VERSION: "latest" - GIT_DEPTH: "0" - GIT_FETCH_EXTRA_FLAGS: --tags - GIT_STRATEGY: clone tox: before_script: From 06ec88a25472d302e33f20e2df0f285145d36ea6 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Fri, 13 May 2022 09:55:32 -0500 Subject: [PATCH 13/25] Package name different from module name, update build --- pyproject.toml | 6 +++++- tox.ini | 23 ++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d3a7f83..8592a0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["flit_scm"] build-backend = "flit_scm:buildapi" [project] -name = "maflib" +name = "bioinf_maflib" description = "MAF library" authors = [ {name = "Charles Czysz", email = "czysz@uchicago.edu"} @@ -37,6 +37,10 @@ source = ["maflib"] branch = true parallel = true +[tool.flit.module] +# Required because project name is different +name = "maflib" + [tool.flit.sdist] include = ["maflib/_version.py"] exclude = [ diff --git a/tox.ini b/tox.ini index 1782a7f..2db71a3 100644 --- a/tox.ini +++ b/tox.ini @@ -68,34 +68,39 @@ commands = python -m mypy {env:package}/ [testenv:build] -skip_install=True +skip_install= true +isolated_build = false install_command = python -m pip install {opts} {packages} deps= flit + setuptools_scm commands = + python -m setuptools_scm python -m flit build [testenv:publish] -skip_install=True +isolated_build=False +skip_install=true passenv = - TWINE_USERNAME - TWINE_PASSWORD - TWINE_REPOSITORY_URL + TWINE_USERNAME + TWINE_PASSWORD + TWINE_REPOSITORY_URL install_command = python -m pip install {opts} {packages} deps= + setuptools_scm flit - flit-scm - twine + twine commands = + python -m setuptools_scm python -m flit build twine check dist/* twine upload dist/* [testenv:version] skip_install=True -install_command = python -m pip install {opts} {packages} -allowlist_externals = +allowlist_externals = git +deps = commands = git describe --tags From 33b2ed44c371ae0f3cb21cae3e0ab196c3d3e2a4 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:36:49 +0000 Subject: [PATCH 14/25] Updated gitignore, precommit --- .gitignore | 3 +++ .pre-commit-config.yaml | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 4bf6500..f6ed5e6 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,6 @@ ENV/ # VSCode .vscode/ test-reports/ + +# Gitlab CI +vars.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b6065d..51c23bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,13 @@ default_language_version: python_venv: python3.8 repos: - - repo: git@github.com:Yelp/detect-secrets - rev: v1.0.3 + - repo: https://github.com/Yelp/detect-secrets + rev: v1.2.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v4.2.0 hooks: - id: check-yaml - id: check-toml @@ -17,18 +17,18 @@ repos: - id: detect-aws-credentials args: ["--allow-missing-credentials"] - id: detect-private-key + - id: end-of-file-fixer - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.10.1 hooks: - id: isort name: isort - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: '3.9.2' + rev: '4.0.1' hooks: - id: flake8 additional_dependencies: [flake8-docstrings] - From 43d2eba324e05d765a513f12c325b79a417826e4 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:37:14 +0000 Subject: [PATCH 15/25] Updated for gitlab --- Dockerfile | 28 +++++----- Makefile | 85 ++++++++++++++++++------------ pyproject.toml | 56 ++++++++++++++++++-- tox.ini | 140 +++++++++++++++++++++++++++++++++++-------------- 4 files changed, 216 insertions(+), 93 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10e3ecd..cd1cd02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,24 @@ -FROM quay.io/ncigdc/python38-builder as builder +ARG REGISTRY=quay.io +ARG BASE_CONTAINER_VERSION=2.0.1 -COPY ./ /opt +FROM ${REGISTRY}/ncigdc/python3.8-builder:${BASE_CONTAINER_VERSION} as builder -WORKDIR /opt +COPY ./ /opt/build -RUN python -m pip install tox && tox +WORKDIR /opt/build -# tox step builds sdist +RUN pip install tox && git status && tox -e build -FROM quay.io/ncigdc/python38 +FROM ${REGISTRY}/ncigdc/python3.8:${BASE_CONTAINER_VERSION} -COPY --from=builder /opt/dist/*.tar.gz /opt -COPY ./requirements.txt /opt/requirements.txt +COPY --from=builder /opt/build/dist/*.tar.gz /opt/build/ +COPY requirements.txt /opt/build/ -ENV BINARY=maflib +WORKDIR /opt/build -WORKDIR /opt - -# Install package from sdist -RUN pip install -r requirements.txt \ - && pip install *.tar.gz \ - && rm -rf *.tar.gz requirements.txt +RUN pip install --no-deps -r requirements.txt \ + && pip install --no-deps *.tar.gz \ + && rm -f *.tar.gz requirements.txt ENTRYPOINT ["maflib"] diff --git a/Makefile b/Makefile index ab166aa..661c86d 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,29 @@ REPO = maf-lib + MODULE = maflib -GIT_SHORT_HASH:=$(shell git rev-parse --short HEAD) -GIT_COMMIT_HASH:=$(shell git rev-parse HEAD) -GIT_DESCRIBE:=$(shell git describe --tags) +# Redirect error when run in container +COMMIT_HASH:=$(shell git rev-parse HEAD 2>/dev/null) +GIT_DESCRIBE:=$(shell git describe --tags 2>/dev/null) DOCKER_REPO := quay.io/ncigdc -DOCKER_IMAGE_COMMIT := ${DOCKER_REPO}/${REPO}:${GIT_COMMIT_HASH} -DOCKER_IMAGE_LATEST := ${DOCKER_REPO}/${REPO}:latest +DOCKER_IMAGE_COMMIT := ${DOCKER_REPO}/${REPO}:${COMMIT_HASH} DOCKER_IMAGE_DESCRIBE := ${DOCKER_REPO}/${REPO}:${GIT_DESCRIBE} +DOCKER_IMAGE_LATEST := ${DOCKER_REPO}/${REPO}:latest + +# Env args +PIP_EXTRA_INDEX_URL ?= +http_proxy ?= +https_proxy ?= +REGISTRY ?= quay.io -TWINE_REPOSITORY_URL?="" .PHONY: version version-* version: @python setup.py --version version-docker: - @echo ${DOCKER_IMAGE_COMMIT} + @echo ${DOCKER_IMAGE_DESCRIBE} version-docker-tag: @echo @@ -26,15 +32,19 @@ version-docker-tag: docker-login: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io +.PHONY: venv +venv: + @echo + rm -rf .venv/ + tox -r -e dev --devenv .venv .PHONY: init init-* init: init-pip init-hooks - init-pip: @echo @echo -- Installing pip packages -- pip-sync requirements.txt dev-requirements.txt - python setup.py develop + python -m pip install -e . init-hooks: @echo @@ -47,69 +57,76 @@ init-venv: .PHONY: clean clean-* clean: clean-dirs - clean-dirs: rm -rf ./build/ rm -rf ./dist/ rm -rf ./*.egg-info/ - rm -rf ./.tox/ - rm -rf ./htmlcov + rm -rf ./test-reports/ + rm -rf ./htmlcov/ clean-docker: - @docker rmi -f ${DOCKER_IMAGE_COMMIT} + @echo + .PHONY: requirements requirements-* requirements: init-venv requirements-prod requirements-dev - -requirements-prod: - pip-compile -o requirements.txt - requirements-dev: pip-compile -o dev-requirements.txt dev-requirements.in +requirements-prod: + pip-compile -o requirements.txt pyproject.toml + .PHONY: build build-* build: build-docker build-docker: clean + @echo @echo -- Building docker -- - docker build . -f Dockerfile \ - --build-arg http_proxy=${PROXY} \ - --build-arg https_proxy=${PROXY} \ + docker build . \ + --file ./Dockerfile \ + --build-arg http_proxy \ + --build-arg https_proxy \ + --build-arg REGISTRY \ -t "${DOCKER_IMAGE_COMMIT}" \ - -t "${DOCKER_IMAGE_LATEST}" + -t "${DOCKER_IMAGE_DESCRIBE}" \ + -t "${REPO}" build-pypi: clean - @tox -e check_dist + @echo + tox -e check_dist + +.PHONY: run run-* +run: + @echo + +run-docker: + @echo + docker run --rm "${DOCKER_IMAGE_COMMIT}" .PHONY: lint test test-* tox test: tox +lint: + @echo + @echo -- Lint -- + tox -p -e flake8 test-unit: - @echo - @echo -- Unit Test -- - tox -e py36 + pytest tests/ test-docker: @echo tox: - @echo Running tox - tox -p all - -lint: @echo - @echo -- Lint -- - tox -p -e flake8 + TOX_PARALLEL_NO_SPINNER=1 tox -p --recreate .PHONY: publish-* publish-docker: - docker tag ${DOCKER_IMAGE_LATEST} ${DOCKER_IMAGE_DESCRIBE} docker push ${DOCKER_IMAGE_COMMIT} docker push ${DOCKER_IMAGE_DESCRIBE} publish-pypi: @echo - @echo Publishing dists - @python3 -m pip install --user --upgrade twine + @echo Publishing wheel python3 -m twine upload dist/* diff --git a/pyproject.toml b/pyproject.toml index 34deae0..6609d61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,58 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] -build-backend = "setuptools.build_meta" +requires = ["flit_scm"] +build-backend = "flit_scm:buildapi" + +[project] +name = "bioinf-maflib" +description = "Library for creating and reading MAF files" +authors = [ + {name = "Charles Czysz", email = "czysz@uchicago.edu"} +] + +readme = "README.md" +requires-python = ">=3.8" +license = {file = "LICENSE"} +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only" +] +dynamic = ["version"] +dependencies = [ + "click" +] + +[project.urls] +homepage = "https://github.com/NCI-GDC/maf-lib" + +[project.scripts] +maflib = "maflib.__main__:main" [tool.setuptools_scm] -local_scheme = "dirty-tag" -version_scheme = "release-branch-semver" write_to = "maflib/_version.py" +local_scheme = "dirty-tag" +version_scheme = "python-simplified-semver" fallback_version = "0" +[tool.coverage.run] +source = ["maflib"] +branch = true +parallel = true + +[tool.flit.module] +name = "maflib" + +[tool.flit.sdist] +include = ["maflib/_version.py"] +exclude = [ + ".*", + "dev-requirements.*", + "Dockerfile", + "Jenkinsfile", + "*travis.yml", + "tox.ini", +] + [tool.black] line-length = 88 skip-string-normalization = true @@ -25,3 +70,6 @@ python_version = 3.8 disallow_untyped_defs = true warn_return_any = true warn_unused_configs = true + +[tool.coverage.report] +show_missing = true diff --git a/tox.ini b/tox.ini index 8cd249b..6447fbf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,58 +1,118 @@ [tox] -envlist = py38,flake8,check_dist,type -isolated_build = True +envlist = py3,help,version,flake8,type,cov +isolated_build = true -[flake8] -ignore = C901,D100,D104,E501,E302,E502,E126,E731,F841,W503,W605 -extend_ignore = D tests/ -exclude = - .tox, - .git, - .direnv, - __pycache__, - build, - dist, - *.pyc, - *.egg-info, - .eggs -docstring-convention=google +[tox:.package] +basepython = python3 [testenv] +setenv = + package = maflib + PYTHONHASHSEED = 0 +passenv = PIP_EXTRA_INDEX_URL +skip_install = + false +install_command = python -m pip install {opts} {packages} +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = pytest -vv {posargs} + +[testenv:dev] +basepython = python3.8 + +[testenv:requirements] +deps = pip-tools +skip_install = + true +commands = + pip-compile -o dev-requirements.txt dev-requirements.in + +[testenv:help] +skip_install = + false deps = -rdev-requirements.txt -rrequirements.txt commands = - pytest -lvv \ - --cov-report=term-missing \ - --cov-report=html \ - --junitxml=test-reports/results.xml \ - --cov=maflib \ - tests/ + python -m {env:package} --help + +[testenv:cov] +skip_install=True +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = + coverage run -m pytest tests/ + coverage combine + coverage report -m + coverage xml + coverage xml -o test-reports/results.xml [testenv:flake8] -skip_install = true +skip_install=True +deps = + -rdev-requirements.txt + -rrequirements.txt +commands = + flake8 {env:package}/ tests/ + +[testenv:type] +skip_install = false deps= - flake8 + -rrequirements.txt + -rdev-requirements.txt commands = - flake8 maflib/ tests/ setup.py + python -m mypy {env:package}/ + +[testenv:build] +skip_install= true +isolated_build = false +install_command = python -m pip install {opts} {packages} +deps= + flit + setuptools_scm +commands = + python -m setuptools_scm + python -m flit build -[testenv:check_dist] -skip_install = true +[testenv:publish] +isolated_build=False +skip_install=true +passenv = + TWINE_USERNAME + TWINE_PASSWORD + TWINE_REPOSITORY_URL +install_command = python -m pip install {opts} {packages} deps= - setuptools_scm - wheel + setuptools_scm + flit twine -whitelist_externals = rm commands = - python setup.py -q clean --all - python setup.py -q egg_info - python setup.py -q sdist --formats gztar bdist_wheel - twine check dist/* + python -m setuptools_scm + python -m flit build + twine check dist/* + twine upload dist/* -[testenv:type] -skip_install = true -deps= - mypy -commands = - python -m mypy maflib/ +[testenv:version] +skip_install=True +allowlist_externals = + git +deps = +commands = + git describe --tags +[flake8] +ignore = C901,D100,D104,E501,E302,E502,E126,E731,F841,W503,W605 +extend_ignore = D tests/ +exclude = + .tox, + .git, + .direnv, + __pycache__, + build, + dist, + *.pyc, + *.egg-info, + .eggs +docstring-convention=google From c8d7c58bf72183d7ee91e94fcceec7547a55e99f Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:37:26 +0000 Subject: [PATCH 16/25] Requirements updated --- dev-requirements.in | 2 +- dev-requirements.txt | 4 +++- requirements.txt | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dev-requirements.in b/dev-requirements.in index f30c805..25efff2 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1,5 +1,5 @@ -c requirements.txt -detect-secrets==1.0.3 +detect-secrets==1.2.0 isort flake8 flake8-docstrings diff --git a/dev-requirements.txt b/dev-requirements.txt index 7376909..32e950c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,6 +4,8 @@ # # pip-compile --output-file=dev-requirements.txt dev-requirements.in # +--extra-index-url https://nexus.osdc.io/repository/pypi-all/simple + appdirs==1.4.4 # via virtualenv attrs==20.2.0 @@ -16,7 +18,7 @@ chardet==4.0.0 # via requests coverage==5.3 # via pytest-cov -detect-secrets==1.0.3 +detect-secrets==1.2.0 # via -r dev-requirements.in distlib==0.3.1 # via virtualenv diff --git a/requirements.txt b/requirements.txt index 271db3b..20b7a7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,9 @@ # This file is autogenerated by pip-compile with python 3.8 # To update, run: # -# pip-compile --output-file=requirements.txt +# pip-compile --output-file=requirements.txt pyproject.toml # +--extra-index-url https://nexus.osdc.io/repository/pypi-all/simple + +click==8.1.3 + # via bioinf-maflib (pyproject.toml) From 5748c87dd7f45c7452f61913db363dc3f6c5f3eb Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:39:28 +0000 Subject: [PATCH 17/25] Removed dep --- pyproject.toml | 4 +--- requirements.txt | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6609d61..8886152 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,9 +18,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only" ] dynamic = ["version"] -dependencies = [ - "click" -] +dependencies = [] [project.urls] homepage = "https://github.com/NCI-GDC/maf-lib" diff --git a/requirements.txt b/requirements.txt index 20b7a7f..3736d0b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,3 @@ # pip-compile --output-file=requirements.txt pyproject.toml # --extra-index-url https://nexus.osdc.io/repository/pypi-all/simple - -click==8.1.3 - # via bioinf-maflib (pyproject.toml) From b71c38aa1e44dd485695eba6651fcbfde9ef0e39 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:39:43 +0000 Subject: [PATCH 18/25] Gitlab config --- .gitlab-ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..72f523a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,48 @@ +--- +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml +include: + - project: nci-gdc/gitlab-templates + ref: master + file: + - templates/global/full.yaml + - templates/python/full.yaml + +variables: + BASE_CONTAINER_VERSION: "2.0.1" + DOCKER_BUILDKIT: 1 + PIP_EXTRA_INDEX_URL: https://nexus.osdc.io/repository/pypi-all/simple + DOCKER_BUILD_OPTS: "--build-arg PIP_EXTRA_INDEX_URL=https://nexus.osdc.io/repository/pypi-all/simple" + +tox: + before_script: + - mkdir -p /usr/share/man/man1 + +.python_versions: + parallel: + matrix: + - REPO_PY_VERSION: [python3.8] + +docker_build: + rules: + - when: always + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: never + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + variables: + RELEASE_REGISTRY: containers.osdc.io/ncigdc # Override globally-defined RELEASE_REGISTRY + - if: $CI_COMMIT_REF_NAME =~ /main/ + variables: + RELEASE_REGISTRY: containers.osdc.io/ncigdc + script: + - echo "docker build ${DOCKER_BUILD_OPTS} -t ${RELEASE_REGISTRY}/$CI_PROJECT_NAME:$VERSION ." + - echo "docker push ${DOCKER_PUSH_OPTS} ${RELEASE_REGISTRY}/$CI_PROJECT_NAME:$VERSION" + - docker build . + --file ./Dockerfile + --build-arg http_proxy + --build-arg https_proxy + --build-arg BASE_CONTAINER_VERSION + -t ${RELEASE_REGISTRY}/${CI_PROJECT_NAME}:${VERSION} + - docker push ${DOCKER_PUSH_OPTS} ${RELEASE_REGISTRY}/${CI_PROJECT_NAME}:${VERSION} From 045ec0a9d0b1c15a06f4c88406f064375479fa69 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:40:07 +0000 Subject: [PATCH 19/25] Precommit fixes --- maflib/column_types.py | 2 +- maflib/record.py | 2 +- maflib/validation.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maflib/column_types.py b/maflib/column_types.py index 4e0dc3e..46cc66f 100644 --- a/maflib/column_types.py +++ b/maflib/column_types.py @@ -101,7 +101,7 @@ def __validate__(self) -> Optional[str]: class StringColumn(NullableStringColumn): - """ A column where the value must be a non-empty string""" + """A column where the value must be a non-empty string""" EmptyStringMessage = "Empty string is not allowed" diff --git a/maflib/record.py b/maflib/record.py index 72f2a32..65c8a99 100644 --- a/maflib/record.py +++ b/maflib/record.py @@ -256,7 +256,7 @@ def value(self, key: TKey) -> Any: return None def column_values(self) -> List[Optional[Any]]: - """Gets the values for all columns in order. """ + """Gets the values for all columns in order.""" return [ (column.value if column is not None else None) for column in self.values() ] diff --git a/maflib/validation.py b/maflib/validation.py index fee18b1..6ce0691 100644 --- a/maflib/validation.py +++ b/maflib/validation.py @@ -82,7 +82,7 @@ def __str__(self) -> str: class MafValidationError: - """Stores a specific validation error and type """ + """Stores a specific validation error and type""" __IgnoringMessageFormat = "Ignoring MAF validation error: %s" From b3856ef745d34eaed5536b4493d60b227a433f80 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 13:56:17 +0000 Subject: [PATCH 20/25] Gitlab fixes --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 154cf3d..f5197ad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,9 +16,13 @@ variables: DOCKER_BUILD_OPTS: "--build-arg PIP_EXTRA_INDEX_URL=https://nexus.osdc.io/repository/pypi-all/simple" tox: + image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} before_script: - mkdir -p /usr/share/man/man1 +release: + image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} + .python_versions: parallel: matrix: @@ -40,6 +44,7 @@ docker_build: - echo "docker push ${DOCKER_PUSH_OPTS} ${RELEASE_REGISTRY}/$CI_PROJECT_NAME:$VERSION" - docker build . --file ./Dockerfile + ${DOCKER_BUILD_OPTS} --build-arg http_proxy --build-arg https_proxy --build-arg BASE_CONTAINER_VERSION From 47c1408903404d4bf492718b80f0de7ac0aac4b6 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 14:09:27 +0000 Subject: [PATCH 21/25] Removed Manifest --- MANIFEST.in | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 80ac224..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -# setuptools_scm includes most files -exclude .pre-commit-config.yaml -exclude .secrets.baseline -exclude .gitignore From aa44c799c22dfe46f20a9f870ca4c35dca8f0536 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 14:22:54 +0000 Subject: [PATCH 22/25] Revert building in /opt/build --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index cd1cd02..e7bfe28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,18 +3,18 @@ ARG BASE_CONTAINER_VERSION=2.0.1 FROM ${REGISTRY}/ncigdc/python3.8-builder:${BASE_CONTAINER_VERSION} as builder -COPY ./ /opt/build +COPY ./ /opt -WORKDIR /opt/build +WORKDIR /opt -RUN pip install tox && git status && tox -e build +RUN pip install tox tox -e build FROM ${REGISTRY}/ncigdc/python3.8:${BASE_CONTAINER_VERSION} -COPY --from=builder /opt/build/dist/*.tar.gz /opt/build/ -COPY requirements.txt /opt/build/ +COPY --from=builder /opt/build/dist/*.tar.gz /opt +COPY requirements.txt /opt -WORKDIR /opt/build +WORKDIR /opt RUN pip install --no-deps -r requirements.txt \ && pip install --no-deps *.tar.gz \ From ce252dafa5b730fae5b857c29b95dcb679577cbe Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 14:25:17 +0000 Subject: [PATCH 23/25] Clean up make targets --- Makefile | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 661c86d..017fae8 100644 --- a/Makefile +++ b/Makefile @@ -20,14 +20,11 @@ REGISTRY ?= quay.io .PHONY: version version-* version: - @python setup.py --version + @tox -e version version-docker: @echo ${DOCKER_IMAGE_DESCRIBE} -version-docker-tag: - @echo - .PHONY: docker-login docker-login: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io @@ -40,7 +37,7 @@ venv: .PHONY: init init-* init: init-pip init-hooks -init-pip: +init-pip: init-venv @echo @echo -- Installing pip packages -- pip-sync requirements.txt dev-requirements.txt @@ -63,10 +60,8 @@ clean-dirs: rm -rf ./*.egg-info/ rm -rf ./test-reports/ rm -rf ./htmlcov/ - -clean-docker: - @echo - + rm -rf coverage.xml + rm -rf .coverage .PHONY: requirements requirements-* requirements: init-venv requirements-prod requirements-dev @@ -94,15 +89,7 @@ build-docker: clean build-pypi: clean @echo - tox -e check_dist - -.PHONY: run run-* -run: - @echo - -run-docker: - @echo - docker run --rm "${DOCKER_IMAGE_COMMIT}" + tox -e build .PHONY: lint test test-* tox test: tox @@ -112,7 +99,7 @@ lint: tox -p -e flake8 test-unit: - pytest tests/ + tox -e py3 test-docker: @echo From d2a16d5e9a91e6ff6fb416cbf8f5f48628a4be55 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 14:38:42 +0000 Subject: [PATCH 24/25] Fix typo --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e7bfe28..9ff9889 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY ./ /opt WORKDIR /opt -RUN pip install tox tox -e build +RUN pip install tox && tox -e build FROM ${REGISTRY}/ncigdc/python3.8:${BASE_CONTAINER_VERSION} From c46d20c82a7dd839f95d94315350748180f6b040 Mon Sep 17 00:00:00 2001 From: Charles Czysz Date: Wed, 27 Jul 2022 14:47:07 +0000 Subject: [PATCH 25/25] Fix Dockerfile copy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9ff9889..52b0f9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN pip install tox && tox -e build FROM ${REGISTRY}/ncigdc/python3.8:${BASE_CONTAINER_VERSION} -COPY --from=builder /opt/build/dist/*.tar.gz /opt +COPY --from=builder /opt/dist/*.tar.gz /opt COPY requirements.txt /opt WORKDIR /opt