[med-svn] [Git][python-team/packages/python-multipletau][upstream] New upstream version 0.4.1+ds

Alexandre Detiste (@detiste-guest) gitlab at salsa.debian.org
Sat Jun 29 12:06:43 BST 2024



Alexandre Detiste pushed to branch upstream at Debian Python Team / packages / python-multipletau


Commits:
04e5ef80 by Alexandre Detiste at 2024-06-29T12:55:01+02:00
New upstream version 0.4.1+ds
- - - - -


23 changed files:

- + .github/FUNDING.yml
- + .github/workflows/check.yml
- + .github/workflows/deploy_pypi.yml
- CHANGELOG
- README.rst
- docs/conf.py
- docs/extensions/fancy_include.py
- + docs/extensions/github_changelog.py
- docs/index.rst
- docs/requirements.txt
- multipletau/__init__.py
- − multipletau/_version.py
- multipletau/core.py
- + pyproject.toml
- − setup.py
- + tests/requirements.txt
- tests/test_ac_cc.py
- tests/test_autocorrelate.py
- tests/test_basic.py
- tests/test_compress.py
- tests/test_correlate.py
- tests/test_ref_numpy.py
- tests/test_ret_sum.py


Changes:

=====================================
.github/FUNDING.yml
=====================================
@@ -0,0 +1,2 @@
+github: paulmueller
+liberapay: paulmueller


=====================================
.github/workflows/check.yml
=====================================
@@ -0,0 +1,39 @@
+name: Checks
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build:
+
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        python-version: ['3.8', '3.11']
+        os: [macos-latest, ubuntu-latest, windows-latest]
+
+    steps:
+    - uses: actions/checkout at v3
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python at v4
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        # prerequisites
+        python -m pip install --upgrade pip wheel
+        python -m pip install coverage flake8 pytest
+        # show installed packages
+        pip freeze
+    - name: Install multipletau
+      run: |
+        pip install .
+    - name: Lint with flake8
+      run: |
+        flake8 --exclude _version.py .
+    - name: Test with pytest
+      run: |
+        coverage run --source=multipletau -m pytest tests
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action at v3


=====================================
.github/workflows/deploy_pypi.yml
=====================================
@@ -0,0 +1,31 @@
+name: Release to PyPI
+
+on:
+  push:
+    tags:
+      - '*'
+
+jobs:
+  deploy:
+    name: Deploy package to PYPI
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ['3.11']
+    steps:
+      - uses: actions/checkout at v3
+        with:
+          fetch-depth: 0
+      - name: Set up Python
+        uses: actions/setup-python at v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Run build
+        run: pipx run build --sdist --wheel
+      - name: publish
+        env:
+          TWINE_USERNAME: __token__
+          TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
+        run: |
+          pipx install twine
+          twine upload --skip-existing dist/*


=====================================
CHANGELOG
=====================================
@@ -1,3 +1,11 @@
+0.4.1
+ - docs: remove Python 2 reference
+0.4.0
+ - ref: support NumPy 2
+ - setup: migrate to GitHub Actions
+ - setup: migrate to pyproject.toml
+ - docs: remove dependency on old mock standalone library (#19)
+ - docs: overhaul and add changelog
 0.3.3
  - fix: add constant `ZERO_CUTOFF` that defines when a trace average is
    treated as zero


=====================================
README.rst
=====================================
@@ -10,9 +10,9 @@ correlation on a linear scale such as `numpy.correlate <http://docs.scipy.org/do
 
 Installation
 ------------
-Multipletau supports Python 2.7 and Python 3.3+ with a common codebase.
-The only requirement for ``multipletau`` is `NumPy <http://www.numpy.org/>`__ (for fast
-operations on arrays). Install multipletau from the Python package index:
+The only requirement for ``multipletau`` is Python 3.x and
+`NumPy <http://www.numpy.org/>`__. Install multipletau from the
+Python package index:
 
 ::
 
@@ -22,7 +22,8 @@ operations on arrays). Install multipletau from the Python package index:
 Documentation
 -------------
 
-The documentation, including the reference and examples, is available on `readthedocs.io <https://multipletau.readthedocs.io/en/stable/>`__.
+The documentation, including the reference and examples, is available
+on `readthedocs.io <https://multipletau.readthedocs.io/en/stable/>`__.
 
 
 Usage
@@ -56,14 +57,14 @@ You can find out what version you are using by typing (in a Python console):
 
     >>> import multipletau
     >>> multipletau.__version__
-    '0.3.0'
+    '0.4.0'
 
 
 
-.. |PyPI Version| image:: http://img.shields.io/pypi/v/multipletau.svg
+.. |PyPI Version| image:: https://img.shields.io/pypi/v/multipletau.svg
    :target: https://pypi.python.org/pypi/multipletau
-.. |Tests Status| image:: http://img.shields.io/travis/FCS-analysis/multipletau.svg?label=tests
-   :target: https://travis-ci.org/FCS-analysis/multipletau
+.. |Tests Status| image:: https://img.shields.io/github/actions/workflow/status/FCS-analysis/multipletau/check.yml
+   :target: https://github.com/FCS-analysis/multipletau/actions?query=workflow%3AChecks
 .. |Coverage Status| image:: https://img.shields.io/codecov/c/github/FCS-analysis/multipletau/master.svg
    :target: https://codecov.io/gh/FCS-analysis/multipletau
 .. |Docs Status| image:: https://readthedocs.org/projects/multipletau/badge/?version=latest


=====================================
docs/conf.py
=====================================
@@ -17,12 +17,16 @@
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 
-import mock
 import os.path as op
 import sys
+from unittest import mock
+
+import multipletau
+
+
 # include parent directory
 pdir = op.dirname(op.dirname(op.abspath(__file__)))
-sys.path.insert(0, pdir) 
+sys.path.insert(0, pdir)
 # include extenstions
 sys.path.append(op.abspath('extensions'))
 
@@ -41,8 +45,8 @@ description = 'A multiple-tau algorithm for Python/NumPy'
 projectname = name
 projectdescription = description
 
-exec(open(op.join(pdir, "multipletau/_version.py")).read())
-release = version #@UndefinedVariable
+
+release = multipletau.__version__
 
 # http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autodoc_member_order
 # Order class attributes and functions in separate blocks
@@ -57,7 +61,7 @@ rst_prolog = """
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -70,10 +74,10 @@ extensions = ['sphinx.ext.intersphinx',
               'sphinx.ext.viewcode',
               'sphinx.ext.napoleon',
               'fancy_include',
+              'github_changelog',
               ]
 
 
-
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -81,7 +85,7 @@ templates_path = ['_templates']
 source_suffix = '.rst'
 
 # The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
 
 # The master toctree document.
 master_doc = 'index'
@@ -96,121 +100,121 @@ copyright = year+", "+author
 #
 # The short X.Y version.
 # The full version, including alpha/beta/rc tags.
-#release = version
+# release = version
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
-#language = None
+# language = None
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
-#today = ''
+# today = ''
 # Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 
 # The reST default role (used for this markup: `text`) to use for all
 # documents.
-#default_role = None
+# default_role = None
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
 
 # If true, the current module name will be prepended to all description
 # unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
 
 # If true, sectionauthor and moduleauthor directives will be shown in the
 # output. They are ignored by default.
-#show_authors = False
+# show_authors = False
 
 # The name of the Pygments (syntax highlighting) style to use.
-#pygments_style = 'default'
+# pygments_style = 'default'
 
 # A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
 
 # If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
+# keep_warnings = False
 
 
 # -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'sphinx_rtd_theme'
 
 # Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-#html_title = None
+# html_title = None
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
 
 # The name of an image file (relative to this directory) to place at the top
 # of the sidebar.
-#html_logo = None
+# html_logo = None
 
 # The name of an image file (within the static path) to use as favicon of the
 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
 # pixels large.
-#html_favicon = None
+# html_favicon = None
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-#html_static_path = ['_static']
+# html_static_path = ['_static']
 
 # Add any extra paths that contain custom files (such as robots.txt or
 # .htaccess) here, relative to this directory. These files are copied
 # directly to the root of the documentation.
-#html_extra_path = []
+# html_extra_path = []
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
 
 # If true, SmartyPants will be used to convert quotes and dashes to
 # typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
 
 # Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
 
 # If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
 
 # If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
 
 # If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
 
 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
 
 # If true, an OpenSearch description file will be output, and all pages will
 # contain a <link> tag referring to it.  The value of this option must be the
 # base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
 
 # This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
 
 # Output file base name for HTML help builder.
 htmlhelp_basename = projectname+'doc'
@@ -219,43 +223,43 @@ htmlhelp_basename = projectname+'doc'
 # -- Options for LaTeX output ---------------------------------------------
 
 latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
+    # The paper size ('letterpaper' or 'a4paper').
+    # 'papersize': 'letterpaper',
 
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
+    # The font size ('10pt', '11pt' or '12pt').
+    # 'pointsize': '10pt',
 
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+    # Additional stuff for the LaTeX preamble.
+    # 'preamble': '',
 }
 
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
-  ('index', projectname+'.tex', projectname+' Documentation',
-   author, 'manual'),
+    ('index', projectname+'.tex', projectname+' Documentation',
+     author, 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
 # the title page.
-#latex_logo = None
+# latex_logo = None
 
 # For "manual" documents, if this is true, then toplevel headings are parts,
 # not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
 
 # If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
 
 # If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
 
 # Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
 
 # If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
 
 
 # -- Options for manual page output ---------------------------------------
@@ -268,7 +272,7 @@ man_pages = [
 ]
 
 # If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
 
 
 # -- Options for Texinfo output -------------------------------------------
@@ -277,23 +281,23 @@ man_pages = [
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-  ('index', projectname, projectname+' Documentation',
-   author, projectname,
-   projectdescription,
-   'Numeric'),
+    ('index', projectname, projectname+' Documentation',
+     author, projectname,
+     projectdescription,
+     'Numeric'),
 ]
 
 # Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = []
 
 # If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True
 
 # How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote'
 
 # If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
+# texinfo_no_detailmenu = False
 
 # -----------------------------------------------------------------------------
 # intersphinx


=====================================
docs/extensions/fancy_include.py
=====================================
@@ -27,8 +27,7 @@ The directive
 will display the doc string formatted with the first line as a
 heading, a code block with line numbers, and the image file.
 """
-import io
-import os.path as op
+import pathlib
 
 from docutils.statemachine import ViewList
 from docutils.parsers.rst import Directive
@@ -42,13 +41,13 @@ class IncludeDirective(Directive):
 
     def run(self):
         path = self.state.document.settings.env.config.fancy_include_path
-        full_path = op.join(path, self.arguments[0])
+        path = pathlib.Path(path)
+        full_path = path / self.arguments[0]
 
-        with io.open(full_path, "r") as myfile:
-            text = myfile.read()
+        text = full_path.read_text()
 
         # add reference
-        name = op.basename(full_path)[:-3]
+        name = full_path.stem
         rst = [".. _example_{}:".format(name),
                "",
                ]
@@ -65,18 +64,18 @@ class IncludeDirective(Directive):
 
         # image
         for ext in [".png", ".jpg"]:
-            image_path = full_path[:-3] + ext
-            if op.exists(image_path):
+            image_path = full_path.with_suffix(ext)
+            if image_path.exists():
                 break
         else:
             image_path = ""
         if image_path:
-            rst.append(".. figure:: {}".format(image_path))
+            rst.append(".. figure:: {}".format(image_path.as_posix()))
             rst.append("")
 
         # download file
-        rst.append(":download:`{}<{}>`".format(
-            op.basename(full_path), full_path))
+        rst.append(":download:`{} <{}>`".format(
+            full_path.name, full_path.as_posix()))
 
         # code
         rst.append("")


=====================================
docs/extensions/github_changelog.py
=====================================
@@ -0,0 +1,75 @@
+"""Display changelog with links to GitHub issues
+
+Usage
+-----
+The directive
+
+   .. include_changelog:: ../CHANGELOG
+
+adds the content of the changelog file into the current document.
+References to GitHub issues are identified as "(#XY)" (with parentheses
+and hash) and a link is inserted
+
+ https://github.com/RI-imaging/{PROJECT}/issues/{XY}
+
+where PROJECT ist the `project` variable defined in conf.py.
+"""
+import io
+import re
+
+from docutils.statemachine import ViewList
+from docutils.parsers.rst import Directive
+from sphinx.util.nodes import nested_parse_with_titles
+from docutils import nodes
+
+
+class IncludeDirective(Directive):
+    required_arguments = 1
+    optional_arguments = 0
+
+    def run(self):
+        full_path = self.arguments[0]
+        project = self.state.document.settings.env.config.github_project
+
+        def insert_github_link(reobj):
+            line = reobj.string
+            instr = line[reobj.start():reobj.end()]
+            issue = instr.strip("#()")
+            link = "https://github.com/{}/issues/".format(project)
+            rstlink = "(`#{issue} <{link}{issue}>`_)".format(issue=issue,
+                                                             link=link)
+            return rstlink
+
+        with io.open(full_path, "r") as myfile:
+            text = myfile.readlines()
+
+        rst = []
+        for line in text:
+            line = line.strip("\n")
+            if line.startswith("  ") and line.strip().startswith("-"):
+                # list in list:
+                rst.append("")
+            if not line.startswith(" "):
+                rst.append("")
+                line = "version " + line
+                rst.append(line)
+                rst.append("-"*len(line))
+            elif not line.strip():
+                rst.append(line)
+            else:
+                line = re.sub(r"\(#[0-9]*\)", insert_github_link, line)
+                rst.append(line)
+
+        vl = ViewList(rst, "fakefile.rst")
+        # Create a node.
+        node = nodes.section()
+        node.document = self.state.document
+        # Parse the rst.
+        nested_parse_with_titles(self.state, vl, node)
+        return node.children
+
+
+def setup(app):
+    app.add_config_value('github_project', "user/project", 'html')
+    app.add_directive('include_changelog', IncludeDirective)
+    return {'version': '0.1'}   # identifies the version of our extension


=====================================
docs/index.rst
=====================================
@@ -17,24 +17,46 @@ Summary:
     correlate_numpy
 
 
+.. _sec_ac:
+
 Autocorrelation
 ---------------
 .. autofunction:: autocorrelate
 
+
+.. _sec_cc:
+
 Cross-correlation
 -----------------
 .. autofunction:: correlate
 
+
+.. _sec_cc_numpy:
+
 Cross-correlation (NumPy)
 -------------------------
 .. autofunction:: correlate_numpy
 
+
+.. _sec_constants:
+
 Constants
 ---------
 .. autodata:: multipletau.core.ZERO_CUTOFF
 
+
+.. _sec_examples:
+
 Examples
 ========
 .. fancy_include:: compare_correlation_methods.py
 
 
+
+.. _sec_changelog:
+
+Changelog
+=========
+List of changes in-between nanite releases.
+
+.. include_changelog:: ../CHANGELOG


=====================================
docs/requirements.txt
=====================================
@@ -1,2 +1,4 @@
-mock
-sphinx>=1.6.4
+sphinx
+sphinxcontrib.bibtex
+sphinx_rtd_theme
+


=====================================
multipletau/__init__.py
=====================================
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 u"""
-Multipletau provides a multiple-τ algorithm for Python 2.7 and
-Python 3.x with :py:mod:`numpy` as its sole dependency.
+Multipletau provides a multiple-τ algorithm Python 3.x with
+:py:mod:`numpy` as its sole dependency.
 
 Multiple-τ correlation is computed on a logarithmic scale (less
 data points are computed) and is thus much faster than conventional
@@ -23,7 +23,7 @@ Recommended literature
 
 Obtaining multipletau
 ---------------------
-If you have Python and :py:mod:`numpy` installed, simply run
+If you have Python and :py:mod:`numpy` installed, simply run::
 
    pip install multipletau
 
@@ -72,7 +72,7 @@ The package is straightforward to use. Here is a quick example:
 
 """
 from .core import autocorrelate, correlate, correlate_numpy  # noqa: F401
-from ._version import version as __version__  # noqa: F401
+from ._version import __version__, __version_tuple__  # noqa: F401
 
 __author__ = u"Paul Müller"
 __license__ = "BSD (3 clause)"


=====================================
multipletau/_version.py deleted
=====================================
@@ -1,141 +0,0 @@
-#!/usr/bin/env python
-"""Determine package version for git repositories from tags
-
-Each time this file is imported it checks if the ".git" folder is
-present and if so, obtains the version from the git history using
-`git describe`. This information is then stored in the file
-`_version_save.py` which is not versioned by git, but distributed
-along e.g. on PyPI.
-"""
-from __future__ import print_function
-
-# Put the entire script into a `True` statement and add the hint
-# `pragma: no cover` to ignore code coverage here.
-if True:  # pragma: no cover
-    import imp
-    import os
-    from os.path import abspath, basename, dirname, join
-    import subprocess
-    import sys
-    import time
-    import traceback
-    import warnings
-
-    def git_describe():
-        """
-        Return a string describing the version returned by the
-        command `git describe --tags HEAD`.
-        If it is not possible to determine the correct version,
-        then an empty string is returned.
-        """
-        # Make sure we are in a directory that belongs to the correct
-        # repository.
-        ourdir = dirname(abspath(__file__))
-
-        def _minimal_ext_cmd(cmd):
-            # construct minimal environment
-            env = {}
-            for k in ['SYSTEMROOT', 'PATH']:
-                v = os.environ.get(k)
-                if v is not None:
-                    env[k] = v
-            # LANGUAGE is used on win32
-            env['LANGUAGE'] = 'C'
-            env['LANG'] = 'C'
-            env['LC_ALL'] = 'C'
-            pop = subprocess.Popen(cmd,
-                                   stdout=subprocess.PIPE,
-                                   stderr=subprocess.PIPE,
-                                   env=env)
-            out = pop.communicate()[0]
-            return out
-
-        # change directory
-        olddir = abspath(os.curdir)
-        os.chdir(ourdir)
-
-        try:
-            out = _minimal_ext_cmd(['git', 'describe', '--tags', 'HEAD'])
-            git_revision = out.strip().decode('ascii')
-        except OSError:
-            git_revision = ""
-
-        # go back to original directory
-        os.chdir(olddir)
-
-        return git_revision
-
-    def load_version(versionfile):
-        """load version from version_save.py"""
-        longversion = ""
-        try:
-            _version_save = imp.load_source("_version_save", versionfile)
-            longversion = _version_save.longversion
-        except BaseException:
-            try:
-                from ._version_save import longversion
-            except BaseException:
-                try:
-                    from _version_save import longversion
-                except BaseException:
-                    pass
-
-        return longversion
-
-    def save_version(version, versionfile):
-        """save version to version_save.py"""
-        data = "#!/usr/bin/env python\n" \
-            + "# This file was created automatically\n" \
-            + "longversion = '{VERSION}'\n"
-        try:
-            with open(versionfile, "w") as fd:
-                fd.write(data.format(VERSION=version))
-        except BaseException:
-            msg = "Could not write package version to {}.".format(versionfile)
-            warnings.warn(msg)
-
-    hdir = dirname(abspath(__file__))
-    if basename(__file__) == "conf.py" and "name" in locals():
-        # This script is executed in conf.py from the docs directory
-        versionfile = join(join(join(hdir, ".."),
-                                name),  # noqa: F821
-                           "_version_save.py")
-    else:
-        # This script is imported as a module
-        versionfile = join(hdir, "_version_save.py")
-
-    # Determine the accurate version
-    longversion = ""
-
-    # 1. git describe
-    try:
-        # Get the version using `git describe`
-        longversion = git_describe()
-    except BaseException:
-        pass
-
-    # 2. previously created version file
-    if longversion == "":
-        # Either this is this is not a git repository or we are in the
-        # wrong git repository.
-        # Get the version from the previously generated `_version_save.py`
-        longversion = load_version(versionfile)
-
-    # 3. last resort: date
-    if longversion == "":
-        print("Could not determine version. Reason:")
-        print(traceback.format_exc())
-        ctime = os.stat(__file__)[8]
-        longversion = time.strftime("%Y.%m.%d-%H-%M-%S", time.gmtime(ctime))
-        print("Using creation time as version: {}".format(longversion))
-
-    if not hasattr(sys, 'frozen'):
-        # Save the version to `_version_save.py` to allow distribution using
-        # `python setup.py sdist`.
-        # This is only done if the program is not frozen (with e.g.
-        # pyinstaller),
-        if longversion != load_version(versionfile):
-            save_version(longversion, versionfile)
-
-    # PEP 440-conform development version:
-    version = ".dev".join(longversion.split("-")[:2])


=====================================
multipletau/core.py
=====================================
@@ -136,7 +136,7 @@ def autocorrelate(a, m=16, deltat=1, normalize=False, copy=True, dtype=None,
     Examples
     --------
     >>> from multipletau import autocorrelate
-    >>> autocorrelate(range(42), m=2, dtype=np.float_)
+    >>> autocorrelate(range(42), m=2, dtype=np.float64)
     array([[  0.00000000e+00,   2.38210000e+04],
            [  1.00000000e+00,   2.29600000e+04],
            [  2.00000000e+00,   2.21000000e+04],
@@ -172,9 +172,9 @@ def autocorrelate(a, m=16, deltat=1, normalize=False, copy=True, dtype=None,
                          copy=copy,
                          dtype=dtype)
     elif dtype.kind != "f":
-        warnings.warn("Input dtype is not float; casting to np.float_!",
+        warnings.warn("Input dtype is not float; casting to np.float64!",
                       DtypeWarning)
-        dtype = np.dtype(np.float_)
+        dtype = np.dtype(np.float64)
 
     # If copy is false and dtype is the same as the input array,
     # then this line does not have an effect:
@@ -384,7 +384,7 @@ def correlate(a, v, m=16, deltat=1, normalize=False, copy=True, dtype=None,
     Examples
     --------
     >>> from multipletau import correlate
-    >>> correlate(range(42), range(1,43), m=2, dtype=np.float_)
+    >>> correlate(range(42), range(1,43), m=2, dtype=np.float64)
     array([[  0.00000000e+00,   2.46820000e+04],
            [  1.00000000e+00,   2.38210000e+04],
            [  2.00000000e+00,   2.29600000e+04],
@@ -421,20 +421,20 @@ def correlate(a, v, m=16, deltat=1, normalize=False, copy=True, dtype=None,
             if dtype.kind == "c" or dtype2.kind == "c":
                 # The user might try to combine complex64 and float128.
                 warnings.warn(
-                    "Input dtypes not equal; casting to np.complex_!",
+                    "Input dtypes not equal; casting to np.complex128!",
                     InvalidMWarning)
-                dtype = np.dtype(np.complex_)
+                dtype = np.dtype(np.complex128)
             else:
-                warnings.warn("Input dtypes not equal; casting to np.float_!",
+                warnings.warn("Input dtypes not equal; casting to np.float64!",
                               InvalidMWarning)
-                dtype = np.dtype(np.float_)
+                dtype = np.dtype(np.float64)
     else:
         dtype = np.dtype(dtype)
 
     if dtype.kind not in ["c", "f"]:
-        warnings.warn("Input dtype is not float; casting to np.float_!",
+        warnings.warn("Input dtype is not float; casting to np.float64!",
                       InvalidMWarning)
-        dtype = np.dtype(np.float_)
+        dtype = np.dtype(np.float64)
 
     trace1 = np.array(v, dtype=dtype, copy=copy)
 


=====================================
pyproject.toml
=====================================
@@ -0,0 +1,47 @@
+[build-system]
+requires = [
+    # for version management
+    "setuptools>=45", "setuptools_scm[toml]>=6.2"
+]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "multipletau"
+authors = [
+    # In alphabetical order.
+    {name = "André Scholich"},
+    {name = "Alexandre Detiste"},
+    {name = "Chris Lamb"},
+    {name = "Pascal Hebbeker"},
+    {name = "Paul Müller"},
+]
+maintainers = [
+    {name = "Paul Müller", email="dev at craban.de"},
+]
+description = "A multiple-tau algorithm for Python/NumPy"
+readme = "README.rst"
+requires-python = ">=3.6, <4"
+keywords = ["multiple tau",
+            "fluorescence correlation spectroscopy"]
+classifiers = [
+    'Operating System :: OS Independent',
+    'Programming Language :: Python :: 3',
+    'Topic :: Scientific/Engineering :: Visualization',
+    'Intended Audience :: Science/Research',
+]
+license = {text = "BSD (3 clause)"}
+dependencies = [
+    "numpy>=1.5.1",
+  ]
+dynamic = ["version"]
+
+[project.urls]
+source = "https://github.com/FCS-analysis/multipletau"
+tracker = "https://github.com/FCS-analysis/multipletau/issues"
+documentation = "https://multipletau.readthedocs.io/en/stable/"
+changelog = "https://multipletau.readthedocs.io/en/stable/#changelog"
+
+
+[tool.setuptools_scm]
+write_to = "multipletau/_version.py"
+version_scheme = "post-release"


=====================================
setup.py deleted
=====================================
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-from os.path import exists, dirname, realpath
-from setuptools import setup
-import sys
-
-
-author = u"Paul Müller"
-authors = [author]
-description = 'A multiple-tau algorithm for Python/NumPy'
-name = 'multipletau'
-year = "2012"
-
-sys.path.insert(0, realpath(dirname(__file__))+"/"+name)
-from _version import version
-
-
-setup(
-    name=name,
-    author=author,
-    author_email='dev at craban.de',
-    url='https://github.com/FCS-analysis/multipletau',
-    version=version,
-    packages=[name],
-    package_dir={name: name},
-    license="BSD (3 clause)",
-    description=description,
-    long_description=open('README.rst').read() if exists('README.rst') else '',
-    install_requires=["numpy >= 1.5.1"],
-    keywords=["multiple tau", "fluorescence correlation spectroscopy"],
-    setup_requires=['pytest-runner'],
-    tests_require=["pytest"],
-    classifiers= [
-        'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 3',
-        'Topic :: Scientific/Engineering :: Visualization',
-        'Intended Audience :: Science/Research'
-        ],
-    platforms=['ALL']
-    )
-


=====================================
tests/requirements.txt
=====================================
@@ -0,0 +1 @@
+pytest
\ No newline at end of file


=====================================
tests/test_ac_cc.py
=====================================
@@ -29,7 +29,7 @@ def test_ac_cc_m():
                                       deltat=1,
                                       normalize=False,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res.append(r)
     res = np.concatenate(res)
 
@@ -40,7 +40,7 @@ def test_ac_cc_m():
                                   deltat=1,
                                   normalize=False,
                                   copy=True,
-                                  dtype=np.float_)
+                                  dtype=np.float64)
         rescc.append(r)
         # test minimal length of array
         multipletau.correlate(a=a[:2*m], v=a[:2*m],
@@ -48,7 +48,7 @@ def test_ac_cc_m():
                               deltat=1,
                               normalize=False,
                               copy=True,
-                              dtype=np.float_)
+                              dtype=np.float64)
 
     rescc = np.concatenate(rescc)
     assert np.all(res == rescc)
@@ -68,7 +68,7 @@ def test_ac_cc_normalize():
                                       deltat=1,
                                       normalize=True,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res.append(r)
 
     res = np.concatenate(res)
@@ -80,7 +80,7 @@ def test_ac_cc_normalize():
                                   deltat=1,
                                   normalize=True,
                                   copy=True,
-                                  dtype=np.float_)
+                                  dtype=np.float64)
         rescc.append(r)
 
     rescc = np.concatenate(rescc)
@@ -102,7 +102,7 @@ def test_ac_cc_simple():
                                   deltat=1,
                                   normalize=False,
                                   copy=True,
-                                  dtype=np.float_)
+                                  dtype=np.float64)
         rescc.append(r)
 
     rescc = np.concatenate(rescc)
@@ -114,7 +114,7 @@ def test_ac_cc_simple():
                                       deltat=1,
                                       normalize=False,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         resac.append(r)
 
     resac = np.concatenate(resac)


=====================================
tests/test_autocorrelate.py
=====================================
@@ -48,7 +48,7 @@ def test_ac_copy():
                                       deltat=1,
                                       normalize=True,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res1.append(r)
 
     res2 = []
@@ -58,7 +58,7 @@ def test_ac_copy():
                                       deltat=1,
                                       normalize=True,
                                       copy=False,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res2.append(r)
 
     # simple test if result is the same
@@ -85,7 +85,7 @@ def test_ac_dtype():
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
 
     ri = multipletau.autocorrelate(a=a,
                                    m=16,
@@ -102,9 +102,9 @@ def test_ac_dtype():
                                     dtype=None)
 
     assert ri.dtype == np.dtype(
-        np.float_), "if wrong dtype, dtype should default to np.float_"
+        np.float64), "if wrong dtype, dtype should default to np.float64"
     assert ri2.dtype == np.dtype(
-        np.float_), "if wrong dtype, dtype should default to np.float_"
+        np.float64), "if wrong dtype, dtype should default to np.float64"
     assert np.all(
         rf == ri), "result should be the same, because input us the same"
     assert np.all(
@@ -128,7 +128,7 @@ def test_ac_m():
                                       deltat=1,
                                       normalize=False,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res.append(r)
 
         # test minimal length of array
@@ -137,7 +137,7 @@ def test_ac_m():
                                   deltat=1,
                                   normalize=False,
                                   copy=True,
-                                  dtype=np.float_)
+                                  dtype=np.float64)
 
     res = np.concatenate(res)
     # np.save(os.path.dirname(__file__)
@@ -161,35 +161,35 @@ def test_ac_m_wrong():
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
 
     r2 = multipletau.autocorrelate(a=a,
                                    m=15,
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
 
     r3 = multipletau.autocorrelate(a=a,
                                    m=15.5,
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
 
     r4 = multipletau.autocorrelate(a=a,
                                    m=14.5,
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
 
     r5 = multipletau.autocorrelate(a=a,
                                    m=16.,
                                    deltat=1,
                                    normalize=True,
                                    copy=True,
-                                   dtype=np.float_)
+                                   dtype=np.float64)
     assert np.all(r1 == r2)
     assert np.all(r1 == r3)
     assert np.all(r1 == r4)
@@ -210,7 +210,7 @@ def test_ac_normalize():
                                       deltat=1,
                                       normalize=True,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res.append(r)
 
     res = np.concatenate(res)
@@ -235,7 +235,7 @@ def test_ac_simple():
                                       deltat=1,
                                       normalize=False,
                                       copy=True,
-                                      dtype=np.float_)
+                                      dtype=np.float64)
         res.append(r)
 
     res = np.concatenate(res)


=====================================
tests/test_basic.py
=====================================
@@ -7,7 +7,7 @@ from multipletau import autocorrelate, correlate
 
 
 def test_ac():
-    ist = autocorrelate(range(42), m=2, dtype=np.float_)
+    ist = autocorrelate(range(42), m=2, dtype=np.float64)
     soll = np.array([[0.00000000e+00,   2.38210000e+04],
                      [1.00000000e+00,   2.29600000e+04],
                      [2.00000000e+00,   2.21000000e+04],
@@ -17,7 +17,7 @@ def test_ac():
 
 
 def test_cc():
-    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float_)
+    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float64)
     soll = np.array([[0.00000000e+00,   2.46820000e+04],
                      [1.00000000e+00,   2.38210000e+04],
                      [2.00000000e+00,   2.29600000e+04],


=====================================
tests/test_compress.py
=====================================
@@ -7,7 +7,7 @@ from multipletau import autocorrelate, correlate
 
 
 def test_ac_compress_average():
-    ist = autocorrelate(range(42), m=2, dtype=np.float_, compress="average")
+    ist = autocorrelate(range(42), m=2, dtype=np.float64, compress="average")
     soll = np.array([[0.00000000e+00,   2.38210000e+04],
                      [1.00000000e+00,   2.29600000e+04],
                      [2.00000000e+00,   2.21000000e+04],
@@ -17,7 +17,7 @@ def test_ac_compress_average():
 
 
 def test_cc_compress_average():
-    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float_,
+    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float64,
                     compress="average")
     soll = np.array([[0.00000000e+00,   2.46820000e+04],
                      [1.00000000e+00,   2.38210000e+04],
@@ -28,7 +28,7 @@ def test_cc_compress_average():
 
 
 def test_ac_compress_first():
-    ist = autocorrelate(range(42), m=2, dtype=np.float_,
+    ist = autocorrelate(range(42), m=2, dtype=np.float64,
                         compress="first")
     soll = np.array([[0.00000e+00, 2.38210e+04],
                      [1.00000e+00, 2.29600e+04],
@@ -40,7 +40,7 @@ def test_ac_compress_first():
 
 
 def test_cc_compress_first():
-    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float_,
+    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float64,
                     compress="first")
     soll = np.array([[0.00000e+00, 2.46820e+04],
                      [1.00000e+00, 2.38210e+04],
@@ -52,7 +52,7 @@ def test_cc_compress_first():
 
 
 def test_ac_compress_second():
-    ist = autocorrelate(range(42), m=2, dtype=np.float_,
+    ist = autocorrelate(range(42), m=2, dtype=np.float64,
                         compress="second")
     soll = np.array([[0.00000e+00, 2.38210e+04],
                      [1.00000e+00, 2.29600e+04],
@@ -64,7 +64,7 @@ def test_ac_compress_second():
 
 
 def test_cc_compress_second():
-    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float_,
+    ist = correlate(range(42), range(1, 43), m=2, dtype=np.float64,
                     compress="second")
     soll = np.array([[0.00000e+00, 2.46820e+04],
                      [1.00000e+00, 2.38210e+04],


=====================================
tests/test_correlate.py
=====================================
@@ -84,7 +84,7 @@ def test_cc_dtype():
                                deltat=1,
                                normalize=True,
                                copy=True,
-                               dtype=np.float_)
+                               dtype=np.float64)
 
     ri = multipletau.correlate(a=a,
                                v=a,
@@ -103,9 +103,9 @@ def test_cc_dtype():
                                 dtype=None)
 
     assert ri.dtype == np.dtype(
-        np.float_), "if wrong dtype, dtype should default to np.float_"
+        np.float64), "if wrong dtype, dtype should default to np.float64"
     assert ri2.dtype == np.dtype(
-        np.float_), "if wrong dtype, dtype should default to np.float_"
+        np.float64), "if wrong dtype, dtype should default to np.float64"
     assert np.all(
         rf == ri), "result should be the same, because input us the same"
     assert np.all(
@@ -126,7 +126,7 @@ def test_cc_dtype2():
                                deltat=1,
                                normalize=True,
                                copy=True)
-    assert np.dtype(rf.dtype) == np.dtype(np.complex_)
+    assert np.dtype(rf.dtype) == np.dtype(np.complex128)
 
     rf2 = multipletau.correlate(a=a.real,
                                 v=np.array(a.imag, dtype=np.int_),
@@ -134,7 +134,7 @@ def test_cc_dtype2():
                                 deltat=1,
                                 normalize=True,
                                 copy=True)
-    assert np.dtype(rf2.dtype) == np.dtype(np.float_)
+    assert np.dtype(rf2.dtype) == np.dtype(np.float64)
 
 
 def test_cc_m():
@@ -155,7 +155,7 @@ def test_cc_m():
                                   deltat=1,
                                   normalize=False,
                                   copy=True,
-                                  dtype=np.complex_)
+                                  dtype=np.complex128)
         res.append(r)
 
         # test minimal length of array
@@ -165,7 +165,7 @@ def test_cc_m():
                               deltat=1,
                               normalize=False,
                               copy=True,
-                              dtype=np.complex_)
+                              dtype=np.complex128)
 
     res = np.concatenate(res)
     # np.save(os.path.dirname(__file__)
@@ -240,7 +240,7 @@ def test_cc_normalize():
                                   deltat=1,
                                   normalize=True,
                                   copy=True,
-                                  dtype=np.float_)
+                                  dtype=np.float64)
         res.append(r)
     res = np.concatenate(res)
     # np.save(os.path.dirname(__file__)
@@ -265,7 +265,7 @@ def test_cc_simple():
                                   deltat=1,
                                   normalize=False,
                                   copy=True,
-                                  dtype=np.complex_)
+                                  dtype=np.complex128)
         res.append(r)
     res = np.concatenate(res)
 
@@ -283,7 +283,7 @@ def test_cc_simple():
                                       deltat=1,
                                       normalize=False,
                                       copy=True,
-                                      dtype=np.complex_)
+                                      dtype=np.complex128)
         res2.append(r)
     res2 = np.concatenate(res2)
 


=====================================
tests/test_ref_numpy.py
=====================================
@@ -22,13 +22,13 @@ def test_corresponds_ac():
                                        m=m,
                                        copy=True,
                                        normalize=True,
-                                       dtype=np.float_)
+                                       dtype=np.float64)
 
     reslin = multipletau.correlate_numpy(a=1*a,
                                          v=1*a,
                                          copy=True,
                                          normalize=True,
-                                         dtype=np.float_)
+                                         dtype=np.float64)
 
     idx = np.array(restau[:, 0].real, dtype=int)[:m]
 
@@ -73,13 +73,13 @@ def test_corresponds_ac_first_loop():
                                        m=m,
                                        copy=True,
                                        normalize=False,
-                                       dtype=np.complex_)
+                                       dtype=np.complex128)
 
         reslin = multipletau.correlate_numpy(a=a,
                                              v=a.imag+1j*a.real,
                                              copy=True,
                                              normalize=False,
-                                             dtype=np.complex_)
+                                             dtype=np.complex128)
 
         idtau = np.where(restau[:, 0] == m+2)[0][0]
         tau3 = restau[idtau, 1]  # m+1 initial bins
@@ -102,13 +102,13 @@ def test_corresponds_ac_nonormalize():
                                        m=m,
                                        copy=True,
                                        normalize=False,
-                                       dtype=np.float_)
+                                       dtype=np.float64)
 
     reslin = multipletau.correlate_numpy(a=1*a,
                                          v=1*a,
                                          copy=True,
                                          normalize=False,
-                                         dtype=np.float_)
+                                         dtype=np.float64)
 
     idx = np.array(restau[:, 0].real, dtype=int)[:m+1]
 
@@ -128,13 +128,13 @@ def test_corresponds_cc():
                                    m=m,
                                    copy=True,
                                    normalize=True,
-                                   dtype=np.complex_)
+                                   dtype=np.complex128)
 
     reslin = multipletau.correlate_numpy(a=a,
                                          v=a.imag+1j*a.real,
                                          copy=True,
                                          normalize=True,
-                                         dtype=np.complex_)
+                                         dtype=np.complex128)
 
     idx = np.array(restau[:, 0].real, dtype=int)[:m+1]
 
@@ -154,13 +154,13 @@ def test_corresponds_cc_nonormalize():
                                    m=m,
                                    copy=True,
                                    normalize=False,
-                                   dtype=np.complex_)
+                                   dtype=np.complex128)
 
     reslin = multipletau.correlate_numpy(a=a,
                                          v=a.imag+1j*a.real,
                                          copy=True,
                                          normalize=False,
-                                         dtype=np.complex_)
+                                         dtype=np.complex128)
 
     idx = np.array(restau[:, 0].real, dtype=int)[:m+1]
 


=====================================
tests/test_ret_sum.py
=====================================
@@ -7,7 +7,7 @@ from multipletau import autocorrelate, correlate
 
 
 def test_ac_return_sum():
-    ist, ist_count = autocorrelate(range(42), m=2, dtype=np.float_,
+    ist, ist_count = autocorrelate(range(42), m=2, dtype=np.float64,
                                    ret_sum=True)
     soll = np.array([[0.000000e+00, 2.382100e+04],
                      [1.000000e+00, 2.296000e+04],
@@ -20,7 +20,7 @@ def test_ac_return_sum():
 
 
 def test_cc_compress_average():
-    ist, ist_count = correlate(range(42), range(1, 43), m=2, dtype=np.float_,
+    ist, ist_count = correlate(range(42), range(1, 43), m=2, dtype=np.float64,
                                ret_sum=True)
     soll = np.array([[0.000000e+00, 2.468200e+04],
                      [1.000000e+00, 2.382100e+04],



View it on GitLab: https://salsa.debian.org/python-team/packages/python-multipletau/-/commit/04e5ef804917708d7b2afb62d2f6b7c10fd73c62

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/python-team/packages/python-multipletau/-/commit/04e5ef804917708d7b2afb62d2f6b7c10fd73c62
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240629/368b47b9/attachment-0001.htm>


More information about the debian-med-commit mailing list