|
1 | | -# fabric-chaincode-python |
| 1 | +# Hyperledger Fabric Chaincode Python |
| 2 | + |
| 3 | + |
| 4 | +[](https://bestpractices.coreinfrastructure.org/projects/14928) |
| 5 | +[](https://scorecard.dev/viewer/?uri=github.com/hyperledger/fabric-chaincode-python) |
2 | 6 |
|
3 | | -[](https://github.com/hyperledger/fabric-chaincode-python/blob/main/lifecycle.md) |
4 | 7 | [](https://pypi.org/project/fabric-chaincode-python/) |
5 | | -[](https://opensource.org/licenses/Apache-2.0) |
6 | 8 | [](https://github.com/hyperledger/fabric-chaincode-python/actions?query=workflow%3ACI) |
7 | 9 | [](https://github.com/hyperledger/fabric-chaincode-python/releases) |
8 | 10 |
|
9 | | -# Hyperledger Fabric Chaincode shim and Contract API for Python |
10 | | - |
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. |
| 11 | +This is a Python based implementation of Hyperledger Fabric chaincode shim and contract |
| 12 | +API, which enables development of smart contracts using the Python language. Chaincodes |
| 13 | +(smart contracts) written in Python run inside Hyperledger Fabric peers. |
12 | 14 |
|
13 | 15 | ## Documentation |
14 | 16 |
|
15 | | -- API documentation: https://hyperledger.github.io/fabric-chaincode-python/ |
16 | | -- Full Documentation on Hyperledger Fabric: https://hyperledger-fabric.readthedocs.io/ |
17 | | -- Samples repository: https://github.com/hyperledger/fabric-samples |
18 | | -- Quick-start tutorial: TUTORIAL.md |
| 17 | +- [API documentation](https://hyperledger.github.io/fabric-chaincode-python/) |
| 18 | +- [Full Hyperledger Fabric documentation](https://hyperledger-fabric.readthedocs.io/) |
| 19 | +- [Samples repository](https://github.com/hyperledger/fabric-samples) |
| 20 | + |
| 21 | +## Project structure |
| 22 | + |
| 23 | +``` |
| 24 | +src/ |
| 25 | +├── fabric_contract_api/ Python Contract API |
| 26 | +└── fabric_shim/ Python chaincode shim (Fabric 2.x) |
| 27 | +``` |
| 28 | + |
| 29 | +- **fabric_contract_api** - Contains the Python contract API used to write smart contracts with the high-level contract programming model. |
| 30 | +- **fabric_shim** - Contains the Python classes that implement the chaincode shim API and the way to communicate with Fabric peers. |
19 | 31 |
|
20 | | -## Compatibility |
| 32 | +## Building and testing |
21 | 33 |
|
22 | | -For details on what Python versions and Hyperledger Fabric versions can be used, see the [COMPATIBILITY.md](COMPATIBILITY.md). |
| 34 | +Make sure you have the following prereqs installed: |
23 | 35 |
|
24 | | -## npm Shrinkwrap |
| 36 | +- [Python](https://www.python.org/) 3.11 or later |
| 37 | +- [pip](https://pip.pypa.io/en/stable/) |
25 | 38 |
|
26 | | -Strongly recommended to create a `requirements.txt` file after testing and before putting your contract into production. |
| 39 | +Create a virtual environment and install the development dependencies: |
| 40 | + |
| 41 | +``` |
| 42 | +python3 -m venv .venv |
| 43 | +source .venv/bin/activate |
| 44 | +pip install -e . -r requirements-dev.txt |
| 45 | +``` |
| 46 | + |
| 47 | +Run the unit tests: |
| 48 | + |
| 49 | +``` |
| 50 | +pytest tests/ |
| 51 | +``` |
27 | 52 |
|
28 | 53 | ## Contributing |
29 | 54 |
|
30 | | -If you are interested in contributing updates to this project, please start with the [contributing guide](CONTRIBUTING.md). |
| 55 | +We welcome contributions to the Hyperledger Fabric project in many forms. If you are |
| 56 | +interested in contributing updates to this project, please start with the |
| 57 | +[contributing guide](CONTRIBUTING.md). |
| 58 | + |
| 59 | +There is also a [release guide](RELEASING.md) describing the process for publishing new |
| 60 | +versions. |
| 61 | + |
| 62 | +## Community |
31 | 63 |
|
32 | | -There is also a [release guide](RELEASING.md) describing the process for publishing new versions. |
| 64 | +- [Hyperledger Community](https://www.hyperledger.org/community) |
| 65 | +- [Hyperledger mailing lists and archives](http://lists.hyperledger.org/) |
| 66 | +- [Hyperledger Chat](http://chat.hyperledger.org/channel/fabric) |
| 67 | +- [Hyperledger Fabric Wiki](https://wiki.hyperledger.org/display/Fabric) |
| 68 | +- [Hyperledger Code of Conduct](CODE_OF_CONDUCT.md) |
33 | 69 |
|
34 | | -## Build Status |
| 70 | +## License <a name="license"></a> |
35 | 71 |
|
36 | | -CI runs with Python 3.11 on `main` and `release-*` branches, and on pull requests. |
| 72 | +Hyperledger Project source code files are made available under the Apache License, |
| 73 | +Version 2.0 (Apache-2.0), located in the [LICENSE](LICENSE) file. Hyperledger Project |
| 74 | +documentation files are made available under the Creative Commons Attribution 4.0 |
| 75 | +International License (CC-BY-4.0), available at |
| 76 | +http://creativecommons.org/licenses/by/4.0/. |
0 commit comments