Skip to content

Commit 7f35aef

Browse files
authored
chore: add detail to beginner template (#1349)
Signed-off-by: exploreriii <[email protected]>
1 parent 2f1ed33 commit 7f35aef

File tree

2 files changed

+30
-101
lines changed

2 files changed

+30
-101
lines changed

.github/ISSUE_TEMPLATE/05_beginner_issue.yml

Lines changed: 29 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ body:
1111
## **Thanks for contributing!** 😊
1212
1313
We truly appreciate your time and effort. If this is your first open-source contribution, welcome!
14-
This template is designed to help you create a Beginner-friendly issue: an easy, well-scoped task that helps new contributors learn the codebase and build their skills.
14+
This template is designed to help you create a Beginner-friendly issue: an easy, well-scoped task that helps fairly new contributors learn the codebase and build their skills.
1515
---
1616
- type: textarea
1717
id: intro
@@ -22,8 +22,8 @@ body:
2222
This issue is intended for contributors who have previously completed a Good First Issue in [Hiero](https://hiero.org) and are at a beginner level.
2323
We recognize that gaining confidence and building skills are equally important steps in the open-source contributor journey.
2424
The purpose of this issue—and others listed under [**Find a beginner issue**](https://github.com/hiero-ledger/hiero-sdk-python/issues?q=is%3Aissue%20state%3Aopen%20label%3Abeginner%20no%3Aassignee)—is to provide a supportive, low-pressure environment where you can learn, practice, and grow your contribution skills with confidence.
25-
validations:
26-
required: false
25+
validations:
26+
required: false
2727

2828
- type: markdown
2929
attributes:
@@ -60,9 +60,10 @@ body:
6060
attributes:
6161
label: 👾 Description of the issue
6262
description: |
63-
DESCRIBE THE ISSUE IN A WAY THAT IS UNDERSTANDABLE TO NEW CONTRIBUTORS.
64-
YOU MUST NOT ASSUME THAT SUCH CONTRIBUTORS HAVE ANY KNOWLEDGE ABOUT THE CODEBASE OR HIERO.
63+
DESCRIBE THE ISSUE IN A WAY THAT IS UNDERSTANDABLE AND APPROACHABLE TO BEGINNER CONTRIBUTORS.
64+
ASSUME SUCH CONTRIBUTORS HAVE AT MOST BEGINNER-LEVEL KNOWLEDGE ABOUT PROGRAMMING, THE CODEBASE AND HIERO.
6565
IT IS HELPFUL TO ADD LINKS TO THE RELEVANT DOCUMENTATION AND/OR CODE SECTIONS.
66+
SLIGHTLY CHALLENGE THEM TO ENCOURAGE LEARNING AND RESEARCH BUT MAKE SURE THE ISSUE IS STILL SIMPLE.
6667
BELOW IS AN EXAMPLE.
6768
value: |
6869
Edit here. Example provided below.
@@ -76,70 +77,17 @@ body:
7677
<!-- Example for problem (hidden in submission) -->
7778
## 👾 Description of the issue - Example
7879
79-
The example for Token Associate Transaction located at examples/tokens/token_associate_transaction.py can be improved. It correctly illustrates how to associate a token, however, it does so all from one function main()
80+
The `AccountId` class at src/hiero_sdk_python/account/account_id.py implements a `__repr__()` method which currently falls back to the default object representation, which is less helpful
81+
when debugging.
8082
81-
As everything is grouped together in main(), it is difficult for a user to understand all the individual steps required to associate a token.
83+
For example, printing an `AccountId` instance in a REPL currently produces output similar to:
8284
83-
For example:
8485
```python
85-
86-
def run_demo():
87-
"""Monolithic token association demo."""
88-
print(f"🚀 Connecting to Hedera {network_name} network!")
89-
client = Client(Network(network_name))
90-
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
91-
operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))
92-
client.set_operator(operator_id, operator_key)
93-
print(f"✅ Client ready (operator {operator_id})")
94-
95-
test_key = PrivateKey.generate_ed25519()
96-
receipt = (
97-
AccountCreateTransaction()
98-
.set_key(test_key.public_key())
99-
.set_initial_balance(Hbar(1))
100-
.set_account_memo("Test account for token association demo")
101-
.freeze_with(client)
102-
.sign(operator_key)
103-
.execute(client)
104-
)
105-
if receipt.status != ResponseCode.SUCCESS:
106-
raise Exception(receipt.status)
107-
account_id = receipt.account_id
108-
print(f"✅ Created test account {account_id}")
109-
110-
# Create tokens
111-
tokens = []
112-
for i in range(3):
113-
try:
114-
receipt = (
115-
TokenCreateTransaction()
116-
.set_token_name(f"DemoToken{i}")
117-
.set_token_symbol(f"DTK{i}")
118-
.set_decimals(2)
119-
.set_initial_supply(100_000)
120-
.set_treasury_account_id(operator_id)
121-
.freeze_with(client)
122-
.sign(operator_key)
123-
.execute(client)
124-
)
125-
if receipt.status != ResponseCode.SUCCESS:
126-
raise Exception(receipt.status)
127-
token_id = receipt.token_id
128-
tokens.append(token_id)
129-
print(f"✅ Created token {token_id}")
130-
except Exception as e:
131-
print(f"❌ Token creation failed: {e}")
132-
sys.exit(1)
133-
134-
# Associate first token
135-
try:
136-
TokenAssociateTransaction().set_account_id(account_id).add_token_id(tokens[0]).freeze_with(client).sign(test_key).execute(client)
137-
print(f"✅ Token {tokens[0]} associated with account {account_id}")
138-
except Exception as e:
139-
print(f"❌ Token association failed: {e}")
140-
sys.exit(1)
86+
<hiero.account_id.AccountId object at 0x7f9c2a3b8d60>
14187
```
14288
89+
This makes it difficult to quickly identify the actual account ID value during debugging sessions.
90+
14391
- type: textarea
14492
id: solution
14593
attributes:
@@ -159,14 +107,14 @@ body:
159107
attributes:
160108
value: |
161109
<!-- Example for the solution (hidden in submission) -->
162-
## 💡 Solution - Example
110+
To improve this, we want to implement a more informative `__repr__()` method for the `AccountId` class that clearly displays the account ID in a recognizable format.
111+
112+
After this improvement, `repr(account_id)` should return a clear and descriptive value that reflects
113+
the account’s shard, realm, and number. For example:
163114
164-
For the TokenAssociateTransaction example, the solution is to split the monolithic main() function for illustrating TokenAssociateTransaction into separate smaller functions which are called from main().
165-
Such as:
166-
- Setting up the client
167-
- Creating an account
168-
- Creating a token
169-
- Associating the account to the token
115+
```python
116+
AccountId(shard=0, realm=0, num=1234)
117+
```
170118
171119
- type: textarea
172120
id: implementation
@@ -188,35 +136,17 @@ body:
188136
<!-- Example implementation (hidden in submission) -->
189137
### 👩‍💻 Implementation - Example
190138
191-
To break down the monolithic main function, you need to:
192-
- [ ] Extract the Key Steps (set up a client, create a test account, create a token, associate the token)
193-
- [ ] Copy and paste the functionality for each key step into its own function
194-
- [ ] Pass to each function the variables you need to run it
195-
- [ ] Call each function in main()
196-
- [ ] Ensure you return the values you'll need to pass on to the next step in main
197-
- [ ] Ensure the example still runs and has the same output!
139+
To implement this change, beginner contributors should:
198140
199-
For example:
200-
```python
201-
202-
def setup_client():
203-
"""Initialize and set up the client with operator account."""
204-
205-
def create_test_account(client, operator_key):
206-
"""Create a new test account for demonstration."""
207-
208-
def create_fungible_token(client, operator_id, operator_key):
209-
"""Create a fungible token for association with test account."""
210-
211-
def associate_token_with_account(client, token_id, account_id, account_key):
212-
"""Associate the token with the test account."""
213-
214-
def main():
215-
client, operator_id, operator_key = setup_client()
216-
account_id, account_private_key = create_test_account(client, operator_key)
217-
token_id = create_fungible_token(client, operator_id, operator_key)
218-
associate_token_with_account(client, token_id, account_id, account_private_key)
219-
```
141+
- [ ] Locate the `AccountId` class in the `src/` directory
142+
- [ ] Review the existing `__str__()` method to understand how account IDs are currently formatted
143+
- [ ] Review the `__init__()` method to see which fields (`shard`, `realm`, `num`, `alias_key`) define an account
144+
- [ ] Check whether other ID classes in the SDK implement `__repr__()` and follow a similar pattern
145+
- [ ] Implement or refine the `__repr__()` method so it:
146+
- Clearly displays `shard`, `realm`, and `num` values
147+
- Includes `alias_key` when the account is created using an alias
148+
- Uses keyword-style formatting for readability
149+
- [ ] Test the new `__repr__()` method expanding the unit test for AccountId
220150
221151
- type: textarea
222152
id: acceptance-criteria
@@ -241,8 +171,6 @@ body:
241171
label: 📋 Step-by-Step Contribution Guide
242172
description: Provide a contribution workflow suitable for new contributors
243173
value: |
244-
If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow.
245-
246174
- [ ] **Assignment:** You must be assigned to the issue, comment: `/assign` in the issue to get assigned [see guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/training/workflow/04_assigning_issues.md)
247175
- [ ] **Fork, Branch and Work on the issue:** Create a copy of the repository, create a branch for the issue and solve the problem. For instructions, please read our [Contributing guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/CONTRIBUTING.md) file. Further help can be found at [Set-up Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training/setup) and [Workflow Training](https://github.com/hiero-ledger/hiero-sdk-python/tree/main/docs/sdk_developers/training/workflow).
248176
- [ ] **DCO and GPG key sign each commit :** each commit must be -s and -S signed. An explanation on how to do this is at [Signing Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/signing.md)

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
3535
- Refactored `account_create_transaction_create_with_alias.py` example by splitting monolithic function into modular functions: `generate_main_and_alias_keys()`, `create_account_with_ecdsa_alias()`, `fetch_account_info()`, `print_account_summary()` (#1016)
3636
- Added `.github/workflows/bot-pr-auto-draft-on-changes.yml` to automatically convert PRs to draft and notify authors when reviewers request changes.
3737
- Add beginner issue template
38+
- Add relevant examples to the beginner issue template
3839
- Modularized `transfer_transaction_fungible` example by introducing `account_balance_query()` & `transfer_transaction()`.Renamed `transfer_tokens()``main()`
3940
- Phase 2 of the inactivity-unassign bot: Automatically detects stale open pull requests (no commit activity for 21+ days), comments with a helpful InactivityBot message, closes the stale PR, and unassigns the contributor from the linked issue.
4041
- Added `__str__()` to CustomFixedFee and updated examples and tests accordingly.

0 commit comments

Comments
 (0)