Skip to content

Commit 301e4c3

Browse files
authored
docs: added workflow training (#938)
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent d42f85b commit 301e4c3

12 files changed

+365
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
77
## [Unreleased]
88

99
### Added
10-
10+
- Added docs/sdk_developers/training/workflow: a training for developers to learn the workflow to contribute to the python SDK.
1111
- Added Improved NFT allowance deletion flow with receipt-based status checks and strict `SPENDER_DOES_NOT_HAVE_ALLOWANCE` verification.
1212
- Add `max_automatic_token_associations`, `staked_account_id`, `staked_node_id` and `decline_staking_reward` fields to `AccountUpdateTransaction` (#801)
1313
- Added docs/sdk_developers/training/setup: a training to set up as a developer to the python sdk
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Supporting Infrastructure When Developing for the Python SDK
2+
3+
For the best development experience and smoother support, we strongly recommend installing the following tools when developing for the Python SDK:
4+
5+
Recommended Tools
6+
- [ ] GitHub Desktop
7+
- [ ] Visual Studio Code
8+
- [ ] Pylance
9+
- [ ] GitHub Copilot
10+
11+
However, what may work best for you might be different.
12+
13+
### Github Desktop
14+
GitHub Desktop is a free, user-friendly application that provides a visual interface for Git and GitHub. Instead of running Git commands in a terminal, GitHub Desktop lets you perform common tasks through an intuitive UI.
15+
16+
It allows you to:
17+
- Clone, fork, and manage repositories without using the command line
18+
- Easily create and switch branches
19+
- Visualize commit history and branches in a clear, interactive timeline
20+
- Stage and push local changes with a click
21+
- Resolve merge conflicts with guided prompts
22+
23+
Overall, GitHub Desktop makes Git simpler, safer, and more visual, which is great for maintaining clean, branched pull requests and staying aligned with the rest of the Python SDK team.
24+
25+
### VS Studio Code
26+
VS Code is a workpace that enables:
27+
28+
- Easy project navigation
29+
- Easy file organisation
30+
- Access to a large ecosystem of extensions that plug-in, including Pylance and Github Copilot
31+
32+
It’s the recommended editor for working within this SDK.
33+
34+
#### Pylance
35+
Pylance is a high-performance language server for Python that:
36+
37+
- Improves code quality
38+
- Identifies errors early
39+
- Helps you resolve issues faster
40+
41+
For example, Pylance will underline this in red indicating it is incorrect with a reason:
42+
```python
43+
from hiero_sdk_python.account.token_id import TokenId
44+
```
45+
This is incorrect because token_id.py does not live in /account! Instead, it lives in /tokens
46+
47+
Read our [Pylance Installation Guide](../../pylance.md)
48+
49+
#### Github Copilot
50+
Github Copilot is an AI coding-assistant tool.
51+
52+
GitHub Copilot supports your workflow by:
53+
- Suggesting code snippets and patterns
54+
- Helping predict correct imports
55+
- Maintaining consistent naming and formatting
56+
- Speeding up development
57+
58+
Additionally, since we have Copilot enabled as an automatic reviewer, once you enable Copilot as a reviewer, it will review your pull requests submitted to the Python SDK. This helps maintainers merge changes more quickly and is a great benefit to the project.
59+
60+
61+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Forking the Python SDK
2+
3+
To begin contributing to the Python SDK, you’ll first need your own copy of the repository.
4+
5+
Forking creates a personal, editable version of the SDK under your own GitHub account, where you can safely experiment and prepare pull requests without impacting the Python SDK.
6+
7+
### Steps to Fork the Python SDK
8+
9+
1. Navigate to the Python SDK Repository
10+
11+
Open the [Official Python SDK repository on GitHub](https://github.com/hiero-ledger/hiero-sdk-python)
12+
13+
2. Create Your Fork
14+
Make sure you are logged in to Github. Then, in the top-right of the repository page, click Fork.
15+
16+
GitHub will prompt you to confirm:
17+
- The destination account (your profile)
18+
- The name you want to give your fork (you can keep the default)
19+
20+
Click Create fork.
21+
22+
Your new fork will appear at:
23+
`https://github.com/<your-username>/<repository-name>`
24+
This is your copy of the Python SDK. You can also access it from your repository section on github online.
25+
26+
27+
3. Clone Your Fork Locally
28+
29+
You now have an online copy of the Python SDK but you also need a local copy to work on the code.
30+
31+
Using GitHub Desktop (recommended):
32+
1. Open GitHub Desktop.
33+
2. Go to File → Clone Repository
34+
3. Select the fork you just created under the “Your Repositories” tab.
35+
4. Choose a folder location on your machine and click Clone.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Syncing Your Repo with the Upstream Python SDK
2+
3+
Development at the Python SDK can be fast meaning new changes are added frequently.
4+
5+
It is important to frequently pull new changes at the Python SDK to your local repository to ensure you are working on the most updated code and avoid merge_conflicts.
6+
7+
To do this:
8+
9+
1. Link the Upstream Python SDK Remote with yours
10+
Link your fork to the upstream original Python SDK repository so you can easily bring in new updates from main.
11+
12+
```bash
13+
git remote add upstream https://github.com/hiero-ledger/hiero-sdk-python.git
14+
```
15+
16+
Then verify it is correctly set:
17+
```bash
18+
git remote -v
19+
```
20+
21+
You should now see:
22+
origin → your fork
23+
upstream → the official Python SDK repo
24+
25+
2. Before starting work and during a pull request, always fetch new changes:
26+
git checkout main
27+
git fetch upstream
28+
git pull upstream main
29+
30+
Then rebase on your working branch to apply the new changes:
31+
git checkout mybranch
32+
git rebase main -S
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Getting Assigned to an Issue
2+
3+
It is important to be assigned an issue before starting work on it or creating a pull request.
4+
5+
We recommend Good First Issues for developers new to the Python SDK. These are easier and better documented tasks.
6+
7+
To do that,
8+
1. Select a `Good First Issue` that interests you and is not yet assigned at [Python SDK Issues](https://github.com/hiero-ledger/hiero-sdk-python/issues)
9+
2. Write a comment at the bottom of the issue page asking "I want to be assigned to this issue"
10+
3. A maintainer will shortly assign you to the issue
11+
12+
Congratulations! You are assigned and can now get started on the work.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Working on a Newly Assigned Issue in a Branch
2+
3+
Once you are assigned to an issue, you can get started working on it.
4+
5+
We require developers to work on a new branch for each new issue they are working on. This helps to avoid major sync issues and keep history clean.
6+
7+
Before you create a branch, remember to pull in all recent changes from main:
8+
```bash
9+
git checkout main
10+
git fetch upstream
11+
git pull upstream main
12+
```
13+
14+
Then create a branch:
15+
```bash
16+
git checkout -b my-new-branch-name
17+
```
18+
19+
Commit all your changes on this new branch, then publish your branch and submit a pull request.
20+
21+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Commit Message Requirements for the Python SDK
2+
At the Python SDK we require commits to be descriptive and conventionally named in order to keep helpful records.
3+
4+
### Descriptive Commits
5+
A descriptive commit is one that summarises in words what was just commited.
6+
7+
This is correct:
8+
9+
```bash
10+
git commit -S -s -m "fix: fixed receipt status error catching in get_name"
11+
```
12+
13+
This is incorrect:
14+
15+
```bash
16+
git commit -S -s -m "looks like its mostly working now"
17+
```
18+
19+
### Conventional Commits
20+
Read about conventional commit messages here: [Conventional Commmits](https://www.conventionalcommits.org/en/v1.0.0/#summary)
21+
22+
This is correct:
23+
```bash
24+
git commit -S -s -m "chore: changelog entry to TokenCreateTransaction"
25+
```
26+
27+
This is incorrect:
28+
```bash
29+
git commit -S -s -m "feat: changelog entry to TokenCreateTransaction"
30+
```
31+
32+
This is incorrect:
33+
```bash
34+
git commit -S -s -m "changelog entry to TokenCreateTransaction"
35+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## DCO and GPG Verified Commit Signing Requirements for the Python SDK
2+
At the Python SDK we require **each** commit in a pull request to be:
3+
- DCO signed (this is achieved with a -s flag)
4+
- GPG key signed (this is achieved with a -S flag and a GPG key set up and tied to Github)
5+
6+
To pass our workflows and be merge-ready.
7+
8+
Therefore, use Terminal or a Command Line Interface when creating each commit and ensure the message is:
9+
```bash
10+
git commit -S -s -m "prefix: your commit message"
11+
```
12+
For example:
13+
```bash
14+
git commit -S -s -m "chore: changelog entry for TokenCreateTransaction"
15+
```
16+
17+
**WARNING**: using the default commit button on Github desktop or VS Studio will result in un-signed commits.
18+
19+
**WARNING** any merge or rebase operations will cause a loss of signing status unless you preserve signing: `git rebase main -S`
20+
21+
Read more about signing and how to set up a GPG key at:
22+
[Signing Guide](../../signing.md)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Breaking Changes and the Python SDK
2+
3+
Breaking changes are generally not acceptable in Python SDK development. This is because they can:
4+
- Stop existing Python SDK users’ code from working
5+
- Force users to spend time and resources updating their applications
6+
- Remove functionality that users may rely on, with no equivalent replacement
7+
8+
Breaking changes damage trust with our users and should be avoided whenever possible.
9+
10+
### Identifying Whether Your Pull Request Introduces a Breaking Change
11+
12+
Even if an issue does not mention breaking changes, a pull request may still introduce one.
13+
14+
Common examples include:
15+
- Removing or renaming an existing function or class
16+
- Changing the return type or structure of a function or method
17+
- Modifying the parameters a function accepts (adding, removing, or changing types)
18+
- Refactoring a function or class in a way that changes its behaviour, even subtly
19+
- Changing default values or altering side effects
20+
21+
When preparing a pull request, always evaluate whether any existing user code would stop working as a result of your changes even if its 'better'.
22+
23+
For example - before:
24+
```python
25+
def transfer_tokens(account_id: str, amount: int):
26+
...
27+
```
28+
29+
For example - after - breaking:
30+
```python
31+
def transfer_tokens(account_id: AccountId, amount: int, memo: str = None):
32+
...
33+
```
34+
User code passing a string account_id now fails, and adding a required memo parameter breaks all existing calls.
35+
36+
37+
## What to Do If a Breaking Change Is Unavoidable
38+
39+
Breaking changes should be avoided, but in rare cases they are necessary.
40+
41+
Examples include:
42+
- Correcting significant errors or faulty behaviour
43+
- Implementing new standards or APIs (such as HIPS)
44+
- Replacing deprecated functionality that cannot be maintained
45+
46+
If a breaking change must occur:
47+
- Clearly communicate it in your commit messages and changelog.
48+
- Provide a detailed explanation in the changelog.
49+
- When possible, implement or propose backwards compatibility solutions (deprecation warnings, transitional methods, alternative APIs, etc.).
50+
51+
Example changelog entry:
52+
53+
`BREAKING CHANGE: transfer_tokens() now requires an AccountId object instead of a string.`
54+
55+
56+
Breaking changes are typically scheduled for major releases, giving users time to prepare and migrate safely.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Changelog Entry Requirements for the Python SDK
2+
At the Python SDK we require a changelog entry in order to keep helpful records of what was added, changed, fixed or a breaking change for each release.
3+
4+
Key steps:
5+
1. Open 'CHANGELOG.md' found at the project root
6+
2. Add your bullet point entry under [UNRELEASED] and the appropriate subheader (Added, Changed, Fixed or Breaking Change)
7+
8+
Phrase it conventionally.
9+
10+
For example:
11+
12+
##[UNRELEASED]
13+
14+
### Added
15+
- Added `.github/workflows/merge-conflict-bot.yml` to automatically detect and notify users of merge conflicts in Pull Requests.
16+
17+
[Read more](../../changelog_entry.md) about creating changelog entries

0 commit comments

Comments
 (0)