Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7b3a01c
chore(boilerplate): canonicalising
mwsis Nov 18, 2026
55936c5
chore(boilerplate): canonicalising
mwsis Nov 18, 2026
efdd90d
fix: `enable_tracing()` now returns previous enable value
mwsis Nov 19, 2026
a983f1f
fix: `set_program_name()` now returns previous name value
mwsis Nov 19, 2026
499363d
docs(diagnosticism.python): correct historical changelog names
mwsis Nov 19, 2026
3da0b66
fix(diagnosticism.python): report the module-level trace call line
mwsis Nov 19, 2026
d7c256b
fix(diagnosticism.python): forward kwargs from func and line
mwsis Nov 19, 2026
e3a8ad1
fix(diagnosticism.python): stringify log messages
mwsis Nov 19, 2026
d462a27
fix(diagnosticism.python): export the DEBUG severity alias
mwsis Nov 19, 2026
a60ff5a
fix(diagnosticism.python): keep dbg file out of traced values
mwsis Nov 19, 2026
2b18b18
feat(diagnosticism.python): accept a callable log filter
mwsis Nov 19, 2026
ed15e1f
ci(diagnosticism.python): test on macOS and Windows
mwsis Nov 19, 2026
250fd49
ci(diagnosticism.python): run Python 3.8 and 3.9 on Ubuntu 22.04
mwsis Nov 19, 2026
0da971f
docs(diagnosticism.python): put README constants under the right API
mwsis Nov 19, 2026
0bc1a7e
fix(diagnosticism.python): filter warn and accept callable lines
mwsis Nov 19, 2026
27f7d4b
test(diagnosticism.python): cover abort, basename, filter, threads
mwsis Nov 19, 2026
4440f81
fix(diagnosticism.python): provide trace decorators on 2.7 and 3.8
mwsis Nov 19, 2026
a1d8986
fix(diagnosticism.python): repair the tracefunc decorator
mwsis Nov 20, 2026
a018398
chore(diagnosticism.python): select Bugbear in Ruff
mwsis Nov 20, 2026
9f0617c
fix(diagnosticism.python): use a monotonic clock in the timing fallback
mwsis Nov 20, 2026
b0156f8
fix(diagnosticism.python): keep a single package version string
mwsis Nov 20, 2026
868c553
docs(diagnosticism.python): add INSTALL.md and FAQ.md
mwsis Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the sdist/wheel on a range of Python versions.
#
# Created: 14th September 2026
# Updated: 14th September 2026
# Updated: 20th November 2026
#

name: Python package
Expand Down Expand Up @@ -51,10 +51,14 @@ jobs:

build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
Expand All @@ -63,6 +67,23 @@ jobs:
- "3.12"
- "3.13"
- "3.14"
# CPython 3.8 and 3.9 are absent from Ubuntu 26.04 and from
# arm64 macOS. Those versions run on Ubuntu 22.04 and on
# Windows.
exclude:
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.9"
include:
- os: ubuntu-22.04
python-version: "3.8"
- os: ubuntu-22.04
python-version: "3.9"

steps:
- name: Checking out code
Expand All @@ -88,7 +109,7 @@ jobs:
python -m pip install build
python -m build
python -m pip install dist/diagnosticism-*.whl
python -c "import diagnosticism; assert diagnosticism.__version__ == '0.18.1'; print(diagnosticism.__version__)"
python -c "import diagnosticism; from importlib.metadata import version; got = version('diagnosticism'); assert got == diagnosticism.__version__, got; print(got)"

build-py27:

Expand Down
110 changes: 74 additions & 36 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
# Diagnosticism.Python - Changes <!-- omit in toc -->


## 0.18.2 - 20th November 2026

* fixes:
* `enable_tracing()` now returns the previous enable value;
* `set_program_name()` now returns the previous program name;
* module-level `trace()` now reports the call line;
* `func()` and `line()` now forward keyword arguments to the caller-location lookup;
* `log()` now stringifies a non-string message;
* `DEBUG` is now part of the public API, as an alias of `DEBUG5`;
* `dbg()` and `dbgfl()` no longer trace the consumed `file` argument;
* `set_log_filter()` now accepts a callable;
* `warn()` now honours the log filter and accepts a callable message;
* `@tracefunc` and `@asynctracefunc` are available on Python 2.7 and 3.8+;
* `@tracefunc` keeps the wrapped name and docstring, accepts `file`, awaits coroutines, and does not treat `staticmethod` or `classmethod` as instance methods;
* the `perf_counter_ns` fallback uses `time.monotonic()` when that function exists;
* performance:
* added **tests/performance/bench_logging.py** for a manual timing run;
* lint:
* **Ruff** also selects Bugbear; `E501` stays ignored, and `B904` stays ignored because `raise ... from` is not valid on Python 2.7;
* inline type annotations and **py.typed** stay out while the package is parsed by Python 2.7;
* tests:
* removed the empty **tests/stub.py**;
* covered `abort()` process exit, Windows basename, a cleared log filter, two logging threads, and `@asynctracefunc`;
* continuous integration:
* tests run on macOS, Ubuntu, and Windows;
* Python 3.8 and 3.9 run on Ubuntu 22.04;
* documentation and boilerplate:
* canonicalising **CHANGES.md**;
* canonicalising **NEWS.md**;
* corrected historical notes: `parse_verbosity()` in 0.9.0, and Python 3.14 compatibility in 0.17.0;
* **README.md** constant catalogs now sit under the matching API headings;
* added **INSTALL.md** and **FAQ.md**;
* older changelog bullets now end with `;`;
* packaging:
* `__version__` in **diagnosticism/__init__.py** is the only version string;
* removed `universal = 1` from **setup.cfg**;


## 0.18.1 - 14th September 2026

* packaging, documentation, and CI modernisation (PEP 621 hybrid, canonical CI, **ruff**, helper scripts);


## 0.18.0 - 6th August 2026

* + added `function()` alias for `func()`;
* added `function()` alias for `func()`;

## 0.17.0 - 10th July 2026

* added `DOOMGram::to_mmm()` and `DOOMGram::to_nmmm()` — compact min/mean/max duration summaries using `nanoseconds_to_string()`;
* updated compatibility to Python 3.18;
* updated compatibility to Python 3.14;


## 0.16.0 - 27th June 2026
Expand Down Expand Up @@ -80,131 +118,131 @@

## 0.11.1 - 19th July 2025

* ~ fix to `warn()` (when logging is enabled);
* fix to `warn()` (when logging is enabled);


## 0.11.0 - 18th July 2025

* ~ `enable_logging()` now also takes 2-parameters (environment variable name(s), default value) as well as 1-parameter (is_enabled);
* ~ `enable_tracing()` now also takes 2-parameters (environment variable name(s), default value) as well as 1-parameter (is_enabled);
* `enable_logging()` now also takes 2-parameters (environment variable name(s), default value) as well as 1-parameter (is_enabled);
* `enable_tracing()` now also takes 2-parameters (environment variable name(s), default value) as well as 1-parameter (is_enabled);


## 0.10.1 - 17th July 2025

* ~ fixed package error;
* fixed package error;


## 0.10.0 - 14th July 2025

* + added `file()`, `line()`, `func()`, `fileline()`, `filelinefunc()`;
* + added `dbg()`, `dbgfl()`;
* added `file()`, `line()`, `func()`, `fileline()`, `filelinefunc()`;
* added `dbg()`, `dbgfl()`;


## 0.9.1 - 6h July 2025
## 0.9.1 - 6th July 2025

* ~ fixed erroneous behaviour of `trace()` when used in module context
* fixed erroneous behaviour of `trace()` when used in module context;


## 0.9.0 - 20th August 2024

* + added `parse_severity()`
* added `parse_verbosity()`;


## 0.8.0 - 17th August 2024

* + added `is_severity_logged()`
* added `is_severity_logged()`;


## 0.7.3 - 16th August 2024

* ~ fixed filter logic
* fixed filter logic;


## 0.7.2 - 16th August 2024

* ~ ANSI sequences on Windows 11+ (from build 22000 onwards)
* ANSI sequences on Windows 11+ (from build 22000 onwards);


## 0.7.1 - 15th August 2024

* + added missing `set_log_filter` export to top-level module
* ~ ANSI sequences on Windows 10+
* added missing `set_log_filter` export to top-level module;
* ANSI sequences on Windows 10+;


## 0.7.0 - 14th August 2024

* ~ numerous changes to module names, including `diagnosticism.log` => `diagnosticism.logging`, to avoid name conflicts with functions (such as `log()` and `trace()`);
* ~ scripts now all assume **python3** executable, rather than **python**;
* numerous changes to module names, including `diagnosticism.log` => `diagnosticism.logging`, to avoid name conflicts with functions (such as `log()` and `trace()`);
* scripts now all assume **python3** executable, rather than **python**;


## 0.6.1 - 28th August 2020

* ~ fixed recently introduced defect in ``enable_tracing()``
* fixed recently introduced defect in ``enable_tracing()``;


## 0.6.0 - 28th August 2020

* + added ``set_log_filter()``, which takes a severity-level as a threshold or a dictionary that controls emission of individual severity-levels
* added ``set_log_filter()``, which takes a severity-level as a threshold or a dictionary that controls emission of individual severity-levels;


## 0.5.1 - 28th August 2020

* + added more documentation and parameter assertions
* added more documentation and parameter assertions;


## 0.5.0 - 13th August 2020

* ~ ``log()`` now can take a message lamba as well as a message string
* ``log()`` now can take a message lamba as well as a message string;


## 0.4.1 - 13th August 2020

* + added ``warn()`` (as an analogue of Ruby's ``Kernel#warn()``)
* + added ``conrep.set_default_usage_prompt()`` to allow a default usage prompt for ``abort()``
* ~ general improvements to documentation
* added ``warn()`` (as an analogue of Ruby's ``Kernel#warn()``);
* added ``conrep.set_default_usage_prompt()`` to allow a default usage prompt for ``abort()``;
* general improvements to documentation;


## 0.4.0 - 11th July 2020

* ~ changed project name from **diagnosticism.Python** to **Diagnosticism.Python**
* + added **tests/test_conrep.py**
* changed project name from **diagnosticism.Python** to **Diagnosticism.Python**;
* added **tests/test_conrep.py**;


## 0.3.1 - 8th July 2019

* ~ ``abort()`` now applies ``str()`` on ``message`` param, to allow argument types such as exceptions
* ``abort()`` now applies ``str()`` on ``message`` param, to allow argument types such as exceptions;


## 0.3.0 - 7th July 2019

* + added module ``diagnosticism.log``, with members ``enable_logging()``, ``is_logging_enabled()``, and ``log()``
* + added module ``diagnosticism.severity``, with members ``VIOLATION``, ``ALERT``, ... ``DEBUG5``, ``TRACE``
* added module ``diagnosticism.log``, with members ``enable_logging()``, ``is_logging_enabled()``, and ``log()``;
* added module ``diagnosticism.severity``, with members ``VIOLATION``, ``ALERT``, ... ``DEBUG5``, ``TRACE``;


## 0.2.1 - 7th July 2019

* ~ fixed missing name ``report`` exported at top-level
* fixed missing name ``report`` exported at top-level;


## 0.2.0 - 7th July 2019

* + added module ``diagnosticism.program_name``, with members ``get_program_name()`` and ``set_program_name()``
* + added module ``diagnosticism.conrep``, with members ``abort()`` and ``report()``
* added module ``diagnosticism.program_name``, with members ``get_program_name()`` and ``set_program_name()``;
* added module ``diagnosticism.conrep``, with members ``abort()`` and ``report()``;


## 0.1.2 - 12th June 2019

* ~ enhancing ``trace()`` to handle methods elegantly
* enhancing ``trace()`` to handle methods elegantly;


## 0.1.1 - 11th June 2019

* + ``trace()``
* ``trace()``;


## 0.0.1 - 12th February 2019

* + project boilerplate
* project boilerplate;


<!-- ########################### end of file ########################### -->
Expand Down
36 changes: 36 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Diagnosticism.Python - FAQ <!-- omit in toc -->

Further questions are welcome on the
[Issues](https://github.com/synesissoftware/Diagnosticism.Python/issues)
forum.


## Table of Contents <!-- omit in toc -->

- [Q1: "How do I install this library?"](#q1-how-do-i-install-this-library)
- [Q2: "Which Python versions are supported?"](#q2-which-python-versions-are-supported)
- [Q3: "What else do I need to install?"](#q3-what-else-do-i-need-to-install)


## Q1: "How do I install this library?"

Install via **pip**:

```
pip3 install diagnosticism
```

See [INSTALL.md](./INSTALL.md) for a source checkout and a short usage example.


## Q2: "Which Python versions are supported?"

**Python 2.7** and **Python 3.8+**. The library is not supported on Python 3.0 through 3.7.


## Q3: "What else do I need to install?"

Nothing for normal use. The unit tests on **Python 2.7** need **mock**.


<!-- ########################### end of file ########################### -->
41 changes: 41 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Diagnosticism.Python - Installation and Use <!-- omit in toc -->


## Table of Contents <!-- omit in toc -->

- [Install from PyPI](#install-from-pypi)
- [From a source checkout](#from-a-source-checkout)
- [Using the library](#using-the-library)


## Install from PyPI

```
pip3 install diagnosticism
```

**Diagnosticism.Python** runs on **Python 2.7** and **Python 3.8+**. It has no runtime dependencies.


## From a source checkout

```
python3 -m pip install -e .
./run_all_unit_tests.sh
```

On **Python 2.7** the unit tests need **mock**, and are run with `python tests/run_unittest.py`.


## Using the library

```Python
import diagnosticism
import diagnosticism.severity as sev

diagnosticism.enable_logging(True)
diagnosticism.log(sev.INFO, "hello")
```


<!-- ########################### end of file ########################### -->
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include AUTHORS.md CHANGES.md EXAMPLES.md LICENSE NEWS.md README.md TODO.md
include AUTHORS.md CHANGES.md EXAMPLES.md FAQ.md INSTALL.md LICENSE NEWS.md README.md TODO.md
recursive-include examples *.py
recursive-include tests *.py
Loading
Loading