Registry / devops / tendo
library0.3.0pypypi✓ verified 85d ago

Tendo is a Python library that extends core functionality, providing tools such as transparent Unicode support for file operations, a `tee` implementation for concurrent output, and an improved `execfile` function. Its prominent `singleton` module ensures that only a single instance of a Python script or application can run at a time on a given machine, leveraging lock files for process management. As of version 0.4.0, it requires Python 3.8+ and uses `SingleInstance` as a context manager.

pip install tendo
INSTALL
IMPORT
SIG · TENDO
T
tendo
devopspythonv0.3.0
Install
1.6s avg
Import
28ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.029s · 18.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.027s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SingleInstance
from tendo.singleton import SingleInstance
from tendo import singleton; me = singleton.SingleInstance()
As of v0.4.0, SingleInstance is primarily designed to be used as a context manager.

This quickstart demonstrates how to use `tendo.singleton.SingleInstance` as a context manager to ensure only one instance of a Python script runs at a time. If a second instance attempts to acquire the lock, a `SingleInstanceException` is raised.

import time import os from tendo.singleton import SingleInstance, SingleInstanceException # To demonstrate, use a unique flavor_id for this quickstart example. # In a real application, you might use a consistent string like 'my_app_name' # or rely on the default (based on script path) if appropriate. try: # Acquire a single instance lock. If another instance is running, an exception is raised. with SingleInstance(flavor_id="my_tendo_quickstart_app"): print("Application started. This instance is the only one running.") print("Lock file location (typically in temp directory): .tendo-my_tendo_quickstart_app.lock") print("Sleeping for 10 seconds. Try running this script again in another terminal to see the SingleInstanceException.") time.sleep(10) print("Application finished.") except SingleInstanceException: print("Another instance of this application with the same flavor_id is already running.") print("Exiting as only one instance is allowed.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingThe `tendo.singleton.SingleInstance` class was refactored in v0.4.0 to be a context manager. Direct instantiation without `with` is no longer the recommended or functional pattern.
fix
Update your code to use `with SingleInstance():` instead of `me = SingleInstance()`.
affects: 0.4.0+
breakingThe minimum required Python version for `tendo` was raised from Python 3.6 to Python 3.8.
fix
Ensure your Python environment is version 3.8 or newer before installing or upgrading to `tendo` v0.4.0+.
affects: 0.4.0+
deprecatedOlder versions of `tendo` (prior to v0.3.0) used the deprecated 'U' mode in `open()` calls, which was removed in Python 3.9 and would cause errors.
fix
Upgrade `tendo` to version 0.3.0 or higher. If unable to upgrade, avoid using Python 3.9+ with older `tendo` versions.
affects: <0.3.0 (when used with Python 3.9+)
Errors
Common errors & fixes
ImportError: import of 'sys' halted; None in sys.modules
This error, often occurring during script shutdown, indicates that the `sys` module was garbage collected before `tendo.singleton.SingleInstance.__del__` could clean up its resources, particularly in Python 3.4+ with older `tendo` versions.
fix
Upgrade `tendo` to the latest version. The refactoring to use a context manager in v0.4.0 and other internal improvements address such shutdown issues more robustly.
SingleInstanceException: Another instance is already running, quitting.
You are attempting to run a script that uses `tendo.singleton.SingleInstance` (with a specific `flavor_id` or default lock based on script path) while another instance of the same script is already active on the system.
fix
This is often intended behavior. If you only want one instance, ensure previous runs are terminated. If you want multiple distinct instances of the same script, provide a unique `flavor_id` to `SingleInstance(flavor_id='unique_id')`. Wrap your `SingleInstance` usage in a `try...except SingleInstanceException` block to handle this gracefully.
Upgrade
Version history
0.3.0latest on PyPI · released Oct 9, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
tendo — pip install tendo · libregistry