diff --git a/.gitignore b/.gitignore index 9af1cf3d..d25a2f73 100644 --- a/.gitignore +++ b/.gitignore @@ -91,7 +91,7 @@ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -# .python-version +**/.python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. @@ -176,8 +176,8 @@ yarn-debug.log* yarn-error.log* frontend/public/ frontend/node_modules -node_modules/ +**/node_modules/ +**/.yarn # Data -server/curfu/data -client/node_modules +server/src/curfu/data diff --git a/LICENSE b/LICENSE index 859f3c0e..8cb143ef 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021-2022 Alex H. Wagner +Copyright (c) 2021-2024 Genomic Medicine Lab Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Procfile b/Procfile index d2d9113c..1687f997 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: sh -c 'cd ./server/ && gunicorn -k uvicorn.workers.UvicornWorker curfu.main:app --timeout 1000 --log-level debug' +web: sh -c 'cd ./server/src/ && gunicorn -k uvicorn.workers.UvicornWorker curfu.main:app --timeout 1000 --log-level debug' diff --git a/server/curfu/version.py b/server/curfu/version.py deleted file mode 100644 index b53ed92c..00000000 --- a/server/curfu/version.py +++ /dev/null @@ -1,2 +0,0 @@ -"""Provide app version.""" -__version__ = "0.2.0-rc.3" diff --git a/server/pyproject.toml b/server/pyproject.toml index e50d642d..c9456bda 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -1,6 +1,73 @@ +[project] +name = "curfu" +authors = [ + {name = "Alex Wagner", email = "alex.wagner@nationwidechildrens.org"}, + {name = "Kori Kuzma", email = "kori.kuzma@nationwidechildrens.org"}, + {name = "James Stevenson", email = "james.stevenson@nationwidechildrens.org"}, + {name = "Katie Stahl", email = "kathryn.stahl@nationwidechildrens.org"}, + {name = "Jeremy Arbesfeld", email = "jeremy.arbesfeld@nationwidechildrens.org"} +] +readme = "README.md" +classifiers = [ + "Development Status :: 3 - Alpha", + "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.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +requires-python = ">=3.10" +description = "Curation tool for gene fusions" +license = {file = "../LICENSE"} +dependencies = [ + "fastapi >= 0.72.0", + "aiofiles", + "asyncpg", + "fusor ~= 0.0.30-dev1", + "sqlparse >= 0.4.2", + "urllib3 >= 1.26.5", + "click", + "jinja2", + "boto3", +] +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "pytest", + "pytest-asyncio >= 0.19.0", + "pytest-cov", + "coverage", + "httpx", +] +dev = [ + "psycopg2-binary", + "ruff", + "black", + "pre-commit>=3.7.1", + "gene-normalizer ~= 0.1.39", + "pydantic-to-typescript", +] + +[project.scripts] +curfu_devtools = "curfu.cli:devtools" +curfu = "curfu.cli:serve" + [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta:__legacy__" +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools_scm] + +[tool.pytest.ini_options] +addopts = "--cov=src --cov-report term-missing" +testpaths = ["tests"] [tool.black] line-length = 88 diff --git a/server/setup.cfg b/server/setup.cfg deleted file mode 100644 index f5a8b3ad..00000000 --- a/server/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[metadata] -name = curfu -description = Curation tool for gene fusions -long_description = file:README.md -long_description_content_type = text/markdown -author = Wagner Lab, Nationwide Childrens Hospital -license = MIT - -[options] -packages = find: -python_requires = >=3.8 -zip_safe = False -include_package_data = True - -install_requires = - fastapi >= 0.72.0 - aiofiles - asyncpg - fusor ~= 0.0.30-dev1 - sqlparse >= 0.4.2 - urllib3 >= 1.26.5 - click - jinja2 - boto3 - -[options.extras_require] -tests = - pytest - pytest-asyncio >= 0.19.0 - pytest-cov - coverage - httpx - -dev = - psycopg2-binary - ruff - black - pre-commit >= 3.7.1 - gene-normalizer ~= 0.1.39 - pydantic-to-typescript - - -[options.entry_points] -console_scripts = - curfu_devtools = curfu.cli:devtools - curfu = curfu.cli:serve - -[tool:pytest] -addopts = --disable-warnings --cov-report term-missing --cov-config=.coveragerc --cov=curfu -asyncio_mode = auto diff --git a/server/setup.py b/server/setup.py deleted file mode 100644 index a3fd140d..00000000 --- a/server/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Defines how metakb is packaged and distributed.""" -from setuptools import setup - -exec(open("curfu/version.py").read()) -setup(version=__version__) # noqa: F821 diff --git a/server/curfu/__init__.py b/server/src/curfu/__init__.py similarity index 88% rename from server/curfu/__init__.py rename to server/src/curfu/__init__.py index 235e9429..405d6d56 100644 --- a/server/curfu/__init__.py +++ b/server/src/curfu/__init__.py @@ -1,9 +1,15 @@ """Fusion curation interface.""" import logging +from importlib.metadata import PackageNotFoundError, version from os import environ from pathlib import Path -from .version import __version__ +try: + __version__ = version("curfu") +except PackageNotFoundError: + __version__ = "unknown" +finally: + del version, PackageNotFoundError # provide consistent paths APP_ROOT = Path(__file__).resolve().parents[0] diff --git a/server/curfu/cli.py b/server/src/curfu/cli.py similarity index 100% rename from server/curfu/cli.py rename to server/src/curfu/cli.py diff --git a/server/curfu/devtools/__init__.py b/server/src/curfu/devtools/__init__.py similarity index 100% rename from server/curfu/devtools/__init__.py rename to server/src/curfu/devtools/__init__.py diff --git a/server/curfu/devtools/build_client_types.py b/server/src/curfu/devtools/build_client_types.py similarity index 100% rename from server/curfu/devtools/build_client_types.py rename to server/src/curfu/devtools/build_client_types.py diff --git a/server/curfu/devtools/build_gene_suggest.py b/server/src/curfu/devtools/build_gene_suggest.py similarity index 100% rename from server/curfu/devtools/build_gene_suggest.py rename to server/src/curfu/devtools/build_gene_suggest.py diff --git a/server/curfu/devtools/build_interpro.py b/server/src/curfu/devtools/build_interpro.py similarity index 100% rename from server/curfu/devtools/build_interpro.py rename to server/src/curfu/devtools/build_interpro.py diff --git a/server/curfu/domain_services.py b/server/src/curfu/domain_services.py similarity index 100% rename from server/curfu/domain_services.py rename to server/src/curfu/domain_services.py diff --git a/server/curfu/gene_services.py b/server/src/curfu/gene_services.py similarity index 100% rename from server/curfu/gene_services.py rename to server/src/curfu/gene_services.py diff --git a/server/curfu/main.py b/server/src/curfu/main.py similarity index 98% rename from server/curfu/main.py rename to server/src/curfu/main.py index d4df661e..a14cb86b 100644 --- a/server/curfu/main.py +++ b/server/src/curfu/main.py @@ -7,6 +7,7 @@ from starlette.templating import _TemplateResponse as TemplateResponse from curfu import APP_ROOT +from curfu import __version__ as curfu_version from curfu.domain_services import DomainService from curfu.gene_services import GeneService from curfu.routers import ( @@ -19,7 +20,6 @@ utilities, validate, ) -from curfu.version import __version__ as curfu_version fastapi_app = FastAPI( title="Fusion Curation API", diff --git a/server/curfu/routers/__init__.py b/server/src/curfu/routers/__init__.py similarity index 100% rename from server/curfu/routers/__init__.py rename to server/src/curfu/routers/__init__.py diff --git a/server/curfu/routers/complete.py b/server/src/curfu/routers/complete.py similarity index 100% rename from server/curfu/routers/complete.py rename to server/src/curfu/routers/complete.py diff --git a/server/curfu/routers/constructors.py b/server/src/curfu/routers/constructors.py similarity index 100% rename from server/curfu/routers/constructors.py rename to server/src/curfu/routers/constructors.py diff --git a/server/curfu/routers/demo.py b/server/src/curfu/routers/demo.py similarity index 100% rename from server/curfu/routers/demo.py rename to server/src/curfu/routers/demo.py diff --git a/server/curfu/routers/lookup.py b/server/src/curfu/routers/lookup.py similarity index 100% rename from server/curfu/routers/lookup.py rename to server/src/curfu/routers/lookup.py diff --git a/server/curfu/routers/meta.py b/server/src/curfu/routers/meta.py similarity index 93% rename from server/curfu/routers/meta.py rename to server/src/curfu/routers/meta.py index 2032de94..85211baf 100644 --- a/server/curfu/routers/meta.py +++ b/server/src/curfu/routers/meta.py @@ -3,8 +3,8 @@ from fastapi import APIRouter from fusor import __version__ as fusor_version +from curfu import __version__ as curfu_version from curfu.schemas import RouteTag, ServiceInfoResponse -from curfu.version import __version__ as curfu_version router = APIRouter() diff --git a/server/curfu/routers/nomenclature.py b/server/src/curfu/routers/nomenclature.py similarity index 100% rename from server/curfu/routers/nomenclature.py rename to server/src/curfu/routers/nomenclature.py diff --git a/server/curfu/routers/utilities.py b/server/src/curfu/routers/utilities.py similarity index 100% rename from server/curfu/routers/utilities.py rename to server/src/curfu/routers/utilities.py diff --git a/server/curfu/routers/validate.py b/server/src/curfu/routers/validate.py similarity index 100% rename from server/curfu/routers/validate.py rename to server/src/curfu/routers/validate.py diff --git a/server/curfu/schemas.py b/server/src/curfu/schemas.py similarity index 100% rename from server/curfu/schemas.py rename to server/src/curfu/schemas.py diff --git a/server/curfu/sequence_services.py b/server/src/curfu/sequence_services.py similarity index 100% rename from server/curfu/sequence_services.py rename to server/src/curfu/sequence_services.py diff --git a/server/curfu/utils.py b/server/src/curfu/utils.py similarity index 100% rename from server/curfu/utils.py rename to server/src/curfu/utils.py