|
1 | 1 | # nx-os-grpc-python
|
| 2 | + |
| 3 | +[](https://opensource.org/licenses/Apache-2.0) |
| 4 | +[](https://github.com/ambv/black) |
| 5 | + |
2 | 6 | NX-OS gRPC Python connectivity library. Proto files sourced from [documentation](https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus9000/sw/7-x/programmability/guide/b_Cisco_Nexus_9000_Series_NX-OS_Programmability_Guide_7x/b_Cisco_Nexus_9000_Series_NX-OS_Programmability_Guide_7x_chapter_010111.html#id_41517).
|
3 | 7 |
|
4 | 8 | ## Development
|
5 |
| -Requires Python and `pipenv`. |
| 9 | +Requires Python and recommends `pipenv`. Manual usage of `pip`/`virtualenv` is not covered. Uses `black` for code formatting and `pylint` for code linting. |
| 10 | + |
| 11 | +### Get Source |
6 | 12 |
|
7 | 13 | ```bash
|
8 | 14 | git clone https://github.com/cisco-grpc-connection-libs/nx-os-grpc-python.git
|
9 | 15 | cd nx-os-grpc-python
|
10 |
| -# If Pipenv not installed... |
| 16 | +# If pipenv not installed, install! |
11 | 17 | pip install --user pipenv
|
| 18 | +# Now use pipenv, source from lockfile |
| 19 | +pipenv --three install --dev --ignore-pipfile |
| 20 | +# If that doesn't work.. |
12 | 21 | pipenv --three install --dev
|
| 22 | +# If you encounter an issue locking dependencies... |
| 23 | +./lock_deps.sh |
| 24 | +# Enter virtual environment |
13 | 25 | pipenv shell
|
14 | 26 | # Do your thing.
|
15 | 27 | exit
|
16 | 28 | ```
|
17 | 29 |
|
18 |
| -## TLS Usage |
19 |
| -TODO: Where to acquire gRPC Agent RPM? |
20 |
| -In order to use a secure channel you must acquire the necessary gRPC PEM files, `grpc.pem`. This PEM file is found with your downloaded gRPC Agent RPM. You must then specify the file path or the content of this PEM file when initializing the Client class. |
| 30 | +### Clean Code |
| 31 | +We use [`black`](https://github.com/ambv/black) for code formatting and `pylint` for code linting. `clean_code.sh` will run `black` against all of the code under `nxos_grpc/` except for `protoc` compiled protobufs, and run `pylint` against Python files directly under `nxos_grpc/`. They don't totally agree, and we aren't using perfect naming conventions in some cases, so we're not looking for perfection here. |
| 32 | + |
| 33 | +```bash |
| 34 | +./clean_code.sh |
| 35 | +``` |
| 36 | + |
| 37 | +TODO: Add pre-commit hook to automatically run black if any Python files are being committed. |
21 | 38 |
|
22 | 39 | ### Recompile Protobufs
|
23 | 40 | If a new `nxos_grpc.proto` definition is released, use `update_protos.sh` to recompile. If breaking changes are introduced the wrapper library must be updated.
|
24 | 41 |
|
25 | 42 | ```bash
|
26 |
| -pipenv shell |
27 | 43 | ./update_protos.sh
|
28 |
| -exit |
29 | 44 | ```
|
| 45 | + |
| 46 | + |
| 47 | +## TLS Usage |
| 48 | +In order to use a secure channel you must acquire the necessary gRPC PEM files, `grpc.pem`. This PEM file is found with your downloaded gRPC Agent RPM. You must then specify the file path or the content of this PEM file when initializing the Client class. |
| 49 | + |
| 50 | +TODO: Where to acquire gRPC Agent RPM? |
0 commit comments