From 22b4e2934070d5e292d68d7a5da950236dd2a9d8 Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Mon, 13 Mar 2023 11:31:47 +1300 Subject: [PATCH] Migrate to setup.cfg and pyproject.toml (#299) --- .github/workflows/ci-cd.yml | 2 +- nptdms/version.py | 7 +++-- pyproject.toml | 5 ++++ setup.cfg | 48 +++++++++++++++++++++++++++++++ setup.py | 56 ++----------------------------------- 5 files changed, 62 insertions(+), 56 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg mode change 100644 => 100755 setup.py diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index ac2b932..2ceeb09 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.8', '3.9', '3.10', '3.11'] os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/nptdms/version.py b/nptdms/version.py index f49d7d0..b1a40df 100644 --- a/nptdms/version.py +++ b/nptdms/version.py @@ -1,2 +1,5 @@ -__version_info__ = (1, 6, 1) -__version__ = '.'.join('%d' % d for d in __version_info__) +from importlib import metadata + + +__version__ = metadata.version('nptdms') +__version_info__ = tuple(int(x) for x in __version__.split('.')) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4d3bb67 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = [ + "setuptools", +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..21809bc --- /dev/null +++ b/setup.cfg @@ -0,0 +1,48 @@ +[metadata] +name = npTDMS +version = 1.6.2 +description = Cross-platform, NumPy based module for reading TDMS files produced by LabView +author = Adam Reeve +author_email = adreeve@gmail.com +url = https://github.com/adamreeve/npTDMS +long_description = file: README.rst +license = LGPL +classifiers = + Development Status :: 5 - Production/Stable + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Topic :: Scientific/Engineering + License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) + Intended Audience :: Science/Research + Natural Language :: English + +[options] +packages = + nptdms + nptdms.export + nptdms.test +install_requires = + numpy + +[options.entry_points] +console_scripts = + tdmsinfo = nptdms.tdmsinfo:main + +[options.extras_require] +test = + pytest >= 3.1.0 + hypothesis + pytest-benchmark + thermocouples_reference + scipy +pandas = + pandas +hdf = + h5py >= 2.10.0 +thermocouple_scaling = + diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 0663ca9..c5d7c39 --- a/setup.py +++ b/setup.py @@ -1,57 +1,7 @@ -import os +#!/usr/bin/env python from setuptools import setup -def read_version(): - here = os.path.abspath(os.path.dirname(__file__)) - version_path = os.path.sep.join((here, "nptdms", "version.py")) - v_globals = {} - v_locals = {} - exec(open(version_path).read(), v_globals, v_locals) - return v_locals['__version__'] - - -setup( - name = 'npTDMS', - version = read_version(), - description = ("Cross-platform, NumPy based module for reading " - "TDMS files produced by LabView."), - author = 'Adam Reeve', - author_email = 'adreeve@gmail.com', - url = 'https://github.com/adamreeve/npTDMS', - packages = ['nptdms', 'nptdms.export', 'nptdms.test'], - long_description=open('README.rst').read(), - license = 'LGPL', - classifiers = [ - 'Development Status :: 4 - Beta', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Scientific/Engineering', - 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', - 'Intended Audience :: Science/Research', - 'Natural Language :: English', - ], - install_requires = ['numpy'], - extras_require = { - 'test': [ - 'pytest>=3.1.0', - 'hypothesis', - 'pytest-benchmark', - 'thermocouples_reference', - 'scipy', - ], - 'pandas': ['pandas'], - 'hdf': ['h5py>=2.10.0'], - 'thermocouple_scaling': [], # Kept for backwards compatibility - }, - entry_points = """ - [console_scripts] - tdmsinfo=nptdms.tdmsinfo:main - """ -) +if __name__ == '__main__': + setup()