Skip to content

GitHub actions#1

Closed
LazyTarget wants to merge 17 commits intomainfrom
feature/github-actions
Closed

GitHub actions#1
LazyTarget wants to merge 17 commits intomainfrom
feature/github-actions

Conversation

@LazyTarget
Copy link
Owner

  • linting
  • release-drafter
  • sourcery
  • pre-commit

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 8, 2025

Reviewer's Guide by Sourcery

This pull request includes several key updates: the package was renamed from openhardwaremonitor to pyopenhardwaremonitor, a retry mechanism with exponential backoff was implemented for API requests, error handling and logging were improved, async context manager support was added, GitHub Actions were configured for CI/CD, and project metadata and dependencies were updated.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Renamed the package from openhardwaremonitor to pyopenhardwaremonitor.
  • Renamed the root package directory.
  • Updated references to the package in setup.py and README.md.
  • Updated the import paths in example.py.
pyopenhardwaremonitor/api.py
README.md
setup.py
pyopenhardwaremonitor/exceptions.py
pyopenhardwaremonitor/__init__.py
example.py
pyopenhardwaremonitor/const.py
Implemented retry mechanism with exponential backoff for API requests.
  • Added retry_count and retry_delay parameters to the OpenHardwareMonitorAPI constructor.
  • Implemented exponential backoff with a random jitter in the raw_request method.
  • Added logging for retry attempts.
pyopenhardwaremonitor/api.py
Improved error handling and logging in the raw_request method.
  • Added more detailed logging of requests and responses, including URL, status, and content.
  • Ensured that the response content is read and logged regardless of the content type.
  • Removed the authenticate and auth_headers methods.
pyopenhardwaremonitor/api.py
Added async context manager support to the OpenHardwareMonitorAPI class.
  • Implemented __aenter__ and __aexit__ methods to allow the API to be used in async with statements.
pyopenhardwaremonitor/api.py
Configured GitHub Actions for CI/CD, including linting, release drafting, and Sourcery.
  • Added workflows for code checking (linting), Python package publishing, and release drafting.
  • Integrated Sourcery for automated code review and refactoring suggestions.
  • Configured pre-commit hooks for linting and code formatting.
.github/workflows/code-checker.yml
.github/workflows/python-publish.yml
.github/release-drafter.yml
.github/workflows/lint.yaml
.pre-commit-config.yaml
.github/workflows/sourcery-for-pr.yaml
.github/workflows/sourcery-for-codebase.yaml
Updated project metadata and dependencies.
  • Updated the Python version requirement to >=3.11.0 in setup.py.
  • Added/updated dependencies in setup.py and requirements.txt.
  • Added funding information in FUNDING.yml.
setup.py
FUNDING.yml
requirements.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @LazyTarget - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a more specific exception when the content type is not JSON.
  • The addition of __aenter__ and __aexit__ makes the API class usable as a context manager, which is great.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

pip3 install pyopenhardwaremonitor
```

## Example
Copy link

Choose a reason for hiding this comment

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

suggestion: Mention the new example file.

Consider adding a sentence like "A more detailed example can be found in example.py" to the README to point readers to the new example file.

Suggested change
## Example
## Example
A more detailed example can be found in `example.py`

@LazyTarget LazyTarget closed this Mar 8, 2025
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