Skip to content

[Beginner]: Tidy set up client in examples #2055

@exploreriii

Description

@exploreriii

🐥 Beginner Friendly

Welcome! This Beginner Issue is designed to be a natural next step after good first issues.

It nudges you to:

  • Research existing patterns
  • Own more implementation decisions
  • Test your changes

Difficulty:

  • Requires knowledge of our workflow
  • Beginner to intermediate Python and Git
  • Beginner DLT/Blockchain experience

Important

We recommend completing at least 3 good first issues before attempting a beginner issue.

Tip

You should be comfortable with:

  • Forking, branching, committing (with DCO + GPG signing), and opening a pull request without a tutorial
  • Reading beginner Python code you did not write and following its patterns
  • Handling simple merge conflicts in CHANGELOG.md
  • Keeping your fork up to date with main by rebasing
  • Looking things up on your own before asking for help

If any of that feels unfamiliar, good first issues might still be the most rewarding path
for you right now —
find one here.
You can always come back when you are ready.

Support: A maintainer actively monitors this issue and will help guide your implementation ideas.

⏱️ Typical time to complete: 4-6 hours
🧩 Difficulty: Manageable but requires investigation and testing
🎓 Best for: Beginner contributors


🏁 When this issue is complete, you will have:

✅ Improved your research abilities
✅ Improved your knowledge of the codebase
✅ Owned implementation decisions
✅ Created basic tests

👾 Description of the issue

We have various files in /examples that are manually setting up the client e.g

examples/account/account_allowance_approve_transaction_hbar.py
does:

def setup_client() -> Client:
    """Initialize and set up the client with operator account using env vars."""
    network = Network(network_name)
    print(f"Connecting to Hedera {network_name} network!")
    client = Client(network)

    operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
    operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))
    client.set_operator(operator_id, operator_key)
    print(f"Client set up with operator id {client.operator_account_id}")

    return client

We now offer a simpler method eg:

def setup_client() -> Client:
    """Setup Client."""
    client = Client.from_env()
    print(f"Network: {client.network.network}")
    print(f"Client set up with operator id {client.operator_account_id}")
    return client

Before claiming:

  • Check the issue labels to see what area this touches
  • Read the CodeRabbit AI plan (posted as a comment) for a rough implementation overview
  • If this feels like too big a step, that is fine — try another beginner issue or a Good First Issue first

💡 Solution

Update the set up client from manual to using the new method in client, in the example files

🔍 Background Research

You can understand this method by looking in the Client.py module, as well as some examples that use this eg.
examples/account/account_update_transaction.py

🛠️ Implementation

This is a large issue that requires updating the set up client examples throughout, robustly checking they work to run (you'll need a hedera portal testnet account and doing e.g. uv run examples/account/account_allowance_approve_transaction_hbar.py) and following good code principles

🧪 Testing your changes

How you test depends on the type of change.
See the testing guide for full details.

Source code changes (e.g. Python files in src/):

  • Write unit tests and run them locally: uv run pytest tests/unit/<specific_file>_test.py -v
  • Integration tests will run automatically when you push to your fork or open a PR

Example script changes (e.g. files in examples/):

  • Run the example script to confirm it works: instructions are at the top of each script
  • You will need a Hedera Portal account for testnet credentials — see environment setup
  • Example changes do not require unit or integration tests

Workflow / GitHub Actions changes (e.g. files in .github/):

  • Where possible, test by merging to your fork's main and simulating the scenario (e.g. creating a test issue or PR)
  • Link to any test issues or PRs you created as evidence
  • See the workflow testing guide

✅ Done Checklist

Before opening your PR, confirm:

  • My changes address what the issue asked for — nothing more, nothing less
  • I tested my changes locally (if relevant — see testing section above)
  • My commits are signed: git commit -S -s -m "chore: description"Signing guide
  • I added a CHANGELOG.md entry under [Unreleased]Changelog guide
  • All CI checks pass

📋 Workflow quick reference

You have done this before — here are the links if you need them:

Step Guide
Claim this issue Comment /assign below
Sync with main Rebasing guide
Open a PR and link this issue PR guide · Linking guide
Resolve merge conflicts Merge conflicts guide

🤖 Tips for using AI tools

Here is how to get the most out of AI tools:

  • Use Pylance in VS Code to catch errors and hallucinated methods in real time
  • Build your solution in small steps — add print statements or logs to confirm each piece works before moving on
  • When AI suggests code, check it against existing examples and similar classes in the SDK — that is the best source of Python SDK-specific patterns. AI sometimes borrows from other SDKs.
  • If AI output and SDK patterns disagree, trust the SDK

🆘 Stuck?

Beginner issues can be tricky — it is completely normal to get blocked. Here is what to do:

  • Comment on this issue and describe what you have tried. A maintainer will respond.
  • Ask on Discord in #hiero-python-sdk for quick questions.
  • Join Office Hours (Wednesdays, 2pm UTC) for live, hands-on help with a maintainer — screen sharing welcome.

Do not spend more than 30 minutes blocked without asking. Asking good questions is a skill too.

📚 Resources

Project references:

Python references:

Metadata

Metadata

Assignees

Labels

beginnerAchievable by a fairly new comer that has already completed a couple of good first issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions