diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index adc9be7..1e57aeb 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -19,23 +19,20 @@ on: jobs: deploy: - + name: Publish sdist to Pypi runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + python-version: '3.11' + - run: uv build + # Check that basic features work and we didn't miss to include crucial files + - name: Smoke test (wheel) + run: uv run --isolated --no-project -p 3.11 --with dist/*.whl datastock/tests + - name: Smoke test (source distribution) + run: uv run --isolated --no-project -p 3.11 --with dist/*.tar.gz datastock/tests + - run: uv publish --trusted-publishing always with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-testing-matrix.yml b/.github/workflows/python-testing-matrix.yml index 354c24b..405803d 100644 --- a/.github/workflows/python-testing-matrix.yml +++ b/.github/workflows/python-testing-matrix.yml @@ -21,25 +21,21 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + + # git checkout + - uses: actions/checkout@v4 + + # Install uv + - name: Install uv + uses: astral-sh/setup-uv@v5 with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - pip install -r requirements.txt - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: install datastock - run: | - pip install -e ".[dev]" # --no-build-isolation - - name: Test with pytest - run: | - pytest datastock/tests -v -x \ No newline at end of file + python-version: ${{ matrix.python-version }} + + # Install library + - name: Install the project + run: uv sync --all-extras --dev + + # Run tests + - name: Run tests + # For example, using `pytest` + run: uv run pytest datastock/tests diff --git a/.gitignore b/.gitignore index 5f28050..bcb2373 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ __pycache__/ # C extensions *.so +# single sourcing verion file +datastock/_version.py + # Distribution / packaging .Python build/ diff --git a/CLASSIFIERS.txt b/CLASSIFIERS.txt new file mode 100644 index 0000000..8ac5eb2 --- /dev/null +++ b/CLASSIFIERS.txt @@ -0,0 +1,11 @@ +"Development Status :: 5 - Production/Stable" +"Intended Audience :: Science/Research" +"Programming Language :: Python :: 3" +"Programming Language :: Python :: 3.6" +"Programming Language :: Python :: 3.7" +"Programming Language :: Python :: 3.8" +"Programming Language :: Python :: 3.9" +"Programming Language :: Python :: 3.10" +"Programming Language :: Python :: 3.11" +"Natural Language :: English" +"License :: OSI Approved :: MIT License" diff --git a/LICENSE b/LICENSE.txt similarity index 97% rename from LICENSE rename to LICENSE.txt index 52973b6..dc8b1e1 100644 --- a/LICENSE +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 ToFuProject +Copyright (c) 2023 ToFuProject Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in index 81daa54..1d79101 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,3 +3,4 @@ include MANIFEST.in include LICENSE.txt include pyproject.toml +include CLASSIFIERS.txt diff --git a/datastock/__init__.py b/datastock/__init__.py index f3a72d8..2fb723d 100644 --- a/datastock/__init__.py +++ b/datastock/__init__.py @@ -1,10 +1,31 @@ +# ############### +# __version__ +# ############### -from .version import __version__ +from . import _version +__version__ = _version.version +__version_tuple__ = _version.version_tuple + + +# from setuptools_scm import get_version +# __version__ = get_version(root='..', relative_to=__file__) + + +# from importlib.metadata import version +# __version__ = version(__package__) +# cleanup +# del get_version + + +# ############### +# sub-packages +# ############### + from . import _generic_check from ._generic_utils_plot import * from ._class import DataStock from ._saveload import load, get_files from ._direct_calls import * -from . import tests \ No newline at end of file +from . import tests diff --git a/datastock/version.py b/datastock/version.py index 789edb9..2710ad7 100644 --- a/datastock/version.py +++ b/datastock/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '0.0.49' +__version__ = '0.0.49-1-g545b8a4' diff --git a/pyproject.toml b/pyproject.toml index 778b1c3..42e00a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,57 +1,63 @@ +[build-system] +requires = ["setuptools", "setuptools_scm"] +build-backend = "setuptools.build_meta" + + +[tool.setuptools.packages.find] +where = ["datastock"] +include = ["datastock*"] +namespaces = false + + +[tool.setuptools_scm] +version_file = "datastock/_version.py" + + +[tool.setuptools.dynamic] +readme = {file = ["README.md"]} +classifiers = {file = ["CLASSIFIERS.txt"]} + + [project] name = "datastock" -license = {file = "LICENSE"} -dynamic = ["version"] +license = {text = "MIT"} +dynamic = ["version", "readme", "classifiers"] description = "Generic handler for multiple heterogenous numpy arrays and subclasses" -readme = "README.md" -requires-python = ">=3.6" authors = [ - {name = "Didier VEZINET", email = "didier.vezinet@gmail.com"}, + {name = "Didier VEZINET", email = "didier.vezinet@gmail.com"}, ] maintainers = [ - {name = "Didier VEZINET", email = "didier.vezinet@gmail.com"}, + {name = "Didier VEZINET", email = "didier.vezinet@gmail.com"}, ] -keywords = ["data", "analysis", "interactive", "heterogeneous arrays", "numpy", "Collection"] -classifiers = [ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - "Development Status :: 5 - Production/Stable", - - # Indicate who your project is intended for - "Intended Audience :: Science/Research", - - # Specify the Python versions you support here. - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", +keywords = [ + "data", "analysis", "interactive", "heterogeneous arrays", "numpy", "Collection", ] +requires-python = ">=3.8" dependencies = [ - "numpy", - "scipy", - "matplotlib", - "astropy", + "numpy", + "scipy", + "matplotlib", + "PyQt5 ; platform_system != 'Windows'", + # "PySide2; platform_system == 'Windows'", + "astropy", ] -[build-system] -requires = [ - "setuptools>=40.8.0, <64", - "wheel", - "Cython>=0.26", - "numpy", -] +[project.urls] +Homepage = "https://github.com/ToFuProject/datastock" +Issues = "https://github.com/ToFuProject/datastock/issues" + + +[project.entry-points."datastock"] +datastock = "scripts.main:main" + [dependency-groups] dev = [ "pytest", ] + [project.optional-dependencies] linting = [ 'ruff' @@ -59,6 +65,3 @@ linting = [ formatting = [ 'ruff' ] - -[project.entry-points."datastock"] -datastock = "scripts.main:main" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8a53d5a..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -####### Requirements without Version Specifiers ####### -numpy -scipy -matplotlib -astropy diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index da42cd6..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# For details, see -# https://docs.python.org/2/distutils/configfile.html -# https://packaging.python.org/distributing/#manifest-in -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py deleted file mode 100644 index 9efa067..0000000 --- a/setup.py +++ /dev/null @@ -1,178 +0,0 @@ -""" A tomography library for fusion devices - -See: -https://github.com/ToFuProject/datastock -""" - -# Built-in -import os -from codecs import open -# ... setup tools -from setuptools import setup, find_packages - - -# ... local script -import _updateversion as up - - -# == Getting version =========================================== -_HERE = os.path.abspath(os.path.dirname(__file__)) - -version = up.updateversion() - -print("") -print("Version for setup.py : ", version) -print("") - - -# ============================================================== -# Get the long description from the README file -# Get the readme file whatever its extension (md vs rst) - -_README = [ - ff - for ff in os.listdir(_HERE) - if len(ff) <= 10 and ff[:7] == "README." -] -assert len(_README) == 1 -_README = _README[0] -with open(os.path.join(_HERE, _README), encoding="utf-8") as f: - long_description = f.read() -if _README.endswith(".md"): - long_description_content_type = "text/markdown" -else: - long_description_content_type = "text/x-rst" - - -# ============================================================= - - -# ============================================================== -# Compiling files - -setup( - name="datastock", - version=f"{version}", - # Use scm to get code version from git tags - # cf. https://pypi.python.org/pypi/setuptools_scm - # Versions should comply with PEP440. For a discussion on single-sourcing - # the version across setup.py and the project code, see - # https://packaging.python.org/en/latest/single_source_version.html - # The version is stored only in the setup.py file and read from it (option - # 1 in https://packaging.python.org/en/latest/single_source_version.html) - use_scm_version=False, - - # Description of what library does - description="A python library for generic class and data handling", - long_description=long_description, - long_description_content_type=long_description_content_type, - - # The project's main homepage. - url="https://github.com/ToFuProject/datastock", - # Author details - author="Didier VEZINET", - author_email="didier.vezinet@gmail.com", - - # Choose your license - license="MIT", - - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - "Development Status :: 4 - Beta", - # Indicate who your project is intended for - "Intended Audience :: Science/Research", - "Topic :: Scientific/Engineering :: Physics", - # Pick your license as you wish (should match "license" above) - "License :: OSI Approved :: MIT License", - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - # In which language most of the code is written ? - "Natural Language :: English", - ], - - # What does your project relate to? - keywords="data analysis class container generic interactive plot", - - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - packages=find_packages( - exclude=[ - "doc", - ] - ), - - # Alternatively, if you want to distribute just a my_module.py, uncomment - # this: - # py_modules=["my_module"], - # List run-time dependencies here. These will be installed by pip when - # your project is installed. For an analysis of "install_requires" vs pip's - # requirements files see: - # https://packaging.python.org/en/latest/requirements.html - install_requires=[ - "numpy", - "scipy", - "matplotlib", - "astropy", - ], - python_requires=">=3.6", - - # List additional groups of dependencies here (e.g. development - # dependencies). You can install these using the following syntax, - # for example: - # $ pip install -e .[dev,test] - extras_require={ - "dev": [ - "check-manifest", - "coverage", - "pytest", - "sphinx", - "sphinx-gallery", - "sphinx_bootstrap_theme", - ] - }, - - # If there are data files included in your packages that need to be - # installed, specify them here. If using Python 2.6 or less, then these - # have to be included in MANIFEST.in as well. - # package_data={ - # # If any package contains *.txt, *.rst or *.npz files, include them: - # '': ['*.txt', '*.rst', '*.npz'], - # # And include any *.csv files found in the 'ITER' package, too: - # 'ITER': ['*.csv'], - # }, - # package_data={}, - # include_package_data=True, - - # Although 'package_data' is the preferred approach, in some case you may - # need to place data files outside of your packages. See: - # http://docs.python.org/3.4/distutils/setupscript.html - # installing-additional-files # noqa - # In this case, 'data_file' will be installed into '/my_data' - # data_files=[('my_data', ['data/data_file'])], - - # executable scripts can be declared here - # They can be python or non-python scripts - # scripts=[ - # ], - - # entry_points point to functions in the package - # Theye are generally preferable over scripts because they provide - # cross-platform support and allow pip to create the appropriate form - # of executable for the target platform. - entry_points={ - 'console_scripts': [ - 'datastock=scripts.main:main', - ], - }, - - # include_dirs=[np.get_include()], - - py_modules=['_updateversion'], -)