Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ profile_default/
ipython_config.py

.python-version
!/.python-version
!/scripts/population/.python-version

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
Expand All @@ -71,4 +73,4 @@ venv.bak/

# mac os
.DS_Store
common/.DS_Store
common/.DS_Store
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10
FROM python:3.12
# Contains relevant basics for Python, like GCC and similar by default
LABEL maintainer="ensembl-variation@ebi.ac.uk"

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10
FROM python:3.12
# Contains relevant basics for Python, like GCC and similar by default
LABEL maintainer="ensembl-variation@ebi.ac.uk"

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ The API can be queried against a single endpoint specifying the payload to be re
![alt text](assets/architecture.png)


## Python version

Use Python 3.12 for local development and Docker builds.


## Running the API using Docker

Expand Down Expand Up @@ -72,4 +76,4 @@ query variant_example {
}
}
```
More example queries can be found in `examples/`
More example queries can be found in `examples/`
12 changes: 6 additions & 6 deletions common/base_file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import io
import os
import subprocess
from common.file_model.variant import Variant
from common.file_model.structural_variant import StructuralVariant

import vcfpy
from common.file_model.structural_variant import StructuralVariant
from common.file_model.variant import Variant
from common.vcf_reader import read_vcf


class BaseFileClient:
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_record_from_file(

reader = None
try:
reader = vcfpy.Reader.from_path(datafile)
reader = read_vcf(datafile)
try:
for rec in reader.fetch(contig, pos - 1, pos):
if self.record_matches(rec, contig, pos, id):
Expand All @@ -90,7 +90,7 @@ def get_record_from_file(
if not fallback_to_iteration:
return None
self.close_reader(reader)
reader = vcfpy.Reader.from_path(datafile)
reader = read_vcf(datafile)
for rec in reader:
if self.record_matches(rec, contig, pos, id):
return record_class(rec, reader.header, genome_uuid)
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_record_with_bcftools(
if result.returncode != 0:
return None

reader = vcfpy.Reader(io.StringIO(result.stdout))
reader = read_vcf(stream=io.StringIO(result.stdout))
for rec in reader:
if self.record_matches(rec, contig, pos, id):
return record_class(rec, reader.header, genome_uuid)
Expand Down
5 changes: 1 addition & 4 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[mypy]
python_version = 3.8
python_version = 3.12

[mypy-requests.*]
ignore_missing_imports = True

[mypy-snapshottest.*]
ignore_missing_imports = True

[mypy-aiodataloader.*]
ignore_missing_imports = True

Expand Down
13 changes: 6 additions & 7 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-r requirements.txt
pytest==7.1.2
pytest-asyncio==0.18.3
snapshottest==0.6.0
pylint==2.14.3
mypy==0.961
black==22.6.0
ruff==0.12.7
pytest==7.4.4
pytest-asyncio==0.23.8
pylint==3.0.4
mypy==1.8.0
black==24.3.0
ruff==0.12.7
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
duckdb
mongomock==4.0.0
mongomock==4.3.0
pymongo==4.1.1
requests==2.28.0
aiodataloader==0.2.1
ariadne==0.19.1
python-dotenv==0.20.0
uvicorn==0.18.1
pysam==0.21.0
vcfpy @ git+https://github.com/likhitha-surapaneni/vcfpy@header-fix
pysam==0.22.1
vcfpy==0.13.8

2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# --- Linting rules ---
line-length = 88 # Black style
target-version = "py310"
target-version = "py312"

# --- Formatting ---
[format]
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""
"""Configure packaging for the Ensembl Variation GraphQL API.

.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,8 +14,8 @@
"""

from pathlib import Path
from setuptools import setup, find_packages

from setuptools import find_packages, setup

with open(Path(__file__).parent / "LICENSE") as f:
LICENSE_CT = f.read()
Expand All @@ -26,7 +27,7 @@
version="0.1.0",
packages=find_packages(),
license=LICENSE_CT,
python_requires=">=3.8",
python_requires=">=3.12",
package_data={
# Make sure schema makes it to distro
"common": ["*.graphql"]
Expand Down
Loading