Commit f680ccf4 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

put all the build info to pyproject.toml

removed setup.py
parent 98e9f96c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -4,21 +4,31 @@ build-backend = "setuptools.build_meta"

[project]
name   = "pysen"
dynamic = ["version", "scripts", "license", "dependencies" ]
authors = [
	{name = "Piotr Zolnierczuk", email = "zolnierczukp@ornl.gov" },
]

license = "BSD-3-Clause"
description = "Python tools for the SNS-NSE instrument"
readme = "README.md"
requires-python = ">=3.10"
dynamic = ["version", ]

classifiers = [
    "Programming Language :: Python :: 3",
    "Operating System :: OS Independent",
    "Topic :: Scientific/Engineering :: Physics"
]
dependencies = ['numpy', 'scipy', 'matplotlib', 'pandas', 'h5py' , 'qtpy', 'qtconsole']

[project.scripts]
nseplot = "pysen.ui.nseplot:main"
nxs2taco= "pysen.inout.nxs2taco:main"

[tool.setuptools]
package-dir = {"pysen" = "pysen"}

[tool.setuptools.dynamic]
version = {attr = "pysen.revision.__version__"}

[tool.coverage.run]
command_line = "-m pytest test"
@@ -32,3 +42,4 @@ omit = [
	"pysen/**/__init__.py",
	"pysen/ui/*",
]
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
Main PySEN package
"""

from .revision  import version                                             # NOQA
from .revision  import __version__, version                                # NOQA
from .constants import *
from .physics   import (get_theta, get_q, q_binning, l_binning, t_binning, # NOQA
                        get_tau, tof2lambda, lambda2tof)                   # NOQA
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ def main():
    parser.set_defaults(loglevel=1, out='.', converter='to_taco', ignore_errors=False,
                        compression='gzip')
    parser.add_argument('filename', metavar='file', nargs='+', help='file name to process')
    parser.add_argument('--version', action='version',
    parser.add_argument('--version', '-V', action='version',
                        version='%(prog)s pysen={version}'.format(version=version(full=True)))
    parser.add_argument('--outdir', '-o', dest='out',
                        help='set output directory (default %(default)s)')
+4 −8
Original line number Diff line number Diff line
@@ -2,19 +2,15 @@
PySEN revision module
"""
import sys
__version__  = "2.0"
__release__  = ".7b5"
__date__     = "Oct 18, 2025"
__version__  = "2.0.7b7"
__date__     = "Oct 20, 2025"

def version(full=False):
    "get pysen version number"
    if __release__ == 'release':
        ver = "%s" % __version__
    else:
        ver = "%s%s" % (__version__, __release__)
    ver = __version__
    if full:
        py_ver = " Python %s.%s" % (sys.version_info.major, sys.version_info.minor)
        ver = "%s (%s) %s" % (ver, __date__, py_ver)
        ver = "%s (%s) %s" % (__version__, __date__, py_ver)
    return ver


setup.py

deleted100755 → 0
+0 −58
Original line number Diff line number Diff line
#!/usr/bin/env python
"PySEN setup script"

import setuptools
from   setuptools import setup

import os
import importlib.util
import pathlib

AUTHOR    = "Piotr Zolnierczuk"
COPYRIGHT = "(c) 2012-2025 Piotr Zolnierczuk, FZJ, ORNL"
ABOUT = """The PySEN (Python for Spin Echo with Neutrons) package is
a collection of Python modules and tools for the SNS-NSE instrument"""
NAME = 'pysen'

def get_version(name, version_file='revision.py'):
    """get version
    I wish I knew simpler way that works with pyproject.toml
    """
    path   = os.path.join(pathlib.Path(__file__).parent, name, version_file)
    spec   = importlib.util.spec_from_file_location(name,path)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module.version()


setup(
      name          =  NAME,
      version       =  get_version(NAME),
      author        =  AUTHOR,
      author_email  = "zolnierczukp AT ornl gov",
      url           = "http://neutrons.ornl.gov/nse",
      description   = 'Python tools for the SNS-NSE instrument',
      long_description = ABOUT,
      packages      = setuptools.find_packages(where='.', exclude=['misc', 'test']),
      package_dir   = { NAME:  'pysen' },
      package_data  = { NAME: ["ui/resources/*"]},
      entry_points={
        'console_scripts': [
            'nseplot          = pysen.ui.nseplot:main',
            'nxs2taco         = pysen.inout.nxs2taco:main',
        ],
      },
      scripts       = [
        'scripts/pysen_completion',
      ],
      install_requires = ['numpy', 'scipy', 'matplotlib', 'pandas', 'h5py' , 'qtpy', 'qtconsole'],
      #for development and  testing 
      #requires 'sphinx', 'pytest', 'pylint' 'coverage' 
      license = 'BSD 3-Clause License',
      classifiers=[
        "Development Status :: 3 - Alpha",
        "Topic :: Scientific/Engineering :: Physics",
        "License :: OSI Approved :: BSD License",
      ],
)