From 9baf1e44d3d44e923755e7b6a5d6b3a484d5339e Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 15 Nov 2023 18:20:32 +0100 Subject: [PATCH] now with proper package building --- bin/evaluate.py | 27 -------------- pyproject.toml | 91 +++++++++++++++++++++++------------------------ requirements.txt | 8 ----- setup.py | 4 --- src/gui_qt/cli.py | 28 +++++++++++++++ 5 files changed, 73 insertions(+), 85 deletions(-) delete mode 100755 bin/evaluate.py delete mode 100644 requirements.txt delete mode 100755 setup.py create mode 100644 src/gui_qt/cli.py diff --git a/bin/evaluate.py b/bin/evaluate.py deleted file mode 100755 index a9692dd..0000000 --- a/bin/evaluate.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib -sys.path.append(str(pathlib.Path(__file__).absolute().parent.parent / 'src')) - -from nmreval.configs import check_for_config - -# does a directory for config stuff exist? create it if not -check_for_config() - -# pyqtgraph warns on Mac if QApplication is created when it is imported -# import pyqtgraph - -from nmreval.lib.logger import handle_exception -sys.excepthook = handle_exception - -from gui_qt import App - -app = App(['Team Rocket FTW!']) - -from gui_qt.main.mainwindow import NMRMainWindow - -mplQt = NMRMainWindow() -mplQt.show() - -sys.exit(app.exec()) diff --git a/pyproject.toml b/pyproject.toml index 707dbaa..6d6536c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,54 +1,53 @@ -[metadata] -name = nmreval -version = 0.1 -description = Evaluation of data -long_description = file: README.md -author = Dominik Demuth -author_email = dominik.demuth@physik.tu-darmstadt.de -install_requires = [ - 'numpy', - 'scipy', - 'matplotlib', - 'bsddb3', - 'pyqtgraph', - 'pyqt', - 'h5py', +[build-system] +requires = ["setuptools", "wheel", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nmreval" +version = "0.1" +description = "Evaluation of NMR and orther data" +authors = [ + { name = "Dominik Demuth", email = "dominik.demuth@pkm.tu-darmstadt.de" }, ] -keywords = ['nmr', 'physics', 'science'] +maintainers = [ + { name = "Dominik Demuth", email = "dominik.demuth@pkm.tu-darmstadt.de" }, +] +requires-python = ">=3.7" classifiers = [ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: End Users/Desktop', - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Scientific/Engineering :: Visualization', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3 :: only', + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Physics", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: only", + "Operating System :: POSIX :: Linux" +] +keywords = ["nmr", "physics", "science"] +license = { text = "BSD 3-Clause License" } +dependencies = [ + "numpy", + "scipy", + "h5py", + "PyQt5", + "pyqtgraph", ] -license = {text = "BSD 3-Clause License"} -[tool.setuptools] -include_package_data = true +[project.optional-dependencies] +legacy = ["bsddb3"] +[project.urls] +Repository = "https://gitea.pkm.physik.tu-darmstadt.de/IPKM/nmreval" +Issues = "https://gitea.pkm.physik.tu-darmstadt.de/IPKM/nmreval/issues" -[tool.setuptools.packages] -find = {} -scripts = bin/evaluate.py +[project.gui-scripts] +nmreval = "gui_qt.cli:main" [tool.setuptools.packages.find] -include =[ - 'nmreval*', - 'gui_qt*', - 'resources*', -] - -[tool.setuptools.package_data] -* = *.txt, *.npz, *.png, *.json - - - - - +where = ["src"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3b0d8c8..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -matplotlib -numpy -scipy -PyQt5 -h5py -pyqtgraph -bsddb3 -requests diff --git a/setup.py b/setup.py deleted file mode 100755 index b0aecbd..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -# Always prefer setuptools over distutils -from setuptools import setup - -setup() diff --git a/src/gui_qt/cli.py b/src/gui_qt/cli.py new file mode 100644 index 0000000..35853a5 --- /dev/null +++ b/src/gui_qt/cli.py @@ -0,0 +1,28 @@ + +def main(): + import sys + from nmreval.configs import check_for_config + + # does a directory for config stuff exist? create it if not + check_for_config() + + # pyqtgraph warns on Mac if QApplication is created when it is imported + # import pyqtgraph + + from nmreval.lib.logger import handle_exception + sys.excepthook = handle_exception + + from gui_qt import App + + app = App(['Team Rocket FTW!']) + + from gui_qt.main.mainwindow import NMRMainWindow + + mplQt = NMRMainWindow() + mplQt.show() + + sys.exit(app.exec()) + + +if __name__ == '__main__': + main()