You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project follows the Hyperledger contribution requirements. Please read this file before contributing.
3
+
We welcome contributions to the [Hyperledger Fabric](https://hyperledger-fabric.readthedocs.io) Project. There's always plenty to do!
4
4
5
-
Signed-off-by / DCO
6
-
--------------------
5
+
If you have any questions about the project or how to contribute, you can find us in the [fabric-chaincode-python](https://discord.gg/hyperledger-fabric) channel on [Discord](https://discord.lfdecentralizedtrust.org/).
7
6
8
-
This repository uses the Developer Certificate of Origin (DCO). All commits must be signed off using the `Signed-off-by:` trailer.
7
+
Here are a few guidelines to help you contribute successfully.
9
8
10
-
To sign off your commits locally, run:
9
+
## Issues
11
10
12
-
```bash
13
-
git commit -s -m "Your commit message"
14
-
# or when amending
15
-
git commit --amend -s --no-edit
16
-
```
11
+
All issues are tracked in the issues tab in GitHub. If you find a bug which we don't already know about, you can help us by creating a new issue describing the problem. Please include as much detail as possible to help us track down the cause. If you want to begin contributing code, looking through our open issues is a good way to start. Try looking for recent issues with detailed descriptions first, or ask us on Discord if you're unsure which issue to choose.
17
12
18
-
The sign-off will add a line like:
13
+
## Enhancements
19
14
20
-
```
21
-
Signed-off-by: Your Name <you@example.com>
22
-
```
15
+
Make sure you have the support of the Hyperledger Fabric community before investing a lot of effort in project enhancements. Please look up the [Fabric RFC](https://github.com/hyperledger/fabric-rfcs) process for large changes.
16
+
17
+
## Pull Requests
18
+
19
+
We use our own forks and [GitHub Flow](https://docs.github.com/en/get-started/using-github/github-flow) to deliver changes to the code. Follow these steps to deliver your first pull request:
20
+
21
+
1.[Fork the repository](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) and create a new branch from `main`.
22
+
2. If you've added code that should be tested, add tests!
23
+
3. If you've added any new features or made breaking changes, update the documentation.
24
+
4. Ensure all the tests pass.
25
+
5. Include a descriptive message and the [Developer Certificate of Origin (DCO) sign-off](https://github.com/dcoapp/app#how-it-works) on all commit messages.
26
+
6.[Issue a pull request](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project#making-a-pull-request)!
27
+
7.[GitHub Actions](https://github.com/hyperledger/fabric-chaincode-python/actions) builds must succeed before the pull request can be reviewed and coded.
28
+
29
+
## Coding Style
30
+
31
+
Please try to be consistent with the rest of the code. The project uses [ruff](https://docs.astral.sh/ruff/) for linting and [black](https://black.readthedocs.io/) for code formatting. You can run `python -m ruff check .` and `python -m black .` to check/format your code before submitting changes to avoid failing the build with formatting violations.
32
+
33
+
## Code of Conduct Guidelines
23
34
24
-
Make sure your Git `user.name` and `user.email` are configured correctly:
35
+
See our [Code of Conduct Guidelines](CODE_OF_CONDUCT.md).
25
36
26
-
```bash
27
-
git config --global user.name "Your Name"
28
-
git config --global user.email "you@example.com"
37
+
## Maintainers
38
+
39
+
Should you have any questions or concerns, please reach out to one of the project's [Maintainers](MAINTAINERS.md).
40
+
41
+
42
+
## How to work with the Codebase
43
+
44
+
Some useful commands to help with building and testing:
45
+
46
+
```shell
47
+
# Run all tests
48
+
pytest -v
49
+
50
+
# Run linting
51
+
python -m ruff check .
52
+
53
+
# Format code
54
+
python -m black .
55
+
56
+
# Build a wheel
57
+
python -m build --sdist --wheel
29
58
```
30
59
31
-
Protobuf bindings
32
-
--------------------
60
+
You can also scan for vulnerabilities in dependencies:
33
61
34
-
Bindings come from PyPI (`hyperledger-fabric-protos`) via `requirements.txt` - no extra steps needed.
62
+
```shell
63
+
make scan
64
+
```
35
65
36
-
If you need to test against unreleased `fabric-protos` changes, see `PROTOS.md` (`scripts/install_fabric_protos.sh` and `scripts/gen_protos.sh`).
66
+
## Hyperledger Fabric
37
67
68
+
See the
69
+
[Hyperledger Fabric contributors guide](http://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html) for more details, including other Hyperledger Fabric projects you may wish to contribute to.
38
70
39
-
Licensing
40
-
---------
71
+
---
41
72
42
-
This project is licensed under the Apache-2.0 license. By contributing you agree to license your contributions under the same terms.
- Experimental implementation of a Python chaincode shim and contract API.
8
-
- CI runs with Python 3.11; supported Python versions are 3.10 and 3.11.
9
+
# Hyperledger Fabric Chaincode shim and Contract API for Python
9
10
10
-
Requirements
11
-
------------
12
-
- Python 3.10+ (3.11 recommended)
13
-
- See `requirements.txt` for runtime dependencies
11
+
This repository provides the Python implementation of Hyperledger Fabric chaincode shim and contract API. Chaincodes (smart contracts) can be written in Python to run inside Hyperledger Fabric peers.
14
12
15
-
Quick start (development)
16
-
-------------------------
17
-
Clone the repository and create a virtual environment:
- Create a new token with "Entire repository" scope
111
-
- Copy the token (starts with `pypi-`)
108
+
2. Generate an API Token
109
+
- Log into PyPI
110
+
- Navigate to Account → API Tokens
111
+
- Create a new token with "Entire repository" scope
112
+
- Copy the token (starts with `pypi-`)
112
113
113
-
#### 3. Add GitHub Secret
114
+
3. Add GitHub Secret
114
115
115
116
```bash
116
117
gh secret set PYPI_API_TOKEN --repo kmilodenisglez/fabric-chaincode-python
117
118
# Paste the token when prompted
118
119
```
119
120
120
121
Verify the secret is set:
122
+
121
123
```bash
122
124
gh secret list --repo kmilodenisglez/fabric-chaincode-python
123
125
```
124
126
125
127
### Publishing Process
126
128
127
129
Once the PyPI token is configured, releases automatically:
128
-
1. Build the wheel
129
-
2. Attempt to publish to PyPI (continues on error if token is invalid/missing)
130
+
131
+
1. Build the wheel and sdist
132
+
2. Publish to PyPI using [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) (OIDC-based, no need for static token in workflow)
0 commit comments