From ee80d92a805c32cb6e63e839a95d794259cedde9 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 20:19:04 -0700 Subject: [PATCH 01/11] migrated setup.cfg to pyproject.toml --- .gitignore | 122 ++++------------------------ misc/docker/Makefile | 8 ++ pyproject.toml | 90 ++++++++++++++++++++ sbin/makefile-extract-documentation | 11 +-- setup.cfg | 96 ++++++---------------- 5 files changed, 145 insertions(+), 182 deletions(-) create mode 100644 misc/docker/Makefile create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 40dfebe..f3419be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,110 +1,22 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg +*.bak *.egg - -# 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/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: +*.egg-info *.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# IPython Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# dotenv -.env - -# virtualenv -venv/ -ENV/ - -# Spyder project settings -.spyderproject - -# Rope project settings -.ropeproject - -# PyCharm -.idea - -*~ -*.bak +*.manifest *.orig -doc/_build +*.sqlite3 +*~ +.cache +.coverage .eggs -archive -misc/docker -.pytest_cache - -doc/changelog/*/.tags -doc/changelog/*/.tags.mk -doc/changelog/*/hg-git-remap.pl +.idea +.ipynb_checkpoints +.tox .vscode - - -.tags -.tags.mk +__pycache__ +archive +build +dist +docs/_build +nosetests.xml +venv diff --git a/misc/docker/Makefile b/misc/docker/Makefile new file mode 100644 index 0000000..9e20200 --- /dev/null +++ b/misc/docker/Makefile @@ -0,0 +1,8 @@ +SEQREPO_VERSION=0.6.5 +SEQREPO_DATA_RELEASE=2021-01-29 + +docker-image: ${SEQREPO_DATA_RELEASE}.log + +%.log: + ./build ${SEQREPO_VERSION} $* 2>&1 | tee $@.tmp + mv $@.tmp $@ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9175400 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,90 @@ +[project] +name = "biocommons.seqrepo" +authors = [ + { name="biocommons contributors", email="biocommons-dev@googlegroups.com" }, +] +description = "Non-redundant, compressed, journalled, file-based storage for biological sequences" +readme = "README.md" +license = { file="LICENSE.txt" } +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dynamic = ["version"] + +[project.urls] +"Homepage" = "https://github.com/biocommons/biocommons.seqrepo" +"Bug Tracker" = "https://github.com/biocommons/biocommons.seqrepo/issues" + + +[build-system] +requires = [ + "setuptools >= 65.3", + "setuptools_scm[toml] ~= 7.0" + ] +build-backend = "setuptools.build_meta" + + +[tool.setuptools_scm] + + +# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml +[tool.pytest.ini_options] +addopts = "-s -v -x --strict-markers -m 'not extra' --doctest-modules --cov=src" +doctest_optionflags = [ + "ALLOW_BYTES", + "ALLOW_UNICODE", + "ELLIPSIS", + "IGNORE_EXCEPTION_DETAIL", + "NORMALIZE_WHITESPACE", +] +markers = [ + "network: tests that require network connectivity", + "slow: slow tests that should be run infrequently", +] + + +[tool.coverage.run] +branch = true +source = ["biocommons.seqrepo"] +omit = ["*_test.py", "*/test/*", "*/tests/*"] + + +[tool.coverage.report] +show_missing = true +exclude_lines = [ + # Have to re-enable the standard pragma + "pragma: no cover", + + # Don't complain about missing debug-only code: + "def __repr__", + "if self.debug", + + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + + # Don't complain if non-runnable code isn't run: + "if __name__ == .__main__.:", +] + +[tool.black] +line-length = 100 + + +# [tool.flake8] +# flake8 does not support configuration in pyproject.toml +# https://github.com/PyCQA/flake8/issues/234#issuecomment-812800832 +# The config in setup.cfg + +[tool.pylint.'MESSAGES CONTROL'] +disable = "R0913" + + +[tool.pylint.format] +max-line-length = 100 diff --git a/sbin/makefile-extract-documentation b/sbin/makefile-extract-documentation index a64aa46..29b77c0 100755 --- a/sbin/makefile-extract-documentation +++ b/sbin/makefile-extract-documentation @@ -1,5 +1,6 @@ #!/usr/bin/env perl -# extract-makefile-documentation -- extract doc from a makefile +# makefile-extract-documentation -- extract doc from a makefile + # This script prints the header, up to the first empty line AND prints # line starting with #=, and indented by an optional number of >. @@ -12,14 +13,14 @@ while (<>) { # -# Copyright 2014 Contributors -# +# Copyright 2021 Reece Hart (reecehart@gmail.com) +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/setup.cfg b/setup.cfg index 5c3bc92..c93aa94 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,45 +1,10 @@ -# See here: -# https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files -# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c -# https://github.com/pyscaffold/pyscaffold/blob/master/setup.cfg - -[metadata] -# version is extracted from SCM tag by setuptools_scm -author = Reece Hart -author_email = biocommons-dev@googlegroups.com -description = Non-redundant, compressed, journalled, file-based storage for biological sequences -home_page = https://github.com/biocommons/biocommons.seqrepo -name = biocommons.seqrepo - -long_description_content_type = text/x-rst; charset=UTF-8 -long_description = file:README.rst -license_file = LICENSE -platform = any -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - Intended Audience :: Healthcare Industry - Intended Audience :: Science/Research - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Topic :: Scientific/Engineering :: Bio-Informatics - Topic :: Scientific/Engineering :: Medical Science Apps. -keywords = - biocommons - bioinformatics - genomics - hgvs - variation - - [options] -packages = find: -python_requires = >= 3.5 -zip_safe = true +include_package_data = True +packages = find_namespace: package_dir = = src +zip_safe = True + install_requires = bioutils>0.4 coloredlogs @@ -51,58 +16,45 @@ install_requires = tqdm yoyo-migrations -setup_requires = +[options.extras_require] +dev = cython pytest-runner setuptools_scm wheel - -tests_require = pytest pytest-cov vcrpy - pytest-vcr - +docs = + mkdocs [options.entry_points] console_scripts = seqrepo = biocommons.seqrepo.cli:main - -[options.package_data] -biocommons.seqrepo.fastadir = - _data/migrations/* -biocommons.seqrepo.seqaliasdb = - _data/migrations/* - - -[options.extras_require] -dev = - tox - - -# TODO: Needed? [options.packages.find] where = src exclude = __pycache__ *.pyc +[options.package_data] +biocommons.seqrepo.fastadir = + _data/migrations/* +biocommons.seqrepo.seqaliasdb = + _data/migrations/* -[aliases] -test = pytest - -[bdist_wheel] -universal = 1 - -[build_sphinx] -all_files = 1 -# http://pep8.readthedocs.org/en/latest/intro.html#error-codes [flake8] -max-line-length = 120 -exclude = tests/* -max-complexity = 10 -ignore = E129,E221,E241,E251,E303,W291 - +ignore = E129,E133,E203,E221,E241,E251,E303,E266,H106,H904,W291 +max-line-length = 100 +max-complexity = 15 +hang-closing = true +exclude = + .eggs + .tox + build + dist + docs/conf.py + tests/* From 0eda8b2dd8ce7c38784cbffb0169cbf2d94e261f Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 20:48:05 -0700 Subject: [PATCH 02/11] migrated from deprecated pkg_resources to importlib.resources --- pyproject.toml | 1 + src/biocommons/__init__.py | 4 -- src/biocommons/seqrepo/__init__.py | 43 +++------------------ src/biocommons/seqrepo/fastadir/fastadir.py | 6 +-- 4 files changed, 10 insertions(+), 44 deletions(-) delete mode 100644 src/biocommons/__init__.py diff --git a/pyproject.toml b/pyproject.toml index 9175400..fd7a6dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ doctest_optionflags = [ markers = [ "network: tests that require network connectivity", "slow: slow tests that should be run infrequently", + "vcr: tests with cached data", ] diff --git a/src/biocommons/__init__.py b/src/biocommons/__init__.py deleted file mode 100644 index 96686a2..0000000 --- a/src/biocommons/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# pragma: nocover -import pkg_resources - -pkg_resources.declare_namespace(__name__) diff --git a/src/biocommons/seqrepo/__init__.py b/src/biocommons/seqrepo/__init__.py index 653e0f7..e8b4fcf 100644 --- a/src/biocommons/seqrepo/__init__.py +++ b/src/biocommons/seqrepo/__init__.py @@ -1,42 +1,11 @@ -# -*- coding: utf-8 -*- -from __future__ import (absolute_import, division, print_function, - unicode_literals) +"""biocommons.seqrepo package""" -import logging -import warnings +from importlib.metadata import PackageNotFoundError, version -import pkg_resources - -_logger = logging.getLogger(__name__) - -from ._versionwarning import * +from .seqrepo import SeqRepo # noqa: F401 try: - __version__ = pkg_resources.get_distribution(__name__).version -except pkg_resources.DistributionNotFound as e: # pragma: no cover - warnings.warn( - "can't get __version__ because %s package isn't installed" % __package__, - Warning, - ) + __version__ = version(__package__) +except PackageNotFoundError: # pragma: no cover + # package is not installed __version__ = None - -_logger.info(__name__ + " " + __version__) - - -from .seqrepo import SeqRepo - -# -# Copyright 2016 biocommons.fastadir Contributors (https://github.com/biocommons/biocommons.fastadir/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/src/biocommons/seqrepo/fastadir/fastadir.py b/src/biocommons/seqrepo/fastadir/fastadir.py index 7b16153..baf51bf 100644 --- a/src/biocommons/seqrepo/fastadir/fastadir.py +++ b/src/biocommons/seqrepo/fastadir/fastadir.py @@ -1,11 +1,11 @@ import datetime import functools +import importlib.resources import logging import os import sqlite3 import time -import pkg_resources import yoyo from ..config import SEQREPO_LRU_CACHE_MAXSIZE @@ -204,8 +204,8 @@ def _upgrade_db(self): sqlite3.connect(self._db_path).close() # ensure that it exists db_url = "sqlite:///" + self._db_path backend = yoyo.get_backend(db_url) - migration_dir = pkg_resources.resource_filename(__package__, migration_path) - migrations = yoyo.read_migrations(migration_dir) + migration_dir = importlib.resources.files(__package__) / migration_path + migrations = yoyo.read_migrations(str(migration_dir)) migrations_to_apply = backend.to_apply(migrations) backend.apply_migrations(migrations_to_apply) From 9a2f3aeefa2d415948be9dbb9b94721f4bf4900b Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:02:55 -0700 Subject: [PATCH 03/11] add markers to pytest.ini --- pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest.ini b/pytest.ini index 53a29d8..df453e6 100644 --- a/pytest.ini +++ b/pytest.ini @@ -20,6 +20,7 @@ filterwarnings = markers = network + vcr ############################################################################ From bfaa4c030cccd32652d7f46215f71e5130fe1d5d Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:07:31 -0700 Subject: [PATCH 04/11] archive data proxy for now --- {tests => archive}/test_dataproxy.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {tests => archive}/test_dataproxy.py (100%) diff --git a/tests/test_dataproxy.py b/archive/test_dataproxy.py similarity index 100% rename from tests/test_dataproxy.py rename to archive/test_dataproxy.py From e7555ea973de6f304d43d97721bcf1873d9ce74e Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:11:10 -0700 Subject: [PATCH 05/11] update .github from biocommons.example --- .github/workflows/cqa.yml | 38 ---------- .github/workflows/labels.yml | 26 +++++++ .github/workflows/python-package.yml | 108 +++++++++++++++++++++++++++ .github/workflows/stale.yml | 24 ++++++ 4 files changed, 158 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/cqa.yml create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/cqa.yml b/.github/workflows/cqa.yml deleted file mode 100644 index 269ad51..0000000 --- a/.github/workflows/cqa.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Test & Upload - -on: - push: - - workflow_dispatch: - -jobs: - test_and_publish: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - - name: install - run: | - sudo apt install libhts-dev libhts3 libhtscodecs-dev libhtscodecs2 tabix - pip install -U pip setuptools - pip install -U pytest pytest-cov twine - pip install . - - - name: Test - run: | - pytest - - - name: Build and Upload - run: | - python3 -m build - python3 -m twine upload dist/* - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TWINE_TEST_TOKEN }} - TWINE_REPOSITORY: testpypi - diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..233a5fc --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,26 @@ +name: github + +on: + push: + branches: + - 'main' + paths: + - '.github/labels.yml' + - '.github/workflows/labels.yml' + +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Run Labeler + uses: crazy-max/ghaction-github-labeler@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + yaml-file: .github/labels.yml + exclude: | + help* + *issue diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..4f045b1 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,108 @@ +name: Python package + +on: + push: + pull_request: + +jobs: + cqa: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: pip + cache-dependency-path: '**/setup.cfg' + + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install --use-deprecated=legacy-resolver -e .[dev] + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Format check with isort + run: | + isort --check src + + - name: Format check with black + run: | + black --check src + + - name: Security check with bandit + run: | + bandit -ll -r src + + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: '**/setup.cfg' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + make develop + + - name: Test with pytest + run: | + make test + + deploy: + needs: + - cqa + - test + runs-on: ubuntu-latest + + steps: + - name: Environment + run: | + echo "::group::Environment info" + echo github.event_name = ${{ github.event_name }} + echo refs = ${{ github.ref }} + echo tags = ${{ startsWith(github.ref, 'refs/tags') }} + echo "::endgroup::" + + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: pip + cache-dependency-path: '**/setup.cfg' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Publish package + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..4f6b2e8 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,24 @@ +# https://github.com/actions/stale + +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '1 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v8 + with: + days-before-issue-stale: 30 + days-before-issue-close: 7 + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.' + close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.' + + days-before-pr-stale: 30 + days-before-pr-close: 7 + stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.' + close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.' + + exempt-all-pr-assignees: true \ No newline at end of file From 69fc309e3c2899998fc875a7eea22593cba4c002 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:14:27 -0700 Subject: [PATCH 06/11] install necessary packages with apt --- .github/workflows/python-package.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4f045b1..88f84ff 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -9,6 +9,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install packages + run: | + sudo apt install libhts-dev libhts3 libhtscodecs-dev libhtscodecs2 tabix + - uses: actions/checkout@v3 - name: Set up Python From 5b6daa81b5eec0011dd396d73f0b4e1bd3dcae67 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:15:39 -0700 Subject: [PATCH 07/11] run actions only on push (not pull_request) --- .github/workflows/python-package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 88f84ff..57756f4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -2,7 +2,6 @@ name: Python package on: push: - pull_request: jobs: cqa: From f6be43eeaa02b745f29fcc1c9cb1bb6a13b58bf6 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:19:59 -0700 Subject: [PATCH 08/11] run actions only on push (not pull_request), but in the right section :-/ --- .github/workflows/python-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 57756f4..92949eb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,10 +8,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install packages - run: | - sudo apt install libhts-dev libhts3 libhtscodecs-dev libhtscodecs2 tabix - - uses: actions/checkout@v3 - name: Set up Python @@ -54,6 +50,10 @@ jobs: python-version: ["3.9", "3.10", "3.11"] steps: + - name: Install packages + run: | + sudo apt install libhts-dev libhts3 libhtscodecs-dev libhtscodecs2 tabix + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From b48834d4e2ea8b91e93f7042a44c64ca78e08c13 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:38:53 -0700 Subject: [PATCH 09/11] add cqa deps --- setup.cfg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index c93aa94..5b78a58 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,13 +18,17 @@ install_requires = [options.extras_require] dev = + bandit + black cython - pytest-runner - setuptools_scm - wheel + flake8 + isort pytest pytest-cov + pytest-runner + setuptools_scm vcrpy + wheel docs = mkdocs From 7cc7f374ad359ba6654e501c5ed92e8e18ef8f17 Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:41:03 -0700 Subject: [PATCH 10/11] reformatted with black and isort --- src/biocommons/seqrepo/cli.py | 113 +++++------------- src/biocommons/seqrepo/dataproxy.py | 4 +- src/biocommons/seqrepo/fastadir/fabgz.py | 20 +--- .../seqrepo/seqaliasdb/seqaliasdb.py | 12 +- src/biocommons/seqrepo/seqrepo.py | 32 ++--- tests/conftest.py | 4 +- tests/test_cli.py | 4 +- tests/test_seqaliasdb.py | 8 +- tests/test_seqrepo.py | 5 +- tests/test_utils.py | 12 +- 10 files changed, 56 insertions(+), 158 deletions(-) diff --git a/src/biocommons/seqrepo/cli.py b/src/biocommons/seqrepo/cli.py index d82a07b..b505aa8 100644 --- a/src/biocommons/seqrepo/cli.py +++ b/src/biocommons/seqrepo/cli.py @@ -44,9 +44,7 @@ instance_name_new_re = re.compile( r"^20[12]\d-\d\d-\d\d$" ) # smells like a new datestamp, 2017-01-17 -instance_name_old_re = re.compile( - r"^20[12]1\d\d\d\d\d$" -) # smells like an old datestamp, 20170117 +instance_name_old_re = re.compile(r"^20[12]1\d\d\d\d\d$") # smells like an old datestamp, 20170117 instance_name_re = re.compile( r"^20[12]\d-?\d\d-?\d\d$" ) # smells like a datestamp, 20170117 or 2017-01-17 @@ -55,9 +53,7 @@ def _get_remote_instances(opts): - line_re = re.compile( - r"d[-rwx]{9}\s+[\d,]+ \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} (.+)" - ) + line_re = re.compile(r"d[-rwx]{9}\s+[\d,]+ \d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} (.+)") rsync_cmd = [ opts.rsync_exe, "--no-motd", @@ -93,18 +89,14 @@ def parse_arguments(): + ". See https://github.com/biocommons/biocommons.seqrepo for more information", ) top_p.add_argument("--dry-run", "-n", default=False, action="store_true") - top_p.add_argument( - "--remote-host", default="dl.biocommons.org", help="rsync server host" - ) + top_p.add_argument("--remote-host", default="dl.biocommons.org", help="rsync server host") top_p.add_argument( "--root-directory", "-r", default=SEQREPO_ROOT_DIR, help="seqrepo root directory (SEQREPO_ROOT_DIR)", ) - top_p.add_argument( - "--rsync-exe", default="/usr/bin/rsync", help="path to rsync executable" - ) + top_p.add_argument("--rsync-exe", default="/usr/bin/rsync", help="path to rsync executable") top_p.add_argument( "--verbose", "-v", @@ -152,9 +144,7 @@ def parse_arguments(): ap = subparsers.add_parser("export", help="export sequences") ap.set_defaults(func=export) ap.add_argument("ALIASES", nargs="*", help="specific aliases to export") - ap.add_argument( - "--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name" - ) + ap.add_argument("--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name") ap.add_argument( "--namespace", "-n", @@ -164,9 +154,7 @@ def parse_arguments(): # export aliases ap = subparsers.add_parser("export-aliases", help="export aliases") ap.set_defaults(func=export_aliases) - ap.add_argument( - "--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name" - ) + ap.add_argument("--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name") ap.add_argument( "--namespace", "-n", @@ -208,15 +196,11 @@ def parse_arguments(): ) # list-local-instances - ap = subparsers.add_parser( - "list-local-instances", help="list local seqrepo instances" - ) + ap = subparsers.add_parser("list-local-instances", help="list local seqrepo instances") ap.set_defaults(func=list_local_instances) # list-remote-instances - ap = subparsers.add_parser( - "list-remote-instances", help="list remote seqrepo instances" - ) + ap = subparsers.add_parser("list-remote-instances", help="list remote seqrepo instances") ap.set_defaults(func=list_remote_instances) # load @@ -241,9 +225,7 @@ def parse_arguments(): ) # pull - ap = subparsers.add_parser( - "pull", help="pull incremental update from seqrepo mirror" - ) + ap = subparsers.add_parser("pull", help="pull incremental update from seqrepo mirror") ap.set_defaults(func=pull) ap.add_argument("--instance-name", "-i", default=None, help="instance name") ap.add_argument( @@ -257,14 +239,10 @@ def parse_arguments(): # show-status ap = subparsers.add_parser("show-status", help="show seqrepo status") ap.set_defaults(func=show_status) - ap.add_argument( - "--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name" - ) + ap.add_argument("--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name") # snapshot - ap = subparsers.add_parser( - "snapshot", help="create a new read-only seqrepo snapshot" - ) + ap = subparsers.add_parser("snapshot", help="create a new read-only seqrepo snapshot") ap.set_defaults(func=snapshot) ap.add_argument( "--instance-name", @@ -284,9 +262,7 @@ def parse_arguments(): "start-shell", help="start interactive shell with initialized seqrepo" ) ap.set_defaults(func=start_shell) - ap.add_argument( - "--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name" - ) + ap.add_argument("--instance-name", "-i", default=DEFAULT_INSTANCE_NAME_RO, help="instance name") # upgrade ap = subparsers.add_parser("upgrade", help="upgrade seqrepo database and directory") @@ -299,9 +275,7 @@ def parse_arguments(): ) # update digests - ap = subparsers.add_parser( - "update-digests", help="update computed digests in place" - ) + ap = subparsers.add_parser("update-digests", help="update computed digests in place") ap.set_defaults(func=update_digests) ap.add_argument( "--instance-name", @@ -369,9 +343,7 @@ def add_assembly_names(opts): sequences = assemblies[assy_name]["sequences"] eq_sequences = [s for s in sequences if s["relationship"] in ("=", "<>")] if not eq_sequences: - _logger.info( - "No '=' sequences to load for {an}; skipping".format(an=assy_name) - ) + _logger.info("No '=' sequences to load for {an}; skipping".format(an=assy_name)) continue # all assembled-molecules (1..22, X, Y, MT) have ncbi aliases in seqrepo @@ -389,23 +361,17 @@ def add_assembly_names(opts): ) ) if not opts.partial_load: - _logger.warning( - "Skipping {an} (-p to enable partial loading)".format(an=assy_name) - ) + _logger.warning("Skipping {an} (-p to enable partial loading)".format(an=assy_name)) continue eq_sequences = [es for es in eq_sequences if es["refseq_ac"] in ncbi_alias_map] _logger.info( - "Loading {n} new accessions for assembly {an}".format( - an=assy_name, n=len(eq_sequences) - ) + "Loading {n} new accessions for assembly {an}".format(an=assy_name, n=len(eq_sequences)) ) for s in eq_sequences: seq_id = ncbi_alias_map[s["refseq_ac"]] - aliases = [ - {"namespace": assy_name, "alias": a} for a in [s["name"]] + s["aliases"] - ] + aliases = [{"namespace": assy_name, "alias": a} for a in [s["name"]] + s["aliases"]] for alias in aliases: sr.aliases.store_alias(seq_id=seq_id, **alias) _logger.debug( @@ -463,9 +429,7 @@ def _rec_iterator(): for srec, arecs in _rec_iterator(): nsad = _convert_alias_records_to_ns_dict(arecs) aliases = [ - "{ns}:{a}".format(ns=ns, a=a) - for ns, aliases in sorted(nsad.items()) - for a in aliases + "{ns}:{a}".format(ns=ns, a=a) for ns, aliases in sorted(nsad.items()) for a in aliases ] print(">" + " ".join(aliases)) for l in _wrap_lines(srec["seq"], 100): @@ -476,9 +440,7 @@ def export_aliases(opts): seqrepo_dir = os.path.join(opts.root_directory, opts.instance_name) sr = SeqRepo(seqrepo_dir) alias_iterator = sr.aliases.find_aliases(translate_ncbi_namespace=True) - grouped_alias_iterator = itertools.groupby( - alias_iterator, key=lambda arec: (arec["seq_id"]) - ) + grouped_alias_iterator = itertools.groupby(alias_iterator, key=lambda arec: (arec["seq_id"])) for _, arecs in grouped_alias_iterator: if opts.namespace: if not any(arec for arec in arecs if arec["namespace"] == opts.namespace): @@ -514,9 +476,7 @@ def fetch_load(opts): def init(opts): seqrepo_dir = os.path.join(opts.root_directory, opts.instance_name) if os.path.exists(seqrepo_dir) and len(os.listdir(seqrepo_dir)) > 0: - raise IOError( - "{seqrepo_dir} exists and is not empty".format(seqrepo_dir=seqrepo_dir) - ) + raise IOError("{seqrepo_dir} exists and is not empty".format(seqrepo_dir=seqrepo_dir)) sr = SeqRepo(seqrepo_dir, writeable=True) # flake8: noqa @@ -559,9 +519,7 @@ def load(opts): else: fh = io.open(fn, mode="rt", encoding="ascii") _logger.info("Opened " + fn) - seq_bar = tqdm.tqdm( - FastaIter(fh), unit=" seqs", disable=disable_bar, leave=False - ) + seq_bar = tqdm.tqdm(FastaIter(fh), unit=" seqs", disable=disable_bar, leave=False) for defline, seq in seq_bar: n_seqs_seen += 1 seq_bar.set_description( @@ -582,9 +540,7 @@ def pull(opts): if opts.instance_name: instance_name = opts.instance_name if instance_name not in remote_instances: - raise KeyError( - "{}: not in list of remote instance names".format(instance_name) - ) + raise KeyError("{}: not in list of remote instance names".format(instance_name)) else: instance_name = remote_instances[-1] _logger.info("most recent seqrepo instance is " + instance_name) @@ -600,11 +556,7 @@ def pull(opts): cmd = [opts.rsync_exe, "-aHP", "--no-motd"] if local_instances: latest_local_instance = local_instances[-1] - cmd += [ - "--link-dest=" - + os.path.join(opts.root_directory, latest_local_instance) - + "/" - ] + cmd += ["--link-dest=" + os.path.join(opts.root_directory, latest_local_instance) + "/"] cmd += ["{h}::seqrepo/{i}/".format(h=opts.remote_host, i=instance_name), tmp_dir] _logger.debug("Executing: " + " ".join(cmd)) @@ -627,11 +579,7 @@ def show_status(opts): sr = SeqRepo(seqrepo_dir) print("seqrepo {version}".format(version=__version__)) - print( - "instance directory: {sr._root_dir}, {ts:.1f} GB".format( - sr=sr, ts=tot_size / 1e9 - ) - ) + print("instance directory: {sr._root_dir}, {ts:.1f} GB".format(sr=sr, ts=tot_size / 1e9)) print( "backends: fastadir (schema {fd_v}), seqaliasdb (schema {sa_v}) ".format( fd_v=sr.sequences.schema_version(), sa_v=sr.aliases.schema_version() @@ -667,8 +615,7 @@ def snapshot(opts): if os.path.commonpath([src_dir, dst_dir]).startswith(src_dir): raise RuntimeError( - "Cannot nest seqrepo directories " - "({} is within {})".format(dst_dir, src_dir) + "Cannot nest seqrepo directories " "({} is within {})".format(dst_dir, src_dir) ) if os.path.exists(dst_dir): @@ -763,9 +710,7 @@ def update_latest(opts, mri=None): if not mri: instances = _get_local_instances(opts) if not instances: - _logger.error( - "No seqrepo instances in {opts.root_directory}".format(opts=opts) - ) + _logger.error("No seqrepo instances in {opts.root_directory}".format(opts=opts)) return mri = instances[-1] dst = os.path.join(opts.root_directory, "latest") @@ -781,11 +726,7 @@ def main(): opts = parse_arguments() verbose_log_level = ( - logging.WARN - if opts.verbose == 0 - else logging.INFO - if opts.verbose == 1 - else logging.DEBUG + logging.WARN if opts.verbose == 0 else logging.INFO if opts.verbose == 1 else logging.DEBUG ) logging.basicConfig(level=verbose_log_level) opts.func(opts) diff --git a/src/biocommons/seqrepo/dataproxy.py b/src/biocommons/seqrepo/dataproxy.py index bb5e8cd..5222716 100644 --- a/src/biocommons/seqrepo/dataproxy.py +++ b/src/biocommons/seqrepo/dataproxy.py @@ -214,9 +214,7 @@ def create_dataproxy(uri: str = None) -> _DataProxy: scheme = parsed_uri.scheme if "+" not in scheme: - raise ValueError( - "create_dataproxy scheme must include provider (e.g., `seqrepo+http:...`)" - ) + raise ValueError("create_dataproxy scheme must include provider (e.g., `seqrepo+http:...`)") provider, proto = scheme.split("+") diff --git a/src/biocommons/seqrepo/fastadir/fabgz.py b/src/biocommons/seqrepo/fastadir/fabgz.py index 44b3145..7f87c2e 100644 --- a/src/biocommons/seqrepo/fastadir/fabgz.py +++ b/src/biocommons/seqrepo/fastadir/fabgz.py @@ -36,9 +36,7 @@ def _get_bgzip_version(exe): ) output = p.communicate() version_line = output[0].splitlines()[1] - version = re.match( - r"(?:Version:|bgzip \(htslib\))\s+(\d+\.\d+(\.\d+)?)", version_line - ).group(1) + version = re.match(r"(?:Version:|bgzip \(htslib\))\s+(\d+\.\d+(\.\d+)?)", version_line).group(1) return version @@ -46,16 +44,12 @@ def _find_bgzip(): """return path to bgzip if found and meets version requirements, else exception""" missing_file_exception = OSError if six.PY2 else FileNotFoundError min_bgzip_version = ".".join(map(str, min_bgzip_version_info)) - exe = os.environ.get( - "SEQREPO_BGZIP_PATH", shutil.which("bgzip") or "/usr/bin/bgzip" - ) + exe = os.environ.get("SEQREPO_BGZIP_PATH", shutil.which("bgzip") or "/usr/bin/bgzip") try: bgzip_version = _get_bgzip_version(exe) except AttributeError: - raise RuntimeError( - "Didn't find version string in bgzip executable ({exe})".format(exe=exe) - ) + raise RuntimeError("Didn't find version string in bgzip executable ({exe})".format(exe=exe)) except missing_file_exception: raise RuntimeError( "{exe} doesn't exist; you need to install htslib and tabix (See https://github.com/biocommons/biocommons.seqrepo#requirements)".format( @@ -151,15 +145,11 @@ def close(self): os.chmod(self.filename + ".fai", stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) os.chmod(self.filename + ".gzi", stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) - _logger.info( - "{} written; added {} sequences".format(self.filename, len(self._added)) - ) + _logger.info("{} written; added {} sequences".format(self.filename, len(self._added))) def __del__(self): if self._fh is not None: _logger.error( - "FabgzWriter({}) was not explicitly closed; data may be lost".format( - self.filename - ) + "FabgzWriter({}) was not explicitly closed; data may be lost".format(self.filename) ) self.close() diff --git a/src/biocommons/seqrepo/seqaliasdb/seqaliasdb.py b/src/biocommons/seqrepo/seqaliasdb/seqaliasdb.py index 8a5123e..ae1ee8e 100644 --- a/src/biocommons/seqrepo/seqaliasdb/seqaliasdb.py +++ b/src/biocommons/seqrepo/seqaliasdb/seqaliasdb.py @@ -55,9 +55,7 @@ def __init__( if schema_version != expected_schema_version: # pragma: no cover raise RuntimeError( "Upgrade required: Database schema" - "version is {} and code expects {}".format( - schema_version, expected_schema_version - ) + "version is {} and code expects {}".format(schema_version, expected_schema_version) ) # ############################################################################ @@ -88,9 +86,7 @@ def fetch_aliases(self, seq_id, current_only=True, translate_ncbi_namespace=None _logger.warning( "translate_ncbi_namespace is obsolete; translation is now automatic; this flag will be removed" ) - return [ - dict(r) for r in self.find_aliases(seq_id=seq_id, current_only=current_only) - ] + return [dict(r) for r in self.find_aliases(seq_id=seq_id, current_only=current_only)] def find_aliases( self, @@ -207,9 +203,7 @@ def store_alias(self, seq_id, namespace, alias): return current_rec["seqalias_id"] # otherwise, we're reassigning; deprecate old record, then retry - _logger.debug( - log_pfx + ": collision; deprecating {s1}".format(s1=current_rec["seq_id"]) - ) + _logger.debug(log_pfx + ": collision; deprecating {s1}".format(s1=current_rec["seq_id"])) cursor.execute( "update seqalias set is_current = 0 where seqalias_id = ?", [current_rec["seqalias_id"]], diff --git a/src/biocommons/seqrepo/seqrepo.py b/src/biocommons/seqrepo/seqrepo.py index 62fbef6..a80ed9f 100644 --- a/src/biocommons/seqrepo/seqrepo.py +++ b/src/biocommons/seqrepo/seqrepo.py @@ -162,9 +162,7 @@ def __iter__(self): yield (srec, arecs) def __str__(self): - return "SeqRepo(root_dir={self._root_dir}, writeable={self._writeable})".format( - self=self - ) + return "SeqRepo(root_dir={self._root_dir}, writeable={self._writeable})".format(self=self) def commit(self): self.sequences.commit() @@ -219,16 +217,12 @@ def store(self, seq, nsaliases): # add sequence if not present n_seqs_added = n_aliases_added = 0 - msg = ( - "sh{nsa_sep}{seq_id:.10s}... ({l} residues; {na} aliases {aliases})".format( - seq_id=seq_id, - l=len(seq), - na=len(nsaliases), - nsa_sep=nsa_sep, - aliases=", ".join( - "{nsa[namespace]}:{nsa[alias]}".format(nsa=nsa) for nsa in nsaliases - ), - ) + msg = "sh{nsa_sep}{seq_id:.10s}... ({l} residues; {na} aliases {aliases})".format( + seq_id=seq_id, + l=len(seq), + na=len(nsaliases), + nsa_sep=nsa_sep, + aliases=", ".join("{nsa[namespace]}:{nsa[alias]}".format(nsa=nsa) for nsa in nsaliases), ) if seq_id not in self.sequences: _logger.info("Storing " + msg) @@ -246,17 +240,13 @@ def store(self, seq, nsaliases): # add/update external aliases for new and existing sequences # updating is optimized to load only new tuples existing_aliases = self.aliases.find_aliases(seq_id=seq_id) - ea_tuples = [ - (r["seq_id"], r["namespace"], r["alias"]) for r in existing_aliases - ] + ea_tuples = [(r["seq_id"], r["namespace"], r["alias"]) for r in existing_aliases] new_tuples = [(seq_id, r["namespace"], r["alias"]) for r in nsaliases] upd_tuples = set(new_tuples) - set(ea_tuples) if upd_tuples: _logger.info("{} new aliases for {}".format(len(upd_tuples), msg)) for _, namespace, alias in upd_tuples: - self.aliases.store_alias( - seq_id=seq_id, namespace=namespace, alias=alias - ) + self.aliases.store_alias(seq_id=seq_id, namespace=namespace, alias=alias) self._pending_aliases += len(upd_tuples) n_aliases_added += len(upd_tuples) if ( @@ -332,9 +322,7 @@ def _get_unique_seqid(self, alias, namespace): raise KeyError("Alias {} (namespace: {})".format(alias, namespace)) if len(seq_ids) > 1: # This should only happen when namespace is None - raise KeyError( - "Alias {} (namespace: {}): not unique".format(alias, namespace) - ) + raise KeyError("Alias {} (namespace: {}): not unique".format(alias, namespace)) return seq_ids.pop() def _update_digest_aliases(self, seq_id, seq): diff --git a/tests/conftest.py b/tests/conftest.py index ca4a867..293f0bb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,9 +8,7 @@ @pytest.fixture(scope="session") def dataproxy(): - sr = SeqRepo( - root_dir=os.environ.get("SEQREPO_ROOT_DIR", "/usr/local/share/seqrepo/latest") - ) + sr = SeqRepo(root_dir=os.environ.get("SEQREPO_ROOT_DIR", "/usr/local/share/seqrepo/latest")) return SeqRepoDataProxy(sr) diff --git a/tests/test_cli.py b/tests/test_cli.py index 07898b9..6250f1a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -21,9 +21,7 @@ class MockOpts(object): test_data_dir = os.path.join(test_dir, "data") opts = MockOpts() - opts.root_directory = os.path.join( - tempfile.mkdtemp(prefix="seqrepo_pytest_"), "seqrepo" - ) + opts.root_directory = os.path.join(tempfile.mkdtemp(prefix="seqrepo_pytest_"), "seqrepo") opts.fasta_files = [os.path.join(test_data_dir, "sequences.fa.gz")] opts.namespace = "test" opts.instance_name = "test" diff --git a/tests/test_seqaliasdb.py b/tests/test_seqaliasdb.py index dbe49c0..c9e5f19 100644 --- a/tests/test_seqaliasdb.py +++ b/tests/test_seqaliasdb.py @@ -33,14 +33,10 @@ def test_seqinfo(): # A:1 -> q2 (reassign) aid = db.store_alias("q2", "A", "1") - assert ( - aid == 4 - ), "should have created a new alias_id on reassignment of new sequence" + assert aid == 4, "should have created a new alias_id on reassignment of new sequence" alias_keys = "seqalias_id seq_id namespace alias is_current".split() - aliases = [ - {k: r[k] for k in alias_keys} for r in db.find_aliases(current_only=False) - ] + aliases = [{k: r[k] for k in alias_keys} for r in db.find_aliases(current_only=False)] aliases.sort( key=lambda r: ( r["seqalias_id"], diff --git a/tests/test_seqrepo.py b/tests/test_seqrepo.py index 3f4b744..8523862 100644 --- a/tests/test_seqrepo.py +++ b/tests/test_seqrepo.py @@ -64,10 +64,7 @@ def test_digests(seqrepo): assert seqrepo.fetch_uri("fr:coin") == "ASINACORNER" assert seqrepo.fetch_uri("MD5:ea81b52627e387fc6edd8b9412cd3a99") == "ASINACORNER" assert seqrepo.fetch_uri("SEGUID:aMQF/cdHkAayLkVYs8XV2u+Hy34") == "ASINACORNER" - assert ( - seqrepo.fetch_uri("SHA1:68c405fdc7479006b22e4558b3c5d5daef87cb7e") - == "ASINACORNER" - ) + assert seqrepo.fetch_uri("SHA1:68c405fdc7479006b22e4558b3c5d5daef87cb7e") == "ASINACORNER" assert seqrepo.fetch_uri("VMC:GS_LDz34B6fA_fLxFoc2agLrXQRYuupOGGM") == "ASINACORNER" diff --git a/tests/test_utils.py b/tests/test_utils.py index b43884c..48221ca 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -19,15 +19,13 @@ def test_parse_defline(): """ - defline = ">NG_007107.2 Homo sapiens methyl-CpG binding protein 2 (MECP2), RefSeqGene on chromosome X" - assert parse_defline(defline, "refseq") == [ - {"namespace": "refseq", "alias": "NG_007107.2"} - ] + defline = ( + ">NG_007107.2 Homo sapiens methyl-CpG binding protein 2 (MECP2), RefSeqGene on chromosome X" + ) + assert parse_defline(defline, "refseq") == [{"namespace": "refseq", "alias": "NG_007107.2"}] defline = ">gi|568815364|ref|NT_077402.3| Homo sapiens chromosome 1 genomic scaffold, GRCh38.p7 Primary Assembly HSCHR1_CTG1" - assert parse_defline(defline, "refseq") == [ - {"namespace": "refseq", "alias": "NT_077402.3"} - ] + assert parse_defline(defline, "refseq") == [{"namespace": "refseq", "alias": "NT_077402.3"}] def test_validate_aliases(): From 8033f3df0ecf8e52a23e5dcf0304fd79488a398b Mon Sep 17 00:00:00 2001 From: Reece Hart Date: Sat, 16 Sep 2023 21:44:11 -0700 Subject: [PATCH 11/11] skip cqa for now --- .github/workflows/python-package.yml | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 92949eb..9f1819a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -4,42 +4,42 @@ on: push: jobs: - cqa: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: pip - cache-dependency-path: '**/setup.cfg' - - - name: Install test dependencies - run: | - python -m pip install --upgrade pip - pip install --use-deprecated=legacy-resolver -e .[dev] - - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Format check with isort - run: | - isort --check src - - - name: Format check with black - run: | - black --check src - - - name: Security check with bandit - run: | - bandit -ll -r src + # cqa: + # runs-on: ubuntu-latest + + # steps: + # - uses: actions/checkout@v3 + + # - name: Set up Python + # uses: actions/setup-python@v4 + # with: + # python-version: "3.10" + # cache: pip + # cache-dependency-path: '**/setup.cfg' + + # - name: Install test dependencies + # run: | + # python -m pip install --upgrade pip + # pip install --use-deprecated=legacy-resolver -e .[dev] + + # - name: Lint with flake8 + # run: | + # # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + # - name: Format check with isort + # run: | + # isort --check src + + # - name: Format check with black + # run: | + # black --check src + + # - name: Security check with bandit + # run: | + # bandit -ll -r src test: runs-on: ubuntu-latest @@ -74,7 +74,7 @@ jobs: deploy: needs: - - cqa + # - cqa - test runs-on: ubuntu-latest