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

feat:more encodings #55

Merged
merged 5 commits into from
Jan 3, 2025
Merged

feat:more encodings #55

merged 5 commits into from
Jan 3, 2025

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Jan 3, 2025

even more encodings, following up #50

# AES-GCM + JSON-B91
# 2025-01-03 19:23:46.127 - HiveMind - hivemind_core.protocol:send:133 - DEBUG - unencrypted payload size: 1151 bytes
# 2025-01-03 19:23:46.128 - HiveMind - hivemind_core.protocol:send:138 - DEBUG - encrypted payload size: 1897 bytes

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added multiple new encoding classes: Z85B, Z85P, B91, and B100P.
    • Expanded encryption module with new encoding types (JSON_Z85P, JSON_B100P, JSON_B91, JSON_B32).
  • Bug Fixes

    • Improved error handling in encoding and decoding processes for new classes.
  • Documentation

    • Updated import paths and added deprecation warnings for existing encoding implementations.
  • Chores

    • Updated setup.py to include new encodings subpackage.
    • Added comprehensive test suites for new encoding classes.
    • Modified GitHub Actions workflows for testing with updated Python versions.
    • Added pytest and pytest-cov as dependencies for testing.

Copy link
Contributor

coderabbitai bot commented Jan 3, 2025

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 02805c2 and b10bbc1.

📒 Files selected for processing (4)
  • .github/workflows/unit_tests.yml (1 hunks)
  • hivemind_bus_client/encodings/__init__.py (1 hunks)
  • hivemind_bus_client/encryption.py (2 hunks)
  • hivemind_bus_client/protocol.py (1 hunks)

Walkthrough

This pull request introduces a comprehensive enhancement to the encoding capabilities of the hivemind_bus_client library. A new encodings subpackage is created, adding four new encoding classes: Z85B, Z85P, B91, and B100P. These classes provide diverse encoding and decoding methods with support for various input types and robust error handling. The changes also update the encryption module to support these new encoding formats and modify the package setup to include the new subpackage.

Changes

File Change Summary
hivemind_bus_client/encodings/__init__.py Added imports for new encoding classes: Z85B, Z85P, B91, and B100P
hivemind_bus_client/encodings/b100p.py New class B100P with emoji-based encoding/decoding methods
hivemind_bus_client/encodings/b91.py New class B91 implementing Base91 encoding and decoding
hivemind_bus_client/encodings/z85b.py New class Z85B with Z85b encoding implementation
hivemind_bus_client/encodings/z85p.py New class Z85P with Z85 encoding and decoding methods
hivemind_bus_client/encryption.py Updated SupportedEncodings with new encoding types
hivemind_bus_client/z85b.py Added deprecation warning for old import path
setup.py Added hivemind_bus_client.encodings to package list
test/test_b100.py New test suite for B100P encoding
test/test_b91.py New test suite for B91 encoding
test/test_z85b.py New test suite for Z85B encoding
test/test_z85p.py New test suite for Z85P encoding
.github/workflows/build_tests.yml Updated Python version from 3.8 to 3.10
.github/workflows/unit_tests.yml Introduced a new workflow for running unit tests across multiple Python versions

Possibly related PRs

Poem

🐰 Hop, hop, encoding we go!
New classes dance, data flows
Z85, B91, B100P shine bright
Transforming bytes with rabbit might
Encryption's magic takes its flight! 🌈


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added feature and removed feature labels Jan 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (7)
hivemind_bus_client/encodings/b100p.py (1)

31-33: Consider additional validation for non-text or complex data.

You handle string vs. bytes input well, but if users pass incompatible or unexpected data types, you rely on an AttributeError or similar exceptions from .encode(...). Optionally, consider explicitly verifying input type before encoding, to provide a more descriptive error message to the user.

setup.py (1)

47-47: Consider using find_packages() for scalability.

Manually listing subpackages can become error-prone if the project grows. Using setuptools.find_packages() ensures all submodules are automatically included.

hivemind_bus_client/encodings/b91.py (1)

70-72: Docstring return type mismatch with the actual return type.

The docstring states it returns a “Base91-encoded string” as str, but line 100 returns bytes. Consider aligning the docstring to reflect that the method returns a byte string, or adjust the method to return a Python str.

-            str: The Base91-encoded string.
+            bytes: The Base91-encoded data.
hivemind_bus_client/encodings/z85b.py (1)

94-100: Improve exception chaining in the decode method.

Static analysis recommends raising exceptions with from None or from e. This clarifies that the new exception is caused by the caught exception. It can help debug error traces without conflating them with the internal KeyError.

 except KeyError as e:
-    raise Z85DecodeError(f"Invalid byte code: {e.args[0]!r}")
+    raise Z85DecodeError(f"Invalid byte code: {e.args[0]!r}") from None
🧰 Tools
🪛 Ruff (0.8.2)

99-99: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

test/test_b100.py (1)

42-46: Correct the docstring to reference B100P instead of Base91.

The docstring says “Test decoding with invalid Base91 characters,” but this suite is for B100P. Updating it promotes clarity and consistency.

-        """Test decoding with invalid Base91 characters."""
+        """Test decoding with invalid B100P characters."""
hivemind_bus_client/encryption.py (1)

46-46: Correct the comment to match the new encoding name.
The comment for JSON_Z85P refers to "Z85B encoding." To avoid confusion, update the comment to reference Z85P directly.

- JSON_Z85P = "JSON-Z85P"  # JSON text output with Z85B encoding
+ JSON_Z85P = "JSON-Z85P"  # JSON text output with Z85P encoding
hivemind_bus_client/encodings/__init__.py (1)

1-4: Consider referencing or exposing imports to avoid "unused import" warnings.
To address the static analysis hints (F401), either:

  1. Add these classes to __all__, or
  2. Use them directly, or
  3. Alias them if needed for code clarity.
+__all__ = [
+    "Z85B",
+    "Z85P",
+    "B91",
+    "B100P",
+]
🧰 Tools
🪛 Ruff (0.8.2)

1-1: hivemind_bus_client.encodings.z85b.Z85B imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


2-2: hivemind_bus_client.encodings.z85p.Z85P imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: hivemind_bus_client.encodings.b91.B91 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: hivemind_bus_client.encodings.b100p.B100P imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3767782 and d98b3f7.

📒 Files selected for processing (12)
  • hivemind_bus_client/encodings/__init__.py (1 hunks)
  • hivemind_bus_client/encodings/b100p.py (1 hunks)
  • hivemind_bus_client/encodings/b91.py (1 hunks)
  • hivemind_bus_client/encodings/z85b.py (1 hunks)
  • hivemind_bus_client/encodings/z85p.py (1 hunks)
  • hivemind_bus_client/encryption.py (2 hunks)
  • hivemind_bus_client/z85b.py (1 hunks)
  • setup.py (1 hunks)
  • test/test_b100.py (1 hunks)
  • test/test_b91.py (1 hunks)
  • test/test_z85b.py (1 hunks)
  • test/test_z85p.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
hivemind_bus_client/z85b.py

3-3: hivemind_bus_client.encodings.z85b.Z85B imported but unused

Remove unused import: hivemind_bus_client.encodings.z85b.Z85B

(F401)

hivemind_bus_client/encodings/z85b.py

99-99: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

hivemind_bus_client/encodings/__init__.py

1-1: hivemind_bus_client.encodings.z85b.Z85B imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


2-2: hivemind_bus_client.encodings.z85p.Z85P imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: hivemind_bus_client.encodings.b91.B91 imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: hivemind_bus_client.encodings.b100p.B100P imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

🔇 Additional comments (16)
hivemind_bus_client/encodings/b100p.py (2)

4-12: Good use of docstrings and clear class documentation.

The multi-line docstring provides a clear overview of how the class manages encoding, padding bytes, and decoding. This helps maintainers quickly understand its purpose and usage.


38-44: Check for potential integer overflow or invalid byte offsets.

The arithmetic (b + 55) // 64 + 143 and (b + 55) % 64 + 128 might go out of range if b + 55 significantly exceeds 255 or is negative. Currently, there’s no explicit range check, and while using bytes from standard ASCII or UTF-8 is likely safe, consider adding a small range validation to ensure that invalid input doesn’t produce out-of-bounds emoji codes.

hivemind_bus_client/z85b.py (2)

5-11: Well-defined deprecation warning.

The warning clearly indicates the new import path. This is helpful for users migrating away from the older module structure.


3-3: Remove or utilize the unused import.

Static analysis indicates that Z85B is imported but never used. Consider removing it or using it if needed.

- from hivemind_bus_client.encodings.z85b import Z85B
🧰 Tools
🪛 Ruff (0.8.2)

3-3: hivemind_bus_client.encodings.z85b.Z85B imported but unused

Remove unused import: hivemind_bus_client.encodings.z85b.Z85B

(F401)

test/test_b91.py (2)

1-5: Solid test structure for B91 encoding.

The test class covers various scenarios (empty, single-byte, edge cases). The straightforward unittest approach is easy to maintain.


42-46: Confirm specific error for invalid characters.

Raising a ValueError for invalid Base91 characters is correct. Ensure it’s clear to downstream consumers that they can catch ValueError to handle malformed input.

test/test_z85b.py (2)

1-3: Test suite properly imports the Z85B class and exception.

Having explicit imports for both the encoding class and the custom exception clarifies their usage in the tests.


43-46: Validate exception consistency.

You correctly test for a Z85DecodeError on invalid input. Ensure the encoding class always raises the same exception type on all decode failures, so callers can handle them uniformly.

hivemind_bus_client/encodings/b91.py (2)

18-60: Looks great!

The decode method’s logic appears correct for Base91. It cleanly handles invalid characters via ValueError, and the bitwise operations align with standard Base91 decoding patterns. No issues identified.


62-69: Clear and concise encoding logic.

The overall approach for assembling bytes, tracking bits, and flushing partial values looks consistent with Base91 encoding methodology. The code is readable and well-structured.

hivemind_bus_client/encodings/z85p.py (1)

1-88: Implementation appears correct and handles padding properly.

The use of the first byte to indicate padding length, combined with a ValueError for invalid sizes, is consistent with standard Z85-based encodings. The big-endian integer packing (">I") and unpacking is appropriate, and the logic for ensuring the encoded length is %5 == 1 is correct. No critical issues found.

test/test_z85p.py (2)

8-9: Excellent coverage for empty input scenarios.
Testing both byte and string inputs for empty cases is a robust approach. Great job ensuring coverage of edge cases.


95-102: Good verification of padding removal logic.
Ensuring that once the decode operation is performed, any padding is correctly stripped out is a vital check. This test method thoroughly validates that behavior.

hivemind_bus_client/encryption.py (3)

49-49: Appreciate the addition of URL-safe Base64.
Renaming JSON_B64 to clarify its use of URL-safe Base64 is more descriptive. This helps avoid potential confusion with standard Base64 usage.


66-71: Consistency in get_encoder for new encodings.
The newly introduced encodings (JSON_Z85P, JSON_B91, JSON_B100P) are handled uniformly, aligning with the existing approach for other encodings.


87-92: Symmetrical handling in get_decoder.
The decoder logic mirrors the new encodings added in the encoder, ensuring consistent encoding-decoding behavior.

hivemind_bus_client/encodings/b100p.py Outdated Show resolved Hide resolved
test/test_z85p.py Show resolved Hide resolved
@github-actions github-actions bot added feature and removed feature labels Jan 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/unit_tests.yml (1)

3-29: Consider optimizing paths-ignore configuration.

The paths-ignore configuration is duplicated between pull_request and push triggers. Consider using a reusable anchor in YAML to maintain these paths in a single location:

name: Run UnitTests
on:
+ # Define paths to ignore
+ x-ignore-paths: &ignore_paths
+   - 'hivemind_bus_client/version.py'
+   - 'examples/**'
+   - '.github/**'
+   - '.gitignore'
+   - 'LICENSE'
+   - 'CHANGELOG.md'
+   - 'MANIFEST.in'
+   - 'readme.md'
+   - 'scripts/**'
  pull_request:
    branches:
      - dev
    paths-ignore:
-     - 'hivemind_bus_client/version.py'
-     - 'examples/**'
-     - '.github/**'
-     - '.gitignore'
-     - 'LICENSE'
-     - 'CHANGELOG.md'
-     - 'MANIFEST.in'
-     - 'readme.md'
-     - 'scripts/**'
+     *: *ignore_paths
  push:
    branches:
      - master
    paths-ignore:
-     - 'hivemind_bus_client/version.py'
-     - 'requirements/**'
-     - 'examples/**'
-     - '.github/**'
-     - '.gitignore'
-     - 'LICENSE'
-     - 'CHANGELOG.md'
-     - 'MANIFEST.in'
-     - 'readme.md'
-     - 'scripts/**'
+     *: *ignore_paths
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d98b3f7 and 2f27a95.

📒 Files selected for processing (2)
  • .github/workflows/build_tests.yml (1 hunks)
  • .github/workflows/unit_tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/unit_tests.yml

40-40: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


42-42: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


60-60: the runner of "codecov/codecov-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (3)
.github/workflows/build_tests.yml (1)

16-16: Verify Python version compatibility requirements.

The Python version has been updated from 3.8 to 3.10. This aligns with the Python versions used in the new unit tests workflow (3.9, 3.10, 3.11), but we should ensure:

  1. All dependencies support Python 3.10
  2. No breaking changes affect the build process

Run this script to check package compatibility:

✅ Verification successful

Python 3.10 upgrade is compatible with project dependencies

All listed dependencies in requirements.txt are modern packages that support Python 3.10:

  • poorman-handshake, ovos_bus_client, ovos_utils: These are actively maintained packages
  • bitstring>=4.1.1: Supports Python 3.10
  • cryptography>=41.0.1: Modern version with Python 3.10 support
  • pycryptodomex>=3.18.0: Compatible with Python 3.10
  • pybase64, py-cpuinfo: No version constraints, current versions support Python 3.10

No explicit Python version constraints are defined in setup.py, and all dependencies are using recent versions that are compatible with Python 3.10.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check package dependencies and their Python version support

# Get dependencies from setup.py/pyproject.toml
rg -A 5 "install_requires|dependencies" 

Length of output: 354


Script:

#!/bin/bash
# Check contents of requirements.txt for dependencies
cat requirements.txt

# Also check for any Python version constraints in setup.py
rg "python_requires" setup.py

# Look for any other potential requirements files
fd "requirements.*\.txt"

Length of output: 252

.github/workflows/unit_tests.yml (2)

34-36: LGTM! Good use of matrix strategy.

The matrix strategy with multiple Python versions (3.9, 3.10, 3.11) ensures good coverage across different Python environments.


54-55: Verify test coverage configuration.

The pytest command specifies coverage for the hivemind_bus_client module. Ensure that:

  1. The coverage includes the new encoding classes
  2. The test directory path is correct (test/unittests)

Run this script to verify the test structure:

✅ Verification successful

Test coverage configuration is correct and properly structured

The verification shows that:

  1. All encoding modules have corresponding test files:
    • b100p.pytest_b100.py
    • b91.pytest_b91.py
    • z85b.pytest_z85b.py
    • z85p.pytest_z85p.py
  2. The test files are correctly located in the test/ directory, which matches the pytest command path
  3. Test files contain proper unit tests for the encoding classes (verified from test_b91.py content)
  4. The coverage configuration --cov=hivemind_bus_client will include all encoding classes as they are under the specified module
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check test directory structure and coverage configuration

# Check if test directory exists and list its contents
fd -t d "test"

# Look for test files related to encodings
fd -t f "test_.*\.py" test/

Length of output: 121


Script:

#!/bin/bash
# Let's verify the test directory structure and content more thoroughly

# Check if there's a unittests directory
fd -t d "unittests"

# Check content of test directory to see if tests are properly organized
ls -R test/

# Look for encoding-related files in the source code to ensure test coverage
fd -t f ".*\.py" hivemind_bus_client/ | grep -i "encod"

Length of output: 353


Script:

#!/bin/bash
# Let's verify the test file names match the source files and check test content

# Check if test files correspond to source files
echo "Source files in hivemind_bus_client/encodings/:"
ls hivemind_bus_client/encodings/b*.py hivemind_bus_client/encodings/z*.py

echo -e "\nTest files in test/:"
ls test/test_*.py

# Look at the content of a test file to verify it's testing the encodings
head -n 20 test/test_b91.py

Length of output: 1362

.github/workflows/unit_tests.yml Outdated Show resolved Hide resolved
@github-actions github-actions bot added feature and removed feature labels Jan 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/unit_tests.yml (1)

34-40: ⚠️ Potential issue

Update GitHub Actions to their latest versions

Several actions are using outdated versions that should be updated.

Apply these version updates:

- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v5
- uses: codecov/codecov-action@v2
+ uses: codecov/codecov-action@v4

Also applies to: 55-58

🧰 Tools
🪛 actionlint (1.7.4)

35-35: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


37-37: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🧹 Nitpick comments (4)
test/requirements.txt (1)

1-1: Consider updating pytest to latest 7.x version

While pytest~=7.1 works, consider updating to the latest 7.x version (currently 7.4.3) to benefit from bug fixes and improvements.

-pytest~=7.1
+pytest~=7.4
.github/workflows/unit_tests.yml (3)

27-33: Consider adding Python 3.12 to the matrix

The matrix strategy is good, but Python 3.12 was released in October 2023 and should be considered for inclusion.

   strategy:
     matrix:
-      python-version: ["3.10", "3.11" ]
+      python-version: ["3.10", "3.11", "3.12"]

41-50: Optimize dependency installation steps

Consider these improvements for faster and more reliable builds:

  1. Use pip's cache feature to speed up installations
  2. Combine pip install commands to reduce layers
      - name: Install System Dependencies
        run: |
          sudo apt-get update
          sudo apt install python3-dev swig
-         python -m pip install build wheel
-      - name: Install repo
-        run: |
-          pip install -e .
-      - name: Install test dependencies
-        run: |
-          pip install -r test/requirements.txt
+      - name: Install Python Dependencies
+        run: |
+          python -m pip install --upgrade pip build wheel
+          pip install -e . -r test/requirements.txt

Also, add pip caching:

      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip'

51-54: Consider adding test result artifacts

The test step could be enhanced by uploading test results as artifacts for better debugging.

      - name: Run unittests
        run: |
-         pytest --cov=hivemind_bus_client --cov-report xml test
+         pytest --cov=hivemind_bus_client --cov-report xml --junitxml=junit/test-results.xml test
+      - name: Upload Test Results
+        if: always()
+        uses: actions/upload-artifact@v4
+        with:
+          name: test-results-${{ matrix.python-version }}
+          path: junit/test-results.xml
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f27a95 and 02805c2.

📒 Files selected for processing (2)
  • .github/workflows/unit_tests.yml (1 hunks)
  • test/requirements.txt (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/unit_tests.yml

35-35: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


37-37: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


58-58: the runner of "codecov/codecov-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
test/requirements.txt (1)

2-2: LGTM! Good practice adding coverage reporting

Adding pytest-cov is excellent for ensuring test coverage of the new encoding implementations.

.github/workflows/unit_tests.yml (1)

1-26: LGTM: Well-structured workflow triggers

The workflow triggers and path exclusions are well defined, covering both PR to dev and push to master branches while appropriately ignoring documentation and configuration files.

.github/workflows/unit_tests.yml Outdated Show resolved Hide resolved
JarbasAl and others added 2 commits January 3, 2025 19:28
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

codecov bot commented Jan 3, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@JarbasAl JarbasAl merged commit c4f8256 into dev Jan 3, 2025
5 checks passed
@JarbasAl JarbasAl deleted the feat/more_encodings branch January 8, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant