Skip to content

Commit b5c2cc9

Browse files
authored
Merge branch 'main' into clean-priority-critical-fix
2 parents d079a90 + bd98fd3 commit b5c2cc9

7 files changed

Lines changed: 126 additions & 23 deletions

File tree

.github/workflows/pr-check-primary-codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
egress-policy: audit
4343

4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
45+
uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.3.5
4646
with:
4747
languages: ${{ matrix.language }}
4848
build-mode: ${{ matrix.build-mode }}
@@ -66,6 +66,6 @@ jobs:
6666
run: uv sync --all-extras --dev
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
69+
uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.3.5
7070
with:
7171
category: "/language:${{matrix.language}}"

.github/workflows/publish.yml

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
build-and-publish:
12+
build:
13+
name: Build distributions
1314
runs-on: hl-sdk-py-lin-md
14-
environment:
15-
name: pypi
16-
url: https://pypi.org/p/hiero-sdk-python
17-
permissions:
18-
id-token: write
15+
1916
steps:
2017
- name: Harden the runner (Audit all outbound calls)
2118
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
@@ -42,5 +39,64 @@ jobs:
4239
- name: Build wheel and sdist
4340
run: python -m build
4441

42+
- name: Upload distributions
43+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
44+
with:
45+
name: dist
46+
path: dist/*
47+
if-no-files-found: error
48+
49+
publish-and-sign:
50+
name: Publish and sign release artifacts
51+
needs: build
52+
concurrency:
53+
group: ${{ github.workflow }}-${{ github.ref }}
54+
cancel-in-progress: false
55+
runs-on: hl-sdk-py-lin-md
56+
environment:
57+
name: pypi
58+
url: https://pypi.org/p/hiero-sdk-python
59+
permissions:
60+
contents: write
61+
id-token: write
62+
63+
steps:
64+
- name: Harden the runner (Audit all outbound calls)
65+
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
66+
with:
67+
egress-policy: audit
68+
69+
- name: Download distributions
70+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
71+
with:
72+
name: dist
73+
path: dist
74+
75+
- name: Sign release distributions with Sigstore
76+
uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc # v3.3.0
77+
with:
78+
inputs: |
79+
dist/*.whl
80+
dist/*.tar.gz
81+
verify: true
82+
verify-cert-identity: https://github.com/${{ github.repository }}/.github/workflows/publish.yml@refs/tags/${{ github.ref_name }}
83+
verify-oidc-issuer: https://token.actions.githubusercontent.com
84+
4585
- name: Publish to PyPI
4686
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
87+
with:
88+
skip-existing: true
89+
90+
- name: Upload signed assets to GitHub Release
91+
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
92+
with:
93+
body: |
94+
## Important notes
95+
- See https://github.com/hiero-ledger/hiero-sdk-python/milestones for the pull requests included in this milestone.
96+
- This release includes auto-generated release notes.
97+
files: |
98+
dist/*.whl
99+
dist/*.tar.gz
100+
dist/*.sigstore.json
101+
fail_on_unmatched_files: true
102+
generate_release_notes: true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ We welcome blog posts! Whether you're sharing a tutorial, case study, or your ex
106106
| [Rebasing](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/rebasing.md) | Keeping branch updated |
107107
| [Merge Conflicts](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/merge_conflicts.md) | Resolving conflicts |
108108
| [Types](docs/sdk_developers/types.md) | Python type hints |
109-
| [Linting](docs/sdk_developers/linting.md) | Code quality tools |
109+
| [Linting](docs/sdk_developers/ruff.md) | Code quality tools |
110110

111111
---
112112

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ print(f"Balance: {balance.hbars} HBAR")
7272
- **[Rebasing Guide](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/rebasing.md)** - Keep your branch up-to-date
7373
- **[Merge Conflicts Guide](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/merge_conflicts.md)** - Resolve conflicts
7474
- **[Typing Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/types.md)** - Python type hints
75-
- **[Linting Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/linting.md)** - Code quality tools
75+
- **[Linting Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/ruff.md)** - Code quality tools
7676

7777
### Hedera Network Resources
7878

RELEASE.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@ MAJOR.MINOR.PATCH
1919
1. **Update the Version**
2020
Decide whether the changes are major, minor, or patch increments.
2121

22-
2. **Update the Changelog**
23-
Move your entries from the **[Unreleased]** section in `CHANGELOG.md` to a new version heading with today’s date (e.g., `## [0.2.0] - 2025-02-20`).
24-
25-
3. **Create a Release Branch**
26-
- `release-v0.2.0` or similar (e.g., `release-v0.2.0-beta.1` for beta versions).
27-
28-
4. **Run Tests**
22+
2. **Run Tests**
2923
- Ensure all tests pass locally (run `pytest`).
3024
- Confirm CI passes (integration tests, etc.).
3125

32-
5. **Merge into `main`**
33-
- Create a Pull Request from `release-vX.X.X` into `main`.
34-
- Wait for code review, ensure everything is green.
26+
3. **Tag the Release**
27+
Once the release changes are merged, create and push a git tag that matches the publish workflow trigger (`v*.*.*`):
3528

36-
6. **Tag the Release**
37-
Once merged, create a git tag with the new version:
3829
```bash
3930
git tag -a v0.2.0 -m "Release 0.2.0"
4031
git push origin v0.2.0
32+
```
33+
34+
4. **Monitor the Publish Workflow**
35+
- The `.github/workflows/publish.yml` workflow runs automatically when the tag is pushed.
36+
- The workflow builds the source distribution and wheel, generates protobufs before packaging, signs the release artifacts with Sigstore, publishes the package to PyPI, and creates or updates the GitHub release.
37+
38+
5. **Verify Published Artifacts**
39+
- Confirm the new version is available on PyPI.
40+
- Confirm the GitHub release contains the wheel, source distribution, and matching `.sigstore.json` bundles.
41+
- If release provenance needs to be audited, use the Sigstore verification materials attached to the GitHub release.

docs/sdk_developers/ruff.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,33 @@ uv run ruff check . && uv run ruff format --check .
100100
}
101101
```
102102

103+
104+
## 🛠️ Handling Linting Issues
105+
106+
### Manual vs. Automatic Fixes
107+
108+
Ruff is smart, but it won't change your code if it might break logic.
109+
110+
- **Auto-Fixed:** Unused imports, unsorted imports (Isort-style), and basic whitespace.
111+
112+
- **Manual Action Required:** Complex issues like unused function arguments (`ARG001`), overly complex logic (`C901`), or missing docstrings. You must refactor these yourself based on the terminal output.
113+
114+
115+
### Ignoring Rules (Suppressing Warnings)
116+
117+
Sometimes, a linter rule conflicts with a specific technical requirement. You can tell Ruff to ignore a line using the `# noqa` comment followed by the error code.
118+
119+
```python
120+
# Ignore a specific error on a line
121+
import unused_module # noqa: F401
122+
123+
# Ignore multiple errors on a line
124+
x = 1 # noqa: E701, F841
125+
```
126+
Each error has a code. You can look up the full details of any code in the [Ruff Documentation](https://docs.astral.sh/ruff/rules/).
127+
128+
> **Global Ignore:** To disable linting for an entire file (e.g., an auto-generated file), add `# ruff: noqa` to the very top
129+
103130
## 📝 Example Output
104131
**When issues are found:**
105132

docs/sdk_developers/setup.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ This guide walks you through setting up your development environment for contrib
88
- [Installation](#installation)
99
- [Installing from PyPI](#installing-from-pypi)
1010
- [Installing from Source](#installing-from-source)
11-
- [Local Editable Installation](#local-editable-installation)
11+
- [Install Dependencies](#install-dependencies)
12+
- [Installing Optional Dependencies](#installing-optional-dependencies)
13+
- [Pre-Commit Tool Setup](#pre-commit-tool-setup)
1214
- [Generate Protocol Buffers](#generate-protocol-buffers)
1315
- [Environment Setup](#environment-setup)
1416
- [Setup Checklist](#examples)
@@ -178,6 +180,9 @@ uv sync --dev --all-extras
178180

179181
To maintain high code quality and security, this repository uses `re-commit` hooks. These hooks automatically run checks (like `Ruff` for linting and `Gitleaks` for security) every time you attempt to commit code.
180182

183+
### Installation
184+
---
185+
181186
**Option 1: Using `uv` (Recommended)**
182187

183188
`uv` is recommended because it manages pre-commit within your project’s locked environment, ensuring your local linting matches the CI exactly.
@@ -210,6 +215,20 @@ Once installed, `git commit` will automatically trigger the checks.
210215
- If they **pass**: Your commit is created normally.
211216
- If they **fail**: The hooks will often fix the files for you (e.g., `Ruff` reformatting). Simply `git add` the changed files and commit again.
212217

218+
219+
### Manual Execution
220+
---
221+
To run the hooks manually at any time:
222+
223+
```
224+
# Run against only changed files
225+
uv run pre-commit run
226+
227+
# Run against every file in the repository
228+
uv run pre-commit run --all-files
229+
```
230+
231+
213232
## Generate Protocol Buffers
214233

215234
The SDK uses protocol buffers to communicate with the Hedera network. Generate the Python code from the protobuf definitions:

0 commit comments

Comments
 (0)