[med-svn] [Git][med-team/python-scitrack][master] 9 commits: d/watch: Fix watch regex

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Sun Aug 8 20:38:56 BST 2021



Nilesh Patra pushed to branch master at Debian Med / python-scitrack


Commits:
33dea32f by Nilesh Patra at 2021-08-09T00:43:16+05:30
d/watch: Fix watch regex

- - - - -
ff1dc2ab by Nilesh Patra at 2021-08-09T00:44:20+05:30
New upstream version 2021.5.3
- - - - -
2eace5f3 by Nilesh Patra at 2021-08-09T00:44:21+05:30
Update upstream source from tag 'upstream/2021.5.3'

Update to upstream version '2021.5.3'
with Debian dir fcee547153b34840afff1acd79b9d5f1f4b8ad14
- - - - -
166bcfb1 by Nilesh Patra at 2021-08-09T00:50:14+05:30
Upstream changed build system to flit

- - - - -
da905035 by Nilesh Patra at 2021-08-09T00:50:32+05:30
Declare compliance with policy 4.5.1

- - - - -
726d004c by Nilesh Patra at 2021-08-09T00:54:49+05:30
d/control: Annotate python3-numpy and python3-pytest with <!nocheck>

- - - - -
80849f1a by Nilesh Patra at 2021-08-09T01:00:58+05:30
Copy tests dir from source, test with installed package

- - - - -
57e21ca6 by Nilesh Patra at 2021-08-09T01:01:51+05:30
Add "Testsuite: autopkgtest-pkg-python"

- - - - -
f945334a by Nilesh Patra at 2021-08-09T01:06:44+05:30
Interim changelog entry

- - - - -


15 changed files:

- .github/workflows/testing_develop.yml
- .hgtags
- README.rst
- debian/changelog
- debian/control
- debian/rules
- debian/tests/control
- debian/tests/run-unit-test
- debian/watch
- pyproject.toml
- − setup.cfg
- − setup.py
- src/scitrack/__init__.py
- tests/test_logging.py
- tox.ini


Changes:

=====================================
.github/workflows/testing_develop.yml
=====================================
@@ -14,7 +14,7 @@ jobs:
     strategy:
       matrix:
         os: [windows-latest, macos-latest, ubuntu-latest]
-        python-version: [3.6, 3.7, 3.8]
+        python-version: [3.6, 3.7, 3.8, 3.9]
 
     steps:
       - uses: "actions/checkout at v2"
@@ -25,13 +25,13 @@ jobs:
         run: |
           python -VV
           python -m site
-          python -m pip install --upgrade pip setuptools wheel
+          python -m pip install --upgrade pip setuptools wheel flit
           python -m pip install --upgrade tox tox-gh-actions 
 
       - name: "Run tox targets for ${{ matrix.python-version }}"
         run: "python -m tox"
 
-      - name: Upload py3.8 coverage to Codecov
+      - name: Upload coverage to Codecov
         uses: codecov/codecov-action at v1
         with:
           file: ./tests/junit-*.xml


=====================================
.hgtags
=====================================
@@ -2,3 +2,4 @@
 402b7daea661f3904f85f6f248f46c8d9f588704 0.1.7
 038183f48645c7ba0417fa98946689f86efca803 0.1.8
 d8aa7076747c991858750c0ecfa5915c6d421d5f 0.1.8.1
+d223af41764757c47b24f6594a4597818f18e785 2020.6.5


=====================================
README.rst
=====================================
@@ -66,6 +66,10 @@ Creating the logger. Setting ``create_dir=True`` means on creation of the logfil
 
 The last assignment triggers creation of ``somedir/some_path.log``.
 
+.. warning::
+
+    Once set, a loggers ``.log_file_path`` cannot be changed.
+
 ******************************************
 Capturing a programs arguments and options
 ******************************************
@@ -74,6 +78,10 @@ Capturing a programs arguments and options
 
 Here's one approach to incorporating ``scitrack`` into a command line application built using the ``click`` `command line interface library <http://click.pocoo.org/>`_. Below we create a simple ``click`` app and capture the required and optional argument values.
 
+.. note::
+
+    ``LOGGER.log_args()`` should be called immediately after the function definition, or after "true" default values have been configured.
+
 .. code:: python
 
     import click
@@ -137,4 +145,20 @@ Reporting issues
 
 Use the project `issue tracker <https://github.com/HuttleyLab/scitrack/issues>`_.
 
+**************
+For Developers
+**************
+
+We use flit_ for package building. Having cloned the repository onto your machine. Install ``flit``::
+
+$ python3 -m pip install flit
+
+Do a developer install of ``scitrack`` using flit as::
+
+$ cd path/to/cloned/repo
+$ flit install -s --python `which python`
+
+.. note:: This installs a symlink into ``site-packages`` of the python identified by ``which python``.
+
 .. [1] The hexdigest serves as a unique signature of a files contents.
+.. _flit: https://flit.readthedocs.io/en/latest/
\ No newline at end of file


=====================================
debian/changelog
=====================================
@@ -1,3 +1,21 @@
+python-scitrack (2021.5.3-1) UNRELEASED; urgency=medium
+
+  * New upstream version 2021.5.3
+  * d/watch: Fix watch regex
+  * d/control: Declare compliance with policy 4.5.1
+  * Upstream changed build system to flit
+    - d/rules: Declare PYBUILD_SYSTEM=flit
+    - d/control: Add B-D on flit
+  * Improve testing
+    - d/control: Annotate python3-numpy and python3-pytest
+      with <!nocheck>
+    - d/tests/run-unit-test: Copy tests dir from source, test
+      with installed package rather on the source directory where
+      upstream files are present
+    - d/control: Add "Testsuite: autopkgtest-pkg-python"
+
+ -- Nilesh Patra <nilesh at debian.org>  Mon, 09 Aug 2021 01:03:39 +0530
+
 python-scitrack (2020.6.5-1) unstable; urgency=medium
 
   * New upstream version 2020.6.5


=====================================
debian/control
=====================================
@@ -2,14 +2,16 @@ Source: python-scitrack
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Andreas Tille <tille at debian.org>, Nilesh Patra <nilesh at debian.org>
 Section: science
+Testsuite: autopkgtest-pkg-python
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                dh-python,
+               flit,
                python3-all,
                python3-setuptools,
-               python3-pytest,
-               python3-numpy
-Standards-Version: 4.5.0
+               python3-pytest <!nocheck>,
+               python3-numpy <!nocheck>
+Standards-Version: 4.5.1
 Vcs-Browser: https://salsa.debian.org/med-team/python-scitrack
 Vcs-Git: https://salsa.debian.org/med-team/python-scitrack.git
 Homepage: https://github.com/HuttleyLab/scitrack


=====================================
debian/rules
=====================================
@@ -3,6 +3,7 @@
 # DH_VERBOSE := 1
 
 export PYBUILD_NAME=scitrack
+export PYBUILD_SYSTEM=flit
 
 %:
 	dh $@ --with python3 --buildsystem=pybuild


=====================================
debian/tests/control
=====================================
@@ -1,4 +1,3 @@
 Tests: run-unit-test
 Depends: @, python3-all, python3-pytest, python3-numpy
 Restrictions: allow-stderr
-


=====================================
debian/tests/run-unit-test
=====================================
@@ -1,8 +1,16 @@
 #!/bin/bash
 set -e
+CUR_DIR=`pwd`
 
-for py in $(py3versions -r 2> /dev/null)
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cd "${AUTOPKGTEST_TMP}"
+cp -a ${CUR_DIR}/tests .
+
+for py in $(py3versions -s 2> /dev/null)
 do
 	$py -m pytest -v
 done
-


=====================================
debian/watch
=====================================
@@ -1,3 +1,3 @@
 version=4
 
-https://github.com/HuttleyLab/scitrack/releases .*/archive/v?@ANY_VERSION@@ARCHIVE_EXT@
+https://github.com/HuttleyLab/scitrack/releases .*/archive/.*/v?@ANY_VERSION@@ARCHIVE_EXT@


=====================================
pyproject.toml
=====================================
@@ -1,6 +1,46 @@
 [build-system]
-requires = ["setuptools>=40.6.0", "wheel"]
-build-backend = "setuptools.build_meta"
+requires = ["flit_core >=2,<4"]
+build-backend = "flit_core.buildapi"
+
+[tool.flit.metadata]
+module = "scitrack"
+author = "Gavin Huttley"
+author-email = "Gavin.Huttley at anu.edu.au"
+home-page = "https://github.com/HuttleyLab/scitrack"
+license = "BSD-3"
+description-file = "README.rst"
+keywords = "science, logging"
+classifiers = [
+    "Development Status :: 4 - Beta",
+    "Intended Audience :: Science/Research",
+    "License :: OSI Approved :: BSD License",
+    "Topic :: Scientific/Engineering :: Bio-Informatics",
+    "Topic :: Software Development :: Libraries :: Python Modules",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python :: 3.6",
+    "Programming Language :: Python :: 3.7",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
+    ]
+requires-python = ">=3.6"
+
+[tool.flit.sdist]
+include = ["src/*", "pyproject.toml", "*.rst"]
+exclude = ["*.xml"]
+
+
+[tool.flit.metadata.urls]
+Documentation = "https://github.com/HuttleyLab/scitrack"
+"Bug Tracker" = "https://github.com/HuttleyLab/scitrack/issues"
+"Source Code" = "https://github.com/HuttleyLab/scitrack"
+
+[tool.flit.metadata.requires-extra]
+test = [
+    "black",
+    "isort",
+    "pytest",
+    "pytest-cov",
+    "tox"]
 
 [tool.black]
 line-length = 88


=====================================
setup.cfg deleted
=====================================
@@ -1,2 +0,0 @@
-[bdist_wheel]
-universal = 1


=====================================
setup.py deleted
=====================================
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-import pathlib
-import sys
-
-from setuptools import find_packages, setup
-
-
-__author__ = "Gavin Huttley"
-__copyright__ = "Copyright 2016-2020, Gavin Huttley"
-__credits__ = ["Gavin Huttley"]
-__license__ = "BSD"
-__version__ = "2020.6.5"
-__maintainer__ = "Gavin Huttley"
-__email__ = "Gavin.Huttley at anu.edu.au"
-__status__ = "Development"
-
-if sys.version_info < (3, 6):
-    py_version = ".".join([str(n) for n in sys.version_info])
-    raise RuntimeError(
-        "Python-3.6 or greater is required, Python-%s used." % py_version
-    )
-
-PROJECT_URLS = {
-    "Documentation": "https://github.com/HuttleyLab/scitrack",
-    "Bug Tracker": "https://github.com/HuttleyLab/scitrack/issues",
-    "Source Code": "https://github.com/HuttleyLab/scitrack",
-}
-
-short_description = "scitrack"
-
-readme_path = pathlib.Path(__file__).parent / "README.rst"
-
-long_description = readme_path.read_text()
-
-PACKAGE_DIR = "src"
-
-setup(
-    name="scitrack",
-    version=__version__,
-    author="Gavin Huttley",
-    author_email="gavin.huttley at anu.edu.au",
-    description=short_description,
-    long_description=long_description,
-    long_description_content_type="text/x-rst",
-    platforms=["any"],
-    license=[__license__],
-    keywords=["science", "logging"],
-    classifiers=[
-        "Development Status :: 4 - Beta",
-        "Intended Audience :: Science/Research",
-        "License :: OSI Approved :: BSD License",
-        "Topic :: Scientific/Engineering :: Bio-Informatics",
-        "Topic :: Software Development :: Libraries :: Python Modules",
-        "Operating System :: OS Independent",
-        "Programming Language :: Python :: 3.6",
-        "Programming Language :: Python :: 3.7",
-        "Programming Language :: Python :: 3.8",
-    ],
-    packages=find_packages(where="src"),
-    package_dir={"": PACKAGE_DIR},
-    url="https://github.com/HuttleyLab/scitrack",
-    project_urls=PROJECT_URLS,
-)


=====================================
src/scitrack/__init__.py
=====================================
@@ -1,3 +1,6 @@
+"""
+SciTrack provides basic logging capabilities to track scientific computations.
+"""
 import hashlib
 import importlib
 import inspect
@@ -11,10 +14,10 @@ from getpass import getuser
 
 
 __author__ = "Gavin Huttley"
-__copyright__ = "Copyright 2016-2020, Gavin Huttley"
+__copyright__ = "Copyright 2016-2021, Gavin Huttley"
 __credits__ = ["Gavin Huttley"]
 __license__ = "BSD"
-__version__ = "2020.6.5"
+__version__ = "2021.5.3"
 __maintainer__ = "Gavin Huttley"
 __email__ = "Gavin.Huttley at anu.edu.au"
 __status__ = "Development"
@@ -112,6 +115,11 @@ class CachingLogger(object):
     @log_file_path.setter
     def log_file_path(self, path):
         """set the log file path and then dump cached log messages"""
+        if self._log_file_path is not None:
+            raise AttributeError(
+                f"log_file_path already defined as {self._log_file_path}"
+            )
+
         path = abspath(path)
         if self.create_dir:
             dirname = os.path.dirname(path)
@@ -282,11 +290,12 @@ def get_text_hexdigest(data):
     'rb' versus 'r' modes.
     """
     data_class = data.__class__
+    # fmt: off
     if data_class in ("".__class__, u"".__class__):
         data = data.encode("utf-8")
     elif data.__class__ != b"".__class__:
         raise TypeError("can only checksum string, unicode or bytes data")
-
+    # fmt: on
     md5 = hashlib.md5()
     md5.update(data)
     return md5.hexdigest()


=====================================
tests/test_logging.py
=====================================
@@ -18,10 +18,10 @@ from scitrack import (
 
 
 __author__ = "Gavin Huttley"
-__copyright__ = "Copyright 2016-2020, Gavin Huttley"
+__copyright__ = "Copyright 2016-2021, Gavin Huttley"
 __credits__ = ["Gavin Huttley"]
 __license__ = "BSD"
-__version__ = "2020.6.5"
+__version__ = "2021.5.3"
 __maintainer__ = "Gavin Huttley"
 __email__ = "Gavin.Huttley at anu.edu.au"
 __status__ = "Development"
@@ -47,6 +47,18 @@ def test_creates_path():
         pass
 
 
+def test_set_path_if_exists():
+    """cannot change an existing logging path"""
+    with TemporaryDirectory(dir=".") as dirname:
+        dirname = Path(dirname)
+        LOGGER = CachingLogger(create_dir=True)
+        LOGGER.log_file_path = dirname / LOGFILE_NAME
+        LOGGER.input_file(TEST_ROOTDIR / "sample-lf.fasta")
+        with pytest.raises(AttributeError):
+            LOGGER.log_file_path = dirname / "invalid.log"
+        LOGGER.shutdown()
+
+
 def test_tracks_args():
     """details on host, python version should be present in log"""
     LOGGER = CachingLogger(create_dir=True)


=====================================
tox.ini
=====================================
@@ -1,5 +1,6 @@
 [tox]
-envlist = py36, py37, py38
+isolated_build = True
+envlist = py36, py37, py38, py39
 
 [testenv]
 passenv = *
@@ -8,6 +9,12 @@ deps = numpy
        pytest
        pytest-cov
 
+[testenv:py39]
+changedir = tests
+basepython = python3.9
+commands =
+    pytest --junitxml=junit-{envname}.xml --cov-report xml --cov=scitrack
+
 [testenv:py38]
 changedir = tests
 basepython = python3.8
@@ -31,3 +38,4 @@ python =
     3.6: py36
     3.7: py37
     3.8: py38
+    3.9: py39



View it on GitLab: https://salsa.debian.org/med-team/python-scitrack/-/compare/e44ae3eaed83fdead1ba1f72c59421b6e4e4331b...f945334a33fcb84367807af5c57454485e504f11

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-scitrack/-/compare/e44ae3eaed83fdead1ba1f72c59421b6e4e4331b...f945334a33fcb84367807af5c57454485e504f11
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/20210808/8488f121/attachment-0001.htm>


More information about the debian-med-commit mailing list