From d1e52eae862ca59788e67cbe29b1f4ef4726f702 Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Thu, 27 Oct 2022 14:45:38 +0200 Subject: [PATCH] Switch to pyprojetc.toml The packaging uses now the modern pyproject.toml and setup.cfg files. The setup.py is deprecated. --- Makefile | 15 ++++----- src/MANIFEST.in | 6 ---- src/Makefile | 6 ++-- src/pip.freeze | 12 ------- src/pyproject.toml | 3 ++ src/setup.cfg | 54 ++++++++++++++++++++++++++++++++ src/setup.py | 78 ---------------------------------------------- 7 files changed, 68 insertions(+), 106 deletions(-) delete mode 100644 src/MANIFEST.in delete mode 100644 src/pip.freeze create mode 100644 src/pyproject.toml create mode 100644 src/setup.cfg delete mode 100644 src/setup.py diff --git a/Makefile b/Makefile index 69a0d0f..d0dfe5f 100644 --- a/Makefile +++ b/Makefile @@ -11,19 +11,20 @@ pybinding: venv: ifeq ($(NO_VENV),0) @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) - $(INSIDE_VENV) \ - wget https://bootstrap.pypa.io/get-pip.py && \ - python get-pip.py && \ - pip install --upgrade setuptools && \ - pip install -r src/pip.freeze && \ - rm -f get-pip.py + $(INSIDE_VENV) python -m ensurepip --upgrade endif +# wget https://bootstrap.pypa.io/get-pip.py && \ +# python get-pip.py && \ +# rm -f get-pip.py +# pip install --upgrade setuptools && \ +# pip install -r src/pip.freeze && \ + install: venv pybinding wx @+$(INSIDE_VENV) $(MAKE) -C src sdist @+$(INSIDE_VENV) $(MAKE) -C src frontend - @+$(INSIDE_VENV) pip install src/dist/msspec-$(VERSION).tar.gz + @+$(INSIDE_VENV) pip install src/dist/msspec-$(VERSION)*.whl @echo "Do not forget to check that $(INSTALL_PREFIX)/bin is set in your \$$PATH" diff --git a/src/MANIFEST.in b/src/MANIFEST.in deleted file mode 100644 index cfb311f..0000000 --- a/src/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -recursive-include msspec *.so -recursive-include . SConstruct -include setup_requirements.txt -include requirements.txt -include pip.freeze -include VERSION diff --git a/src/Makefile b/src/Makefile index 0e8bf39..668d735 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,14 +11,14 @@ frontend: $(INSTALL_PREFIX)/bin/msspec dist/msspec-$(VERSION).tar.gz: VERSION @echo "Creating Python source distribution..." - @$(PYTHON_EXE) setup.py sdist + @+$(INSIDE_VENV) pip install build + @+$(INSIDE_VENV) $(PYTHON_EXE) -m build $(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION @echo "Installing frontend command..." @mkdir -p $(dir $@) - @cat $< | sed -e 's/__VERSION__/$(VERSION)/' -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@ - #@cat $< | sed 's/__VERSION__/$(VERSION)/' > $@ + @cat $< | sed -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@ @chmod 755 $@ diff --git a/src/pip.freeze b/src/pip.freeze deleted file mode 100644 index 406ab63..0000000 --- a/src/pip.freeze +++ /dev/null @@ -1,12 +0,0 @@ -ase -h5py -ipython -lxml -matplotlib -numpy -Pint -pandas -pycairo -scipy -setuptools-scm -terminaltables diff --git a/src/pyproject.toml b/src/pyproject.toml new file mode 100644 index 0000000..60ddec8 --- /dev/null +++ b/src/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" diff --git a/src/setup.cfg b/src/setup.cfg new file mode 100644 index 0000000..ce2c01f --- /dev/null +++ b/src/setup.cfg @@ -0,0 +1,54 @@ +[metadata] +name = msspec +version = attr: msspec.version.__version__ +author = Didier Sébilleau, Sylvain Tricot +author_email = sylvain.tricot@univ-rennes1.fr +url = https://msspec.cnrs.fr +description = A multiple scattering package for sepectroscopies using electrons to probe materials +long_description = MsSpec is a Fortran package to compute the + cross-section of several spectroscopies involving one (or more) + electron(s) as the probe. This package provides a python interface to + control all the steps of the calculation. + + Available spectroscopies: + * Photoelectron diffraction + * Auger electron diffraction + * Low energy electron diffraction + * X-Ray absorption spectroscopy + * Auger Photoelectron coincidence spectroscopy + * Computation of the spectral radius""", +keywords = spectroscopy atom electron photon multiple scattering +license = GPL +classifiers = + Development Status :: 3 - Alpha + Environment :: Console + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License (GPL) + Natural Language :: English + Operating System :: Microsoft :: Windows :: Windows 10 + Operating System :: POSIX :: Linux + Operating System :: MacOS :: MacOS X + Programming Language :: Fortran + Programming Language :: Python :: 3 :: Only + Topic :: Scientific/Engineering :: Physics + +[options] +packages = find: +zip_safe = False +install_requires = + setuptools_scm + ase + h5py + ipython + lxml + matplotlib + numpy + Pint + pandas + pycairo + scipy + terminaltables + +[options.package_data] +msspec.phagen.fortran = *.so +msspec.spec.fortran = *.so diff --git a/src/setup.py b/src/setup.py deleted file mode 100644 index 8dd9c43..0000000 --- a/src/setup.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -# Copyright © 2016-2020 - Rennes Physics Institute -# -# This file is part of msspec. -# -# msspec is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# msspec is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this msspec. If not, see . -# -# Source file : src/setup.py -# Last modified: mar. 07 avril 2020 17:01:42 -# Committed by : "Sylvain Tricot " - -import sys -sys.path.insert(0, "msspec") -from setuptools import setup, find_packages -from version import __version__ - -with open('pip.freeze', 'r') as fd: - REQUIREMENTS = fd.read().strip().split('\n') - -if __name__ == "__main__": - setup(name='msspec', - version=__version__, - include_package_data=True, - packages=find_packages(include='msspec.*'), - #setup_requires=SETUP_REQUIREMENTS, - install_requires=REQUIREMENTS, - - author='Didier Sébilleau, Sylvain Tricot', - author_email='sylvain.tricot@univ-rennes1.fr', - maintainer='Sylvain Tricot', - maintainer_email='sylvain.tricot@univ-rennes1.fr', - url='https://msspec.cnrs.fr', - description=('A multiple scattering package for sepectroscopies ' - 'using electrons to probe materials'), - long_description="""MsSpec is a Fortran package to compute the - cross-section of several spectroscopies involving one (or more) - electron(s) as the probe. This package provides a python interface to - control all the steps of the calculation. - - Available spectroscopies: - * Photoelectron diffraction - * Auger electron diffraction - * Low energy electron diffraction - * X-Ray absorption spectroscopy - * Auger Photoelectron coincidence spectroscopy - * Computation of the spectral radius""", - download_url='https://msspec.cnrs.fr/downloads.html', - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Environment :: Console', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: GNU General Public License (GPL)', - 'Natural Language :: English', - 'Operating System :: Microsoft :: Windows :: Windows 10', - 'Operating System :: POSIX :: Linux', - 'Operating System :: MacOS :: MacOS X', - 'Programming Language :: Fortran', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Scientific/Engineering :: Physics', - ], - keywords='spectroscopy atom electron photon multiple scattering', - license='GPL', - #entry_points={ - # 'console_scripts': ['msspec=msspec.cli:main']} - )