Skip to main content

Computer Vision Design Patterns

Copier uv Ruff

GitHub Release Coverage Status

Tecnology stack

  • uv for python and project manager
  • pre-commit with ruff to mantain code consistency and pre-commit checks
  • GitHub Actions to create release and publish package (also on a private registry)

Installation

Note: You need uv (and uv only) installed on your machine.

To install the package:

uv sync

Usage

Events

TimeEvent

TimeEvent activates immediately when triggered and automatically deactivates after a specified duration.

from computer_vision_design_patterns.event import TimeEvent
import time

# Create an event that stays active for 2 seconds
event = TimeEvent(2)

# Trigger the event
event.trigger()
print(event.is_active())  # True

# After 2 seconds
time.sleep(2)
print(event.is_active())  # False

# Retriggering resets the timer
event.trigger()
print(event.is_active())  # True again

CountdownEvent

CountdownEvent starts inactive, counts down for a specified duration, and then activates.

from computer_vision_design_patterns.event import CountdownEvent
import time

# Create a countdown event for 3 seconds
event = CountdownEvent(3)

# Start the countdown
event.trigger()
print(event.is_active())  # False (still counting down)

# After 3 seconds
time.sleep(3)
print(event.is_active())  # True (countdown completed)

# Reset the event
event.reset()
print(event.is_active())  # False

Key Differences

  1. TimeEvent:

    • Activates immediately upon trigger and can be triggered multiple times
    • Automatically deactivates after the duration has elapsed
    • Can be reset by triggering again
  2. CountdownEvent:

    • Starts inactive
    • Can be triggered multiple times
    • Activates only after countdown completes
    • Stays active until manually reset

Examples

Check the dev folder for comprehensive examples of both event types.

Counters

ManualCounter

ManualCounter is a simple counter that activates when it reaches a specified threshold value. It requires manual updates and can be reset to start counting again.

from computer_vision_design_patterns.counter import ManualCounter
import time

# Create a counter that activates after 3 counts
counter = ManualCounter(3)

# Update the counter
counter.update()
print(counter.is_active())  # False (count = 1)

counter.update()
print(counter.is_active())  # False (count = 2)

counter.update()
print(counter.is_active())  # True (count = 3)

# Reset the counter
counter.reset()
print(counter.is_active())  # False (count = 0)

Examples

Check the dev/ folder for comprehensive examples of counter usage.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for computer-vision-design-patterns 2.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for computer-vision-design-patterns 2.0.11
File Interpreter ABI Platform
computer_vision_design_patterns-2.0.11-py3-none-any.whl Python 3 none any Details

Release files / computer_vision_design_patterns-2.0.11-py3-none-any.whl

Download URL computer_vision_design_patterns-2.0.11-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9467b028501ebd4e9edb1769dfa4bf374e1c9d81b724d7c27b2f11b7cfbd8d0d
BLAKE2b-256 checksum
How to use checksums
92f4baea278839d71cf126ab2005c03727a1d352168a419564d5ee61be8f1f36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Security for computer-vision-design-patterns 2.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for computer_vision_design_patterns-2.0.11-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page