Skip to content

Commit

Permalink
build: modernize build configs (#279)
Browse files Browse the repository at this point in the history
* Use the "src" layout instead of a "flat" layout. It is argued that this is better: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/
* Move build settings into `pyproject.toml`. People seem to think this is more "modern". At the very least, it means fewer files for us to manage. Removed some deprecated settings while in here.
* Add a few additional PyPI classifiers.
* Update default test command options (they were showing their age)
  • Loading branch information
jsstevenson authored Oct 4, 2023
1 parent 23d477d commit 6e7ae63
Show file tree
Hide file tree
Showing 34 changed files with 92 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pytest.ini

# ignore data dir
data/*
gene/data/
src/gene/data/

# IDE materials
.idea/
Expand Down
89 changes: 85 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,94 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
[project]
name = "gene-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 routines for genes"
license = {file = "LICENSE"}
dependencies = [
"pydantic",
"fastapi",
"uvicorn",
"click",
"boto3",
"ga4gh.vrsatile.pydantic~=0.0.12",
"ga4gh.vrs~=0.8.1"
]
dynamic = ["version"]

[project.optional-dependencies]
pg = ["psycopg[binary]"]

etl = ["gffutils", "biocommons.seqrepo"]

test = ["pytest>=6.0", "pytest-cov", "mock", "httpx"]

dev = ["pre-commit", "black", "ruff"]

docs = [
"sphinx==6.1.3",
"sphinx-autodoc-typehints==1.22.0",
"sphinx-autobuild==2021.3.14",
"sphinx-copybutton==0.5.2",
"sphinxext-opengraph==0.8.2",
"furo==2023.3.27",
"gravis==0.1.0"
]

[project.urls]
Homepage = "https://github.com/cancervariants/gene-normalization"
Documentation = "https://gene-normalizer.readthedocs.io/en/latest/"
Changelog = "https://github.com/cancervariants/gene-normalization/releases"
Source = "https://github.com/cancervariants/gene-normalization"
"Bug Tracker" = "https://github.com/cancervariants/gene-normalization/issues"

[project.scripts]
gene_norm_update = "gene.cli:update_normalizer_db"
gene_norm_update_remote = "gene.cli:update_from_remote"
gene_norm_dump = "gene.cli:dump_database"
gene_norm_check_db = "gene.cli:check_db"

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

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"gene.database.postgresql" = ["*.sql"]

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

[tool.coverage.run]
branch = true

[tool.black]
line-length = 88
extend-exclude = "^/docs/source/conf.py"

[tool.ruff]
src = ["src"]
# pycodestyle (E, W)
# Pyflakes (F)
# flake8-annotations (ANN)
Expand Down Expand Up @@ -40,7 +122,6 @@ docstring-quotes = "double"
# I001 - Import block unsorted or unformatted
# N805 - invalid-first-argument-name-for-method
"tests/*" = ["ANN001", "ANN102", "ANN2"]
"setup.py" = ["F821"]
"*__init__.py" = ["F401"]
"gene/schemas.py" = ["ANN001", "ANN201", "N805"]
"docs/source/conf.py" = ["D100", "I001", "D103", "ANN201", "ANN001"]
89 changes: 0 additions & 89 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 gene/__init__.py → src/gene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from .version import __version__ # noqa: F401

APP_ROOT = Path(__file__).resolve().parents[0]
APP_ROOT = Path(__file__).resolve().parent

logging.basicConfig(
filename="gene.log", format="[%(asctime)s] - %(name)s - %(levelname)s : %(message)s"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/unit/test_ensembl_source.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Test that the gene normalizer works as intended for the Ensembl source."""
import pytest
from tests.conftest import check_resp_single_record

from gene.query import QueryHandler
from gene.schemas import Gene, MatchType, SourceName
from tests.conftest import check_resp_single_record


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_hgnc_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from datetime import datetime

import pytest
from tests.conftest import check_resp_single_record

from gene.query import QueryHandler
from gene.schemas import Gene, MatchType, SourceName
from tests.conftest import check_resp_single_record


@pytest.fixture(scope="module")
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_ncbi_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from datetime import datetime

import pytest

from gene.query import QueryHandler
from gene.schemas import Gene, MatchType, SourceName
from tests.conftest import (
assertion_checks,
check_ncbi_discontinued_gene,
check_resp_single_record,
)

from gene.query import QueryHandler
from gene.schemas import Gene, MatchType, SourceName


@pytest.fixture(scope="module")
def ncbi(database):
Expand Down

0 comments on commit 6e7ae63

Please sign in to comment.