Skip to content

Pynest #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 145 commits into
base: develop
Choose a base branch
from
Open

Pynest #270

wants to merge 145 commits into from

Conversation

mryel00
Copy link
Member

@mryel00 mryel00 commented Jul 10, 2024

No description provided.

@mryel00 mryel00 marked this pull request as ready for review March 8, 2025 08:50
@mryel00 mryel00 marked this pull request as draft March 30, 2025 09:21
@mryel00 mryel00 marked this pull request as ready for review March 30, 2025 09:21
@mryel00 mryel00 requested review from Copilot and removed request for Copilot March 30, 2025 09:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the "Pynest" project by introducing new utilities, parameter parsing, logging functionality, various streamer and camera component classes, and the main application logic for configuration parsing and service execution.

  • Introduces a suite of utility functions and new helper modules for logging and parameter management.
  • Adds several new component types (streamers, cameras, and sections) and integrates them into the main daemon logic.
  • Enhances camera management by including UVC, libcamera, and legacy camera support.

Reviewed Changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pylibs/utils.py New utility functions for dynamic imports, command execution, and conversions.
pylibs/parameter.py Parameter parsing with type validation and error logging.
pylibs/logging_helper.py Helper module for structured logging and host info displaying.
pylibs/logger.py Logger setup and various logging functions with custom levels.
pylibs/components/streamer/* Several new streamer implementations with custom execution flows.
pylibs/components/section.py Base class for config section handling and component initialization.
pylibs/components/crowsnest.py Crowsnest component implementation for global configuration.
pylibs/components/cam.py New camera component integrating a streamer and watchdog.
pylibs/camera/types/* Support for UVC, libcamera, and legacy camera types.
pylibs/camera/* Camera manager and camera base class implementations.
crowsnest.py Main module that parses config, sets up logging, and starts all services.
Files not reviewed (1)
  • crowsnest: Language not supported
Comments suppressed due to low confidence (2)

pylibs/utils.py:100

  • The variable name 'exec' shadows the built-in Python function. Consider renaming it to 'executable' or another non-reserved identifier.
exec = shutil.which(name)

pylibs/camera/types/uvc.py:8

  • [nitpick] The attribute name 'path_by_path' is ambiguous. Consider renaming it to something more descriptive like 'alias_path' or 'linked_path' to clarify its purpose.
self.path_by_path = None

mryel00 added 4 commits March 30, 2025 11:32
Signed-off-by: Patrick Gehrsitz <[email protected]>
Signed-off-by: Patrick Gehrsitz <[email protected]>
@mryel00 mryel00 requested a review from Copilot March 30, 2025 09:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR, titled "Pynest", introduces a new modular architecture for handling camera input, streaming, logging, and configuration in the project.

  • Added new utility functions and dynamic component loaders.
  • Introduced several new components: streamers (ustreamer, spyglass, camera-streamer), camera types (UVC, Libcamera, Legacy), and configuration sections.
  • Integrated logging enhancements and a new main executable ("crowsnest.py") for initializing and managing services.

Reviewed Changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pylibs/utils.py Added dynamic function and component loading utilities.
pylibs/parameter.py Improved parameter parsing with type conversion and error logging.
pylibs/logging_helper.py Enhanced logging functions; includes host and camera info logging.
pylibs/logger.py Defined custom logger and handlers for file and stdout logging.
pylibs/components/streamer/ustreamer.py Implemented Ustreamer streamer with custom v4l2 control handling.
pylibs/components/streamer/streamer.py Defined abstract streamer structure and dynamic binary lookup.
pylibs/components/streamer/spyglass.py Added Spyglass streamer implementation with virtualenv integration.
pylibs/components/streamer/camera-streamer.py Added Camera-Streamer for specialized camera streaming options.
pylibs/components/section.py Established base class for configuration sections.
pylibs/components/crowsnest.py Introduced Crowsnest service component for high-level orchestration.
pylibs/components/cam.py Implemented Cam component that ties a camera with its streamer.
pylibs/camera/***.py Added different camera type implementations and the camera manager.
crowsnest.py Main executable integrating configuration, logging, and service startup.
Files not reviewed (1)
  • crowsnest: Language not supported

@mryel00 mryel00 requested a review from Copilot March 30, 2025 10:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR, titled "Pynest", introduces a comprehensive set of modules to support dynamic loading, logging, and execution for a webcam service daemon. Key changes include:

  • New utility and logging modules (pylibs/utils.py, pylibs/logger.py, pylibs/logging_helper.py) that provide functions for dynamic component loading, command execution, and system logging.
  • Several new components for handling streamer and camera types (ustreamer, spyglass, camera-streamer, cam, and camera types UVC, Libcamera, Legacy) that enable flexible configuration and runtime behavior.
  • A main orchestration script (crowsnest.py) that parses configuration, initializes services, and manages asynchronous execution.

Reviewed Changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pylibs/utils.py Provides dynamic import, command execution, and conversion helpers.
pylibs/parameter.py Defines parameter parsing with type conversion and error logging.
pylibs/logging_helper.py Implements host/system logging functions and startup information print.
pylibs/logger.py Sets up logging with custom log levels and formatting.
pylibs/components/streamer/*.py Implements various streamer components (ustreamer, spyglass, camera-streamer) supporting different hardware and configurations.
pylibs/components/section.py Defines a base class for configuration sections with validation.
pylibs/components/crowsnest.py Introduces the crowsnest component for managing core service configuration.
pylibs/components/cam.py Provides a Cam component that wraps a streamer and manages execution flow.
pylibs/camera/types/*.py & camera modules Implements camera types (UVC, Libcamera, Legacy) and camera management.
crowsnest.py The main daemon script that parses configuration and orchestrates service startup.
Files not reviewed (1)
  • crowsnest: Language not supported
Comments suppressed due to low confidence (2)

pylibs/camera/types/uvc.py:8

  • [nitpick] The variable name 'path_by_path' is ambiguous; consider renaming it to something clearer like 'symlink_path' or 'alternative_path' to better convey its purpose.
self.path_by_path = None

pylibs/components/streamer/ustreamer.py:88

  • [nitpick] The use of the magic number '28' to trim the log message is unclear. Consider replacing it with a named constant or a more descriptive method to improve code readability.
msg = msg[:-28]

@mryel00 mryel00 requested a review from Copilot March 30, 2025 10:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements "Pynest", introducing new modules and enhancements for a webcam service daemon. Key changes include:

  • New and improved utility functions and logging modules.
  • Implementation of various streamer components and camera types.
  • Integration and configuration parsing for services and cameras in the main application.

Reviewed Changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pylibs/utils.py Adds utility functions for dynamic module loading, subprocess execution, and file handling.
pylibs/parameter.py Introduces a Parameter class for type conversion and error logging.
pylibs/logging_helper.py Implements helper functions to log system, host, and config information.
pylibs/logger.py Sets up custom logging with multiple handlers and custom log levels.
pylibs/components/streamer/ustreamer.py Implements a streamer based on ustreamer with custom log formatting and V4L2 controls.
pylibs/components/streamer/streamer.py Provides an abstract streamer class and utility for loading streamers.
pylibs/components/streamer/spyglass.py Implements a streamer for the Spyglass component using a virtual environment.
pylibs/components/streamer/camera-streamer.py Adds a camera-streamer with RTSP and customized camera options.
pylibs/components/section.py Defines an abstract Section class for config parsing and validation.
pylibs/components/crowsnest.py Introduces the Crowsnest component for overall service configuration.
pylibs/components/cam.py Implements a camera component that loads and manages an associated streamer.
pylibs/camera/types/uvc.py Introduces the UVC camera type with detailed control and format logging.
pylibs/camera/types/libcamera.py Adds support for libcamera with control extraction and formatting.
pylibs/camera/types/legacy.py Provides a legacy camera type for mmal-based devices.
pylibs/camera/camera_manager.py Implements camera management functions for initialization and lookup.
pylibs/camera/camera.py Defines the base Camera abstract class.
pylibs/camera/init.py Initializes camera types and management modules.
pylibs/init.py Basic initialization of the pylibs package.
crowsnest.py Sets up the daemon entrypoint, configuration parsing, and orchestration.
Files not reviewed (1)
  • crowsnest: Language not supported
Comments suppressed due to low confidence (1)

pylibs/components/streamer/ustreamer.py:88

  • [nitpick] Using a magic number (28) for slicing the log message can be confusing. Consider defining a named constant for this value to clarify its purpose.
            msg = msg[:-28]

@mryel00 mryel00 requested a review from Copilot March 30, 2025 10:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR, titled "Pynest", introduces a set of utility modules and new components to support dynamic loading of modules, camera handling, logging, and multiple streamer implementations for a webcam service. Key changes include:

  • A new utilities module (pylibs/utils.py) with helper functions for dynamic imports, process execution, and file handling.
  • Added modules for parameter handling, logging, and several streamer types (ustreamer, spyglass, camera-streamer) along with corresponding camera types.
  • Enhancements to the configuration and initialization of components, as well as camera management and logging support.

Reviewed Changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pylibs/utils.py Introduces several helper functions; note potential naming conflict with a variable.
pylibs/parameter.py Provides parameter handling logic with error logging.
pylibs/logging_helper.py Adds functions for logging system initialization and host/streamer info logging.
pylibs/logger.py Sets up custom log levels and logging handlers.
pylibs/components/streamer/*.py Implements multiple streamer classes with dynamic execution for different streaming types.
pylibs/components/section.py Defines an abstract section class for component configuration and execution.
pylibs/camera/* Implements camera types (UVC, Libcamera, Legacy), camera management, and initialization.
crowsnest.py Main entry point that parses config, initializes logging, and orchestrates component startup.
Files not reviewed (1)
  • crowsnest: Language not supported
Comments suppressed due to low confidence (4)

pylibs/utils.py:101

  • The variable name 'exec' shadows Python's built-in function. Consider renaming it to 'executable' or a similar alternative.
        exec = shutil.which(name)

pylibs/logging_helper.py:68

  • The loop variable 'bin' shadows the built-in function 'bin'. Consider renaming it to 'name' or 'key' for clarity.
    for bin in Streamer.binaries:

pylibs/camera/types/libcamera.py:63

  • Using 'min' and 'max' as variable names shadows built-in functions. Consider renaming them to 'min_val' and 'max_val'.
            min, max, default = value.values()

pylibs/camera/types/uvc.py:8

  • [nitpick] The attribute name 'path_by_path' is ambiguous; consider renaming it to something more descriptive such as 'symlink_path' or 'alternate_path'.
        self.path_by_path = None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant