From d9e37b3f80071aba730af442d35dd9e1e515db39 Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 9 Jun 2025 14:42:26 -0300 Subject: [PATCH] MNT: Modernize Install --- INSTALL | 31 -------------------- Makefile | 8 ++--- README.md | 2 -- pyproject.toml | 76 +++++++++++++++++++++++++----------------------- requirements.txt | 4 +++ setup.py | 25 ++++++++++++++-- 6 files changed, 67 insertions(+), 79 deletions(-) delete mode 100644 INSTALL create mode 100644 requirements.txt diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 43c0c3534..000000000 --- a/INSTALL +++ /dev/null @@ -1,31 +0,0 @@ -INSTALL - pyaccel -================= - -This package can be installed using setuptools (>=16.0). There is no automatic -dependency checking, so read the list below and ensure necessary dependencies -are available. Developed and tested with Python 3 (3.4). - - -REQUIREMENTS -============ - -- numpy 1.8 (>=1.8.2) -- mathphys 0.3 (>=0.3.0) - - -INSTALLATION -============ - -To install to a default Python directory, run - - setup.py install - -Use the appropriate command in . Depending on permissions, it may be -necessary to run the command with sudo or as superuser. - -To install a development version, with a link to the local package files in the -default Python directory, run - - setup.py develop - -Details and further options can be found in setuptools documentation. diff --git a/Makefile b/Makefile index 8d6a8e60f..67dad6fa4 100644 --- a/Makefile +++ b/Makefile @@ -7,18 +7,14 @@ ifeq ($(CONDA_PREFIX),) endif install: uninstall - $(PREFIX) $(PIP) install --no-use-pep517 --no-deps ./ -# $(PREFIX) $(PIP) install --no-deps ./ + $(PREFIX) $(PIP) install --no-deps ./ $(PREFIX) git clean -fdX uninstall: $(PREFIX) $(PIP) uninstall -y $(PACKAGE) develop-install: develop-uninstall - $(PIP) install --no-use-pep517 --no-deps -e ./ -# $(PIP) install --no-deps -e ./ + $(PIP) install --no-deps -e ./ -# known issue: It will fail to uninstall scripts -# if they were installed in develop mode develop-uninstall: $(PIP) uninstall -y $(PACKAGE) diff --git a/README.md b/README.md index 44d85e1ea..f6eca0b8c 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,3 @@ # apsuite Accelerator Physics suite - -For installation instructions, read INSTALL. diff --git a/pyproject.toml b/pyproject.toml index 2477718aa..b74490dae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,47 +1,49 @@ -# [build-system] -# requires = ["setuptools >= 61.0"] -# build-backend = "setuptools.build_meta" +[build-system] +requires = ["setuptools>=44"] +build-backend = "setuptools.build_meta" -# [project] -# name = "apsuite" -# version = "2.50.0" -# dependencies = [] -# requires-python = ">=3.6" -# authors = [ -# {name = "lnls-fac"}, -# ] -# maintainers = [ -# {name = "Ana Oliveira", email = "ana.clara@lnls.br"}, -# {name = "Ximenes Resende", email = "xresende@gmail.com"}, -# {name = "Fernando H. de Sá", email = "fernandohds564@gmail.com"}, -# {name = "Murilo Barbosa Alves", email= "murilo.alves@lnls.br"} -# ] -# description = "High level Accelerator Physics functions" -# readme = "README.md" -# license='MIT' -# keywords = ["SIRIUS", "python", "EPICS", "Accelerator Physics"] -# classifiers = [ -# "Intended Audience :: Science/Research", -# "Programming Language :: Python", -# "Topic :: Scientific/Engineering", -# ] +[project] +name = "apsuite" +authors = [{ name = "lnls-fac" } ] +maintainers = [ + {name = "Ana Oliveira", email = "ana.clara@lnls.br"}, + {name = "Ximenes Resende", email = "xresende@gmail.com"}, + {name = "Fernando H. de Sá", email = "fernandohds564@gmail.com"}, + {name = "Murilo Barbosa Alves", email= "alvesb.murilo@gmail.com"} +] +description = "High level Accelerator Physics functions" +readme = "README.md" +dynamic = ["version", "dependencies"] +requires-python = ">=3.6" +classifiers = [ + "Intended Audience :: Science/Research", + "Programming Language :: Python", + "Topic :: Scientific/Engineering", +] +keywords = ["SIRIUS", "python", "EPICS", "Accelerator Physics"] -# [project.urls] -# # Homepage = "" -# # Documentation = "" -# Repository = "https://github.com/lnls-fac/apsuite" -# "Bug Tracker" = "https://github.com/lnls-fac/apsuite/issues" -# # Changelog = "" +license = "MIT" +license-files= [ "LICENSE", ] -# # [project.optional-dependencies] -# # gui = [] -# # cli = [] +[project.urls] +Homepage = "https://github.com/lnls-fac/apsuite" +Download = "https://github.com/lnls-fac/apsuite" +Repository = "https://github.com/lnls-fac/apsuite.git" +Issues = "https://github.com/lnls-fac/apsuite/issues" -# # [project.scripts] +# --- Setuptools specific configurations --- +[tool.setuptools] +include-package-data = true -# # [project.gui-scripts] +[tool.setuptools.dynamic] +version = { file = "VERSION" } +dependencies = { file = "requirements.txt" } +[tool.setuptools.package-data] +apsuite = ["VERSION"] +"apsuite.loco" = ['*.jpg', ] +# --- linter and formatter configurations --- [tool.ruff] select = [ "W", "E", "A", "B", "C90", "D", "I002", "N", "F", "G", "ARG", "S", "NPY"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..1307a841e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +numpy>=1.8 +scipy>=1.3 +mathphys>=0.7 +matplotlib>=1.4 diff --git a/setup.py b/setup.py index 34287d553..5962b8086 100755 --- a/setup.py +++ b/setup.py @@ -1,16 +1,33 @@ #!/usr/bin/env python-sirius -from setuptools import setup, find_packages +import pathlib +from setuptools import find_packages, setup -with open('VERSION', 'r') as _f: + +def get_abs_path(relative): + """.""" + return str(pathlib.Path(__file__).parent / relative) + + +with open(get_abs_path("README.md"), "r") as _f: + _long_description = _f.read().strip() + + +with open(get_abs_path("VERSION"), "r") as _f: __version__ = _f.read().strip() + +with open(get_abs_path("requirements.txt"), "r") as _f: + _requirements = _f.read().strip().split("\n") + + setup( name='apsuite', version=__version__, author='lnls-fac', description='High level Accelerator Physics functions', + long_description=_long_description, url='https://github.com/lnls-fac/apsuite', download_url='https://github.com/lnls-fac/apsuite', license='MIT License', @@ -20,8 +37,10 @@ 'Topic :: Scientific/Engineering' ], packages=find_packages(), + install_requires=_requirements, package_data={ 'apsuite': ['VERSION'], 'apsuite.loco': ['*.jpg', ], }, - zip_safe=False) + zip_safe=False +)