Conversation
… and dependencies
…e operations, and sanitization - Introduced new regex constants for request IDs and special character validation. - Implemented datetime utility functions for timezone handling, ISO conversion, and timestamp generation. - Added synchronous and asynchronous HTTP connectivity checks. - Created file I/O utilities for directory and file management, including checksum generation. - Developed sanitization functions for HTML and URL escaping, along with special character sanitization. - Implemented validation functions for truthy/falsy checks, request ID validation, and special character detection. - Updated tests to reflect changes in the utility functions and ensure proper initialization.
…e test initialization function
… documentation and config files
…nd remove obsolete blog references
… and configuration files
There was a problem hiding this comment.
Pull Request Overview
This pull request restructures the potato_utils package from a template-style single class implementation to a comprehensive utilities library. The changes modernize the package structure, streamline documentation, and update CI/CD workflows.
- Removes the example
MyClassimplementation and replaces it with multiple utility modules - Updates package metadata to reflect the new utility-focused approach
- Modernizes installation and testing instructions to use setuptools extras
Reviewed Changes
Copilot reviewed 55 out of 57 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/potato_utils/ |
Complete restructure from single class to multiple utility modules (dt, http, io, sanitizer, secure, validator) |
tests/test_potato_utils.py |
Simplified test structure removing MyClass-specific tests |
pyproject.toml |
Updated package description and added multiple optional dependencies |
requirements/ |
Restructured dependency files and added new optional dependencies |
| Documentation files | Removed blog section, updated API docs, simplified installation instructions |
| CI/CD workflows | Updated to use production PyPI by default and extras-based dependency installation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| logger.debug(_message) | ||
|
|
||
| elif warn_mode == WarnEnum.ERROR: | ||
| raise OSError(errno.ENOENT, f"'{create_dir}' directory doesn't exist!") |
There was a problem hiding this comment.
The error message references 'create_dir' but should reference 'remove_dir' since this is in the remove_dir function.
| raise OSError(errno.ENOENT, f"'{create_dir}' directory doesn't exist!") | |
| raise OSError(errno.ENOENT, f"'{remove_dir}' directory doesn't exist!") |
| logger.debug(_message) | ||
|
|
||
| elif warn_mode == WarnEnum.ERROR: | ||
| raise OSError(errno.ENOENT, f"'{remove_dir}' directory doesn't exist!") |
There was a problem hiding this comment.
The error message references 'remove_dir' but should be consistent with the sync version. However, this is correct while the sync version has the bug.
|
|
||
|
|
||
| @validate_call | ||
| def espace_url(val: AnyHttpUrl) -> str: |
There was a problem hiding this comment.
Function name 'espace_url' should be 'escape_url' to match the intended functionality and be consistent with 'escape_html'.
|
|
||
| __all__ = [ | ||
| "escape_html", | ||
| "espace_url", |
There was a problem hiding this comment.
The all export should be 'escape_url' instead of 'espace_url' to match the corrected function name.
| class TSUnitEnum(str, Enum): | ||
| SECONDS = "SECONDS" | ||
| MILLISECONDS = "MILLISECONDS" | ||
| MICROSECONDS = "MICROSECONDS" | ||
| NANOSECONDS = "NANOSECONDS" |
There was a problem hiding this comment.
TSUnitEnum is duplicated in both constants/_enum.py and dt.py. This duplication should be removed by importing TSUnitEnum from constants in dt.py instead of redefining it.
This pull request makes several improvements to the documentation, streamlines installation and testing instructions, and updates the CI/CD workflow for publishing the package. The most important changes are grouped below:
Documentation Restructuring and Cleanup:
README.mdanddocs/README.mdto better reflect the utilities provided by the package [1] [2].MyClass.mdfile [1] [2].dt,http,io,sanitizer,secure,validator) to improve discoverability and documentation completeness [1] [2] [3] [4] [5] [6].Installation and Testing Improvements:
README.mdto recommend usingpip install .[test]andpip install .[dev]instead of requirements files, and removed references to TestPyPI for standard installation [1] [2] [3].README.mdanddocs/dev/test.mdto use the new extras-based installation method [1] [2].CI/CD Workflow Updates:
.[test]) for installing test dependencies and updated the publish workflow to use the production PyPI token by default, with the test publish step commented out [1] [2].Other Documentation and Navigation Updates:
Example and Configuration Cleanup:
README.mdto simplify and focus the documentation.These changes collectively modernize the documentation, make installation and testing easier, and improve the CI/CD process.