Skip to content

chore: Restructure dependencies and add optional extras#1679

Open
manishdait wants to merge 13 commits intohiero-ledger:mainfrom
manishdait:chore/restructure-deps
Open

chore: Restructure dependencies and add optional extras#1679
manishdait wants to merge 13 commits intohiero-ledger:mainfrom
manishdait:chore/restructure-deps

Conversation

@manishdait
Copy link
Contributor

@manishdait manishdait commented Feb 2, 2026

Description:

This PR updates the dependency configuration to improve install compatibility and reducing unnecessary dependencies while keeping the public API unchanged.

Changes Made:

  • Update dependencies to use compatiblity ranges
  • Reduced default runtime dependencies to core requirements only
  • Introduced optional extras:
    • eth[eth-keys, rlp]: used by EVM-related examples/tests
  • Moved build-only tools (e.g. grpcio-tools) out of runtime dependencies
  • Updated example workflow to install extra dependencies.

Related issue(s):

Fixes #1674
Fixes #1680

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1679   +/-   ##
=======================================
  Coverage   93.25%   93.26%           
=======================================
  Files         141      141           
  Lines        9061     9073   +12     
=======================================
+ Hits         8450     8462   +12     
  Misses        611      611           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@exploreriii exploreriii requested a review from a team February 2, 2026 13:05
Copy link
Member

@AntonioCeppellini AntonioCeppellini left a comment

Choose a reason for hiding this comment

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

Nice work! :D seems good to me!
I asked for curiosity the import thing :D.

aceppaluni
aceppaluni previously approved these changes Feb 2, 2026
Copy link
Contributor

@aceppaluni aceppaluni left a comment

Choose a reason for hiding this comment

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

@manishdait This is great work

@exploreriii
Copy link
Contributor

exploreriii commented Feb 3, 2026

@manishdait do we need to test the build at the min and max edges, and create a workflow for future updates, or do you think the current tests suffice?

@manishdait
Copy link
Contributor Author

@manishdait do we need to test the build at the min and max edges, and create a workflow for future updates, or do you think the current tests suffice?

Let me see what would be optimal and I’ll get back to you.

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Please ensure the python version is forward compatible

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

Quick Fix for CHANGELOG.md Conflicts

If your conflict is only in CHANGELOG.md, you can resolve it easily using the GitHub web editor:

  1. Click on the "Resolve conflicts" button in the PR
  2. Accept both changes (keep both changelog entries)
  3. Click "Mark as resolved"
  4. Commit the merge

For all other merge conflicts, please read:

Thank you for contributing!

@manishdait manishdait force-pushed the chore/restructure-deps branch 2 times, most recently from 029ce9f to 9b4705d Compare February 5, 2026 09:55
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Manish i think we need to update the README very clearly, maybe contributing.md, training/setup, possibly even the issue templates ?

@manishdait manishdait force-pushed the chore/restructure-deps branch from 0d46b38 to 8ea73a0 Compare February 6, 2026 12:07
@exploreriii exploreriii added the status: needs developer revision PR has requested changes that the developer needs to implement label Feb 6, 2026
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
@manishdait manishdait force-pushed the chore/restructure-deps branch from 0fe9391 to 4499e9e Compare February 8, 2026 06:57
@exploreriii
Copy link
Contributor

Hi @manishdait is this ready to review?

@manishdait
Copy link
Contributor Author

Hi @manishdait is this ready to review?

Yes

@manishdait manishdait marked this pull request as ready for review February 8, 2026 10:48
@manishdait manishdait requested review from a team as code owners February 8, 2026 10:48
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Walkthrough

The PR refactors SDK dependencies to follow Python library best practices: replacing strict version pins with compatibility ranges, moving build tools from runtime to build system, introducing optional extras for Ethereum-related features, and enabling Python 3.14+ forward compatibility. Additionally, equality comparison methods are added to PrivateKey and PublicKey classes with comprehensive test coverage.

Changes

Cohort / File(s) Summary
CI/CD Workflows
.github/workflows/deps-check.yml, .github/workflows/pr-check-examples.yml, .github/workflows/pr-check-test.yml
New workflow for dependency compatibility checks across Python 3.10 and 3.14; updated existing workflows to use uv sync --all-extras and include Python 3.14 in test matrix.
Dependency Configuration
pyproject.toml
Widened Python compatibility to <3.15; replaced exact version pins with ranges for core dependencies (protobuf, grpcio, cryptography, etc.); moved grpcio-tools to build-system; introduced optional eth extra with eth-keys and rlp; added Python 3.14 classifier; updated tool configurations (ruff, setuptools_scm).
Documentation Updates
CHANGELOG.md, docs/sdk_developers/examples.md, docs/sdk_developers/setup.md, docs/sdk_developers/testing.md
Added changelog entry; documented optional ETH dependencies with installation instructions for examples, setup, and testing using uv and pip.
Cryptographic Key Equality
src/hiero_sdk_python/crypto/private_key.py, src/hiero_sdk_python/crypto/public_key.py
Added __eq__ methods to PrivateKey and PublicKey classes enabling algorithm-aware equality comparisons with proper NotImplemented delegation for non-key types.
Unit Tests
tests/unit/keys_private_test.py, tests/unit/keys_public_test.py
Added comprehensive equality tests covering same/different keys within algorithms, cross-algorithm comparisons, and non-key type handling for both Ed25519 and ECDSA variants.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The PR includes eq method additions to PrivateKey and PublicKey classes with comprehensive tests, which appear to be out of scope relative to the dependency restructuring and Python 3.14 compatibility objectives. Clarify whether the equality method additions to crypto keys are intentional and related to the PR objectives, or if they should be separated into a distinct PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: restructuring dependencies and adding optional extras, which is the primary focus of the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining dependency restructuring, optional extras introduction, and workflow updates with clear linked issues.
Linked Issues check ✅ Passed The PR comprehensively addresses both linked issues: restructures dependencies with compatibility ranges, introduces optional eth extras, moves build-only tools, and enables Python 3.14+ forward compatibility throughout the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 14

Comment on lines +1 to +9
name: Dependency Compatibility Check

on:
push:
paths:
- "pyproject.toml"
pull_request:
paths:
- "pyproject.toml"
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider adding workflow_dispatch trigger for manual re-runs.

Other workflows in this repo include workflow_dispatch. Adding it here would allow maintainers to manually trigger dependency checks without requiring a pyproject.toml change — useful for debugging CI failures.

Comment on lines +32 to +36
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Python 3.14 likely needs allow-prereleases: true here as well.

Same concern as in pr-check-test.yml — Python 3.14 is pre-release until October 2026.

Proposed fix
       - name: Set up Python ${{ matrix.python-version }}
         uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
         with:
           python-version: ${{ matrix.python-version }}
+          allow-prereleases: true
           cache: "pip"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: "pip"

Comment on lines +44 to +46
- name: Install minimum dependencies
run: |
uv pip install --resolution=lowest-direct -e ".[dev,lint,eth]"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how dev, lint, and eth are defined in pyproject.toml
echo "=== [project.optional-dependencies] ==="
rg -A 20 '^\[project\.optional-dependencies\]' pyproject.toml

echo ""
echo "=== [dependency-groups] ==="
rg -A 20 '^\[dependency-groups\]' pyproject.toml

Repository: hiero-ledger/hiero-sdk-python

Length of output: 879


Fix uv pip install to use dependency-groups syntax instead of pip extras.

uv pip install -e ".[dev,lint,eth]" uses pip-style extras syntax (.[]), which only resolves names under [project.optional-dependencies]. However, dev and lint are defined under [dependency-groups] (PEP 735), so they will not be installed. This will cause the proto generation step (missing grpcio-tools) and test steps (missing pytest) to fail.

Use uv sync with --group flags, or move dev and lint to [project.optional-dependencies] to make them installable via the extras syntax.

fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

fd "pr-check-test.yml" .github/workflows/

Repository: hiero-ledger/hiero-sdk-python

Length of output: 108


🏁 Script executed:

cat -n .github/workflows/pr-check-test.yml

Repository: hiero-ledger/hiero-sdk-python

Length of output: 6793


🌐 Web query:

actions/setup-python pre-release Python versions allow-prereleases documentation

💡 Result:

In actions/setup-python, pre-release (alpha/beta/rc) CPython builds are controlled by the allow-prereleases input documented under Advanced usage → “Allow pre-releases”. It:

  • Defaults to false.
  • When set to true, it falls back to the newest pre-release if no matching GA (stable) release is available for the requested version (e.g., requesting 3.14 before 3.14 is GA).
  • For CPython, it only has an effect when you specify an x.y version range (like 3.14, not 3.14.1). [1]

Example from the docs section:

- uses: actions/setup-python@v6
  with:
    python-version: "3.14"
    allow-prereleases: true

[1]

Sources: actions/setup-python README (links to “Allow pre-releases”) [2], Advanced usage docs (“Allow pre-releases”) [1].

References:
[1] https://git.homeinfra.org/actions/setup-python/src/tag/v6/docs/advanced-usage.md
[2] https://github.com/actions/setup-python


Add allow-prereleases: true to setup-python for Python 3.14 support.

Python 3.14 is pre-release as of February 2026 (final release October 2026). The actions/setup-python action requires allow-prereleases: true to install pre-release Python versions; without it, the 3.14 matrix entry will fail.

Fix
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          python-version: ${{ matrix.python-version }}
+         allow-prereleases: true
          cache: "pip"

Comment on lines +254 to +255
- Refactored SDK dependencies to use version ranges, moved build-only deps out of runtime, removed unused core deps and added optional extras.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing changelog entry for __eq__ additions to PrivateKey and PublicKey.

Per the AI summary, this PR also adds __eq__ methods to PrivateKey and PublicKey classes. These are observable behavioral changes to the public API (equality semantics) and should have their own entry under ### Added.

Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs developer revision PR has requested changes that the developer needs to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable forward compatibility for Python 3.14 and above [Advanced]: Restructure SDK Dependencies for Library Best Practices

4 participants