Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle cases where gene_context is not found #536

Merged
merged 10 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .flake8

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: black
uses: psf/black@stable
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: python3 -m pip install ".[dev]"

- name: ruff
uses: chartboost/ruff-action@v1
- name: Check style
run: python3 -m ruff check . && ruff format --check .
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ dist/

.mypy_cache/

variation/data/seqrepo/
variation/data/uta_20180821
variation/data/notebooks
variation/data/*.txt
src/variation/data

Pipfile.lock

Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: detect-private-key
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.280
rev: v0.2.0
hooks:
- id: ruff-format
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ variation-normalizer = {editable = true, path = "."}
jupyter = "*"
ipykernel = "*"
psycopg2-binary = "*"
ruff = "*"
black = "*"
ruff = "==0.2.0"

[packages]
"biocommons.seqrepo" = "*"
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,26 @@ Next, view the OpenAPI docs on your local machine:

### Init coding style tests

Code style is managed by [Ruff](https://github.com/astral-sh/ruff) and checked prior to commit.
Code style is managed by [Ruff](https://docs.astral.sh/ruff/) and checked prior to commit.

Check style with `ruff`:

```shell
python3 -m ruff format . && python3 -m ruff check --fix .
```

We use [pre-commit](https://pre-commit.com/#usage) to run conformance tests.

This ensures:

* Check code style
* Check for added large files
* Detect AWS Credentials
* Detect Private Key
* Style correctness
* No large files
* AWS credentials are present
* Private key is present

Before first commit run:
Pre-commit *must* be installed before your first commit. Use the following command:

```shell
```commandline
pre-commit install
```

Expand Down
2 changes: 1 addition & 1 deletion codebuild/deploy_eb_env_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"Status"
]
print(eb_provisioned_product_status)
except Exception as e: # noqa: E722
except Exception as e:
print(e)
print("The EB environment is already running....")
172 changes: 145 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,159 @@
[project]
name = "variation-normalizer"
authors = [
{name = "Alex Wagner"},
{name = "Kori Kuzma"},
{name = "James Stevenson"}
]
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: FastAPI",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.8"
description = "VICC normalization routine for variations"
license = {file = "LICENSE"}
dependencies = [
"biocommons.seqrepo",
"fastapi",
"uvicorn",
"pydantic ==2.*",
"ga4gh.vrs[extras] ~= 2.0.0a2",
"gene-normalizer ~=0.3.0.dev1",
"boto3",
"cool-seq-tool ~=0.4.0.dev1",
"bioutils"
]
dynamic = ["version"]

[project.optional-dependencies]
test = ["pytest>=6.0", "pytest-cov", "pytest-asyncio"]
dev = ["pre-commit", "ruff==0.2.0", "psycopg2-binary", "jupyter", "ipykernel"]

[project.urls]
Homepage = "https://github.com/cancervariants/variation-normalization"
Documentation = "https://github.com/cancervariants/variation-normalization"
Changelog = "https://github.com/cancervariants/variation-normalization/releases"
Source = "https://github.com/cancervariants/variation-normalization"
"Bug Tracker" = "https://github.com/cancervariants/variation-normalization/issues"

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "variation.version.__version__"}

# Scanning for namespace packages in the ``src`` directory is true by
# default in pyproject.toml, so you do NOT need to include the
# `tool.setuptools.packages.find` if it looks like the following:
# [tool.setuptools.packages.find]
# namespaces = true
# where = ["src"]

[tool.pytest.ini_options]
addopts = "--cov=src --cov-report term-missing"
testpaths = ["tests"]

[tool.black]
line-length = 88
[tool.coverage.run]
branch = true

[tool.ruff]
# pycodestyle (E, W)
# Pyflakes (F)
# flake8-annotations (ANN)
# flake8-quotes (Q)
# pydocstyle (D)
# pep8-naming (N)
# isort (I)
select = ["E", "W", "F", "ANN", "Q", "D", "N", "I"]
src = ["src"]

fixable = ["I", "F401"]
lint.select = [
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
"E", "W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]

lint.fixable = [
"I",
"F401",
"D",
"UP",
"ANN",
"B",
"C4",
"G",
"PIE",
"PT",
"RSE",
"SIM",
"RUF"
]
# ANN101 - missing-type-self
# ANN003 - missing-type-kwargs
# D203 - one-blank-line-before-class
# D205 - blank-line-after-summary
# D206 - indent-with-spaces*
# D213 - multi-line-summary-second-line
# D300 - triple-single-quotes*
# D400 - ends-in-period
# D415 - ends-in-punctuation
# ANN101 - missing-type-self
# ANN003 - missing-type-kwargs
# E501 - line-too-long
ignore = ["D205", "D400", "D415", "ANN101", "ANN003", "E501"]

[tool.ruff.flake8-quotes]
docstring-quotes = "double"
# E111 - indentation-with-invalid-multiple*
# E114 - indentation-with-invalid-multiple-comment*
# E117 - over-indented*
# E501 - line-too-long*
# W191 - tab-indentation*
# PGH003 - blanket-type-ignore
# *ignored for compatibility with formatter
lint.ignore = [
"ANN101", "ANN003",
"D203", "D205", "D206", "D213", "D300", "D400", "D415",
"E111", "E114", "E117", "E501",
"W191",
"PGH003",
"S321",
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
# ANN001 - missing-type-function-argument
# ANN2 - missing-return-type
# ANN201 - Missing type annotation
# ANN102 - missing-type-cls
# N805 - invalid-first-argument-name-for-method
# F821 - undefined-name
# F401 - unused-import
"tests/*" = ["ANN001", "ANN2", "ANN102"]
"setup.py" = ["F821"]
"*__init__.py" = ["F401"]
"variation/schemas/*" = ["ANN201", "N805", "ANN001"]
# S101 - assert
# B011 - assert-false
# RUF001 - ambiguous-unicode-character-string
"tests/*" = ["ANN001", "ANN102", "ANN2", "S101", "B011"]
"src/variation/schemas/*" = ["ANN001", "ANN201", "N805", "S101"]
"codebuild/*" = ["T201"]

[tool.ruff.lint.flake8-bugbear]
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
extend-immutable-calls = ["fastapi.Query"]
61 changes: 0 additions & 61 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion variation/__init__.py → src/variation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import environ

if "VARIATION_NORM_EB_PROD" in environ:
LOG_FN = "/tmp/variation.log"
LOG_FN = "/var/variation.log"
else:
LOG_FN = "variation.log"

Expand Down
Loading
Loading