Skip to content
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

Enhance Packaging, Testing, and Infrastructure with Modern Tools and Features #9

Merged
merged 23 commits into from
Dec 28, 2024

Conversation

jacksonpradolima
Copy link
Owner

Before submitting a pull request make sure you have:

  • The pull request title contains a meaningful title
    • Short and informative: serves as a summary
  • At least skimmed through the coding conventions used in the project
  • Checked the code with flake8
  • Performed a self-review of my own code
  • The code is commented, particularly in hard-to-understand areas
  • The documentation associated was created or updated
  • The changes generate no new warnings
  • Add tests that prove the change is effective or that the feature works
  • New and existing unit tests pass locally with the changes
  • Any dependent changes have been merged and published in downstream modules

Contents of the Pull Request

This pull request introduces significant updates and new features to the project:

New Features

  • Added .github/CODEOWNERS file for automatic reviewer assignments.
  • Introduced comprehensive issue templates for bug reports and feature requests.
  • Added SECURITY.md to outline the security policy, supported versions, and disclosure practices.

Infrastructure Enhancements

  • Migrated to pyproject.toml for modern Python packaging, replacing setup.py and setup.cfg.
  • Introduced Rye for dependency and virtual environment management.
  • Updated .python-version to include Python versions 3.12.8 and 3.13.1.

CLI Improvements

  • Enhanced gsppy/cli.py with:
    • Verbosity control using a --verbose flag.
    • Type annotations for better maintainability.
    • Streamlined logging and error messages.

Testing & Quality

  • Reorganized test structure: moved tests to the root tests directory.
  • Added static type checks using mypy and pyright.
  • Replaced linting and type-checking configurations in workflows for improved accuracy.

Stacked PR Chains (Optional)

  • N/A

How Has This Been Tested? (Required)

The following tests and validations were performed:

  1. Unit Tests:

    • All new features and changes were covered by new or existing unit tests.
    • Mocked functions to simulate edge cases in the CLI.
    • Verified backward compatibility.
  2. Integration Tests:

    • Verified functionality with real datasets.
    • Tested end-to-end workflows, including CLI commands and output validation.
  3. Manual Testing:

    • Validated logging verbosity for CLI operations.
    • Ensured smooth transitions when using Rye for environment setup.

Test Configuration:

  • Firmware version: N/A
  • Hardware: Standard development machine
  • Toolchain: pytest, pyright, ruff, tox
  • SDK: Python 3.8 to 3.13

Other Notes

  • This PR deprecates requirements-dev.txt and migrates all configurations to pyproject.toml.
  • It also removes legacy CI workflows and replaces them with modern, scalable alternatives.

- Introduce structured issue templates for bug reports and feature requests, ensuring contributors provide essential details.
- Configure the repository to disable blank issues, add contact links, and assign a default code owner for PR reviews.
- Remove old Python versions 3.6 and 3.7 and add 3.12 and 3.13.
- Update tox configuration to include the new Python versions in the testing matrix.
Moved test files out of the gsppy module to a dedicated top-level tests directory for better organization.
- Introduce a `mypy.ini` file to enforce strict type-checking rules and manage MyPy configuration.
- This includes enabling warnings, disallowing untyped elements, and fine-tuning settings to avoid conflicts with Pyright.
- Replaced setup.py and setup.cfg with pyproject.toml to modernize the build system using Hatch.
- Updated dependencies accordingly and aligned configuration for tooling such as pytest, ruff, and pyright.
- Updated the PyPI project URL and replaced `setup.py` usage with `python -m build` for a more modern and reliable build process.
- Also refined the dependency installation step to use `pip install build` instead of directly installing `setuptools` and `wheel`.
- Reorganized imports for consistency and readability across modules.
- Replaced `print` statements with a centralized logging mechanism in CLI for better output control.
- Updated CLI tests to mock logger calls instead of capturing stdout for more robust testing.
- Introduced stricter and more descriptive type hints throughout the codebase to improve readability and type safety.
- Removed redundant validation checks for transaction structures, as they are now enforced through type hints.
- Added detailed type hints across various modules to improve code clarity.
- Leveraged `lru_cache` for optimization in utility functions.
- Updated tests to align with strong type annotations and added linting configurations to suppress specific warnings.
Adjust import order in `test_utils.py`, `test_gsp.py`, and `test_cli.py` for better readability and adherence to coding standards. This change ensures a consistent and logical grouping of imports across the test suite.
- This commit introduces a test to verify that the `setup_logging` function sets the logging level to DEBUG when the `--verbose` flag is provided.
- It mocks CLI arguments, file reading, and the GSP algorithm to ensure proper functionality without dependencies.
- The new test enhances coverage and ensures logging behavior works as expected.
This release introduces `.github/CODEOWNERS`, issue templates, and a `SECURITY.md` file for enhanced project management and security. Key improvements include Python 3.12/3.13 support, CLI enhancements, GSP algorithm optimizations, and a migration to `pyproject.toml` for modern packaging. Testing, build processes, and workflows have also been restructured for better quality and maintainability.
- Replaced `requirements-dev.txt` with Rye-managed lock files and updated `pyproject.toml` to include all dependencies and scripts.
- Updated documentation and CI workflow to reflect the use of Rye, simplifying setup and improving consistency in dependency management.
- Replaced previous dependency management with Rye, updating workflows and documentation accordingly.
- Deprecated `requirements-dev.txt` in favor of using `pyproject.toml`.
- Updated CI workflows and tools like Ruff, Pyright, and Mypy to align with the new setup.
@jacksonpradolima jacksonpradolima self-assigned this Dec 28, 2024
Corrected an extra space in the pytest version specification within the Codecov workflow file. This ensures the dependencies are installed properly during the CI/CD pipeline execution.
@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.75%. Comparing base (46eca97) to head (4e01379).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   99.50%   99.75%   +0.24%     
==========================================
  Files           6        6              
  Lines         405      409       +4     
  Branches       22       20       -2     
==========================================
+ Hits          403      408       +5     
+ Partials        2        1       -1     
Flag Coverage Δ
unittests 99.75% <100.00%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Replaced manual Rye installation with the `eifinger/setup-rye` action to streamline setup. Simplified dependency synchronization and improved maintainability by specifying Rye version directly.
Updated the error message in the CLI test to use consistent string formatting. This ensures clarity and adherence to the preferred style across the codebase. No functional impact on the test logic.
Replaced specific type hints with more generic annotations (`Any`) for better flexibility when handling unique candidates. This ensures compatibility with a broader range of data types within the GSP implementation.
The Mypy step for type-checking changed files was removed to streamline the code quality workflow. Other steps, like Pylint and type checks using Rye, remain in place to ensure code quality.
Included pylint and its related dependencies (astroid, dill, isort, mccabe, platformdirs, tomli, tomlkit, and typing-extensions) in the development environment. Updated both `requirements-dev.lock` and `pyproject.toml` to reflect these changes.
Eliminated Pylint configuration and its execution steps from the code quality workflow. This streamlines the workflow by focusing on Pyright for type checking, simplifying maintenance and reducing redundancy."
@jacksonpradolima jacksonpradolima merged commit 03a9db5 into master Dec 28, 2024
5 checks passed
@jacksonpradolima jacksonpradolima deleted the feat/enhancements branch December 28, 2024 03:40
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.

2 participants