From 65bb873198b0097fe6f917dbf58a57356f08958c Mon Sep 17 00:00:00 2001 From: mhkc Date: Mon, 29 Apr 2024 14:04:04 +0200 Subject: [PATCH] Refactored frontend setup configuration --- frontend/MANIFEST.in | 9 +---- frontend/app/__init__.py | 3 +- frontend/app/blueprints/gens/views.py | 2 +- frontend/app/blueprints/home/views.py | 2 +- frontend/pyproject.toml | 7 ++++ frontend/requirements.txt | 1 - frontend/setup.cfg | 41 ++++++++++++++++++-- frontend/setup.py | 56 +++------------------------ 8 files changed, 55 insertions(+), 66 deletions(-) create mode 100644 frontend/pyproject.toml diff --git a/frontend/MANIFEST.in b/frontend/MANIFEST.in index ea11d5ab..29e96a31 100644 --- a/frontend/MANIFEST.in +++ b/frontend/MANIFEST.in @@ -9,13 +9,8 @@ include requirements.txt include requirements-dev.txt # server -recursive-include gens/templates/ *.html -recursive-include gens/static/**/ * -recursive-include scout/blueprints/**/templates/ *.html -recursive-include scout/blueprints/**/static/ * - -# api -include gens/openapi/openapi.yaml +recursive-include app/templates/ *.html +recursive-include app/static/**/ * # excluding recursive-exclude * *.py[co] diff --git a/frontend/app/__init__.py b/frontend/app/__init__.py index 63aa19ad..046cb090 100644 --- a/frontend/app/__init__.py +++ b/frontend/app/__init__.py @@ -1,2 +1 @@ -from .__version__ import VERSION as version -from .app import create_app +from .__version__ import VERSION as __version__ diff --git a/frontend/app/blueprints/gens/views.py b/frontend/app/blueprints/gens/views.py index 7f45dead..1a4569fb 100644 --- a/frontend/app/blueprints/gens/views.py +++ b/frontend/app/blueprints/gens/views.py @@ -5,7 +5,7 @@ from flask import Blueprint, abort, current_app, render_template, request -from app import version +from app import __version__ as version from app.api import get_sample from app.io import parse_region_str diff --git a/frontend/app/blueprints/home/views.py b/frontend/app/blueprints/home/views.py index f07e585d..17890177 100644 --- a/frontend/app/blueprints/home/views.py +++ b/frontend/app/blueprints/home/views.py @@ -6,7 +6,7 @@ from flask import Blueprint, current_app, render_template, request -from app import version +from app import __version__ as version from app.api import get_samples, get_timestamps LOG = logging.getLogger(__name__) diff --git a/frontend/pyproject.toml b/frontend/pyproject.toml new file mode 100644 index 00000000..cb263259 --- /dev/null +++ b/frontend/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.isort] +profile = "black" +src_paths = ["app"] \ No newline at end of file diff --git a/frontend/requirements.txt b/frontend/requirements.txt index 0dc2193d..9c558e35 100644 --- a/frontend/requirements.txt +++ b/frontend/requirements.txt @@ -1,2 +1 @@ -gunicorn . diff --git a/frontend/setup.cfg b/frontend/setup.cfg index ca24dc04..db0264e2 100644 --- a/frontend/setup.cfg +++ b/frontend/setup.cfg @@ -1,8 +1,41 @@ -[bumpversion] -current_version = 2.1.1 - [metadata] -description-file = README.md +name = gens_app +version = attr: app.__version__ +author = Markus Johansson +author_email = markus.h.johansson@skane.se +classifiers = + Development Status :: 5 - Production/Stable + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + +[options] +packages = find: +zip_safe = True +include_package_data = True +python_requires = >=3.10 +install_requires = + setuptools + wheel + flask + gunicorn + flask-compress + requests + pydantic + tabulate + +[options.package_data] +app = *.css, *js + +[options.extras_require] +dev = + black + isort + mypy + pytest + pytest-cov + pytest-flask [isort] profile=black diff --git a/frontend/setup.py b/frontend/setup.py index 31d29529..1328947f 100644 --- a/frontend/setup.py +++ b/frontend/setup.py @@ -1,53 +1,9 @@ -# coding: utf-8 +#!/usr/bin/env python +"""Build frontend with setuptools. -from os import path +Build is defined in setup.cfg""" -from setuptools import find_packages, setup +import setuptools -setup( - name="gens", - version="2.1.1", - description="Gens is a web-based interactive tool to visualize genomic copy number profiles from WGS data.", - license="MIT", - author="Ronja, Markus Johansson", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - ], - keywords=["Flask", "Genomics", "WGS"], - packages=find_packages(), - zip_safe=False, - install_requires=[ - "Flask", - "pydantic", - "gtfparse>=1.2.0", - "pysam>=0.15.4", - "pyyaml", - "flask-compress", - "tabulate", - "requests", - ], - setup_requires=["pytest-runner"], - tests_require=["pytest", "mongomock"], - entry_points={ - "console_scripts": ["gens=gens.commands:cli"], - }, - package_data={ - "gens": [ - "gens/templates/*.html", - "gens/static/**/*", - "gens/static/**/*", - "scout/blueprints/**/templates/*.html", - "scout/blueprints/**/static/*", - "gens/openapi/openapi.yaml", - ] - }, - include_package_data=True, -) +if __name__ == "__main__": + setuptools.setup() \ No newline at end of file