Skip to content

Commit cec51d7

Browse files
Ilya Bogdanovdmitry-timofeev
authored andcommitted
Update README.md and setup.py for Python modules [ECR-3992] (#1296)
* Prepare python modules for release Fix Readme with recent changes in docs Fix setup.py * Update version in setup.py
1 parent 90e57f2 commit cec51d7

2 files changed

Lines changed: 36 additions & 124 deletions

File tree

exonum-java-binding/exonum_launcher_java_plugins/README.md

Lines changed: 11 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@
66

77
## Installation
88

9-
#### Requirements
9+
### Requirements
1010

1111
- [Python3](https://www.python.org/downloads/)
1212

13+
### Using PyPI
14+
15+
```bash
16+
pip3 install exonum-launcher-java-plugins
17+
```
18+
19+
### From Source
20+
1321
```bash
1422
# Generate sources
1523
source ./tests_profile
@@ -20,122 +28,9 @@ python3 -m pip install -e exonum_launcher_java_plugins
2028

2129
## Usage
2230

23-
TODO: Move the entire section to the EJB App tutorial.
24-
25-
To deploy and start a specific list of services, use the following command with the
26-
prepared `config.yml` file:
27-
28-
```bash
29-
python3 -m exonum_launcher -i config.yml
30-
```
31-
32-
### Writing Configuration File
33-
34-
Start with specifying IP addresses of the blockchain nodes:
35-
36-
```yaml
37-
networks:
38-
- host: "127.0.0.1"
39-
ssl: false
40-
public-api-port: 8080
41-
private-api-port: 8081
42-
```
43-
44-
You need to specify every node for which you have an access to its private API port. If you
45-
do not have an access to every node in the network, the administrators of other nodes must
46-
run `exonum-launcher` with the same configuration file (with a different list of available nodes).
47-
48-
Deadline height describes the maximum blockchain height for the deployment process. Make sure to
49-
specify the value larger than the current blockchain height.
50-
51-
```yaml
52-
deadline_height: 20000
53-
```
54-
55-
Enable Java runtime by specifying its identifier (`1`). Rust runtime is enabled by default:
56-
57-
```yaml
58-
runtimes:
59-
java: 1
60-
```
61-
62-
Add artifacts you want to deploy. For each artifact, you need to specify its name alias
63-
(as YAML key) and its runtime (using `runtime` field). Name aliases are used in other parts
64-
of configuration for readability and easier refactoring. Java artifacts also need name of the
65-
`jar` file in the `spec: artifact_filename` field. In our example we add the Java
66-
`cryptocurrency-demo` service, and two Rust services - the `timestamping` and `time` oracle services.
67-
68-
```yaml
69-
artifacts:
70-
cryptocurrency:
71-
runtime: java
72-
name: "com.exonum.examples:cryptocurrency:0.10.0-SNAPSHOT"
73-
spec:
74-
artifact_filename: "exonum-java-binding-cryptocurrency-demo-0.10.0-SNAPSHOT-artifact.jar"
75-
time:
76-
runtime: rust
77-
name: "exonum-time:0.13.0-rc.2"
78-
timestamping:
79-
runtime: rust
80-
name: "exonum-timestamping:0.13.0-rc.2"
81-
```
82-
83-
Add a `plugins` section to enable both Java Runtime plugin and Instance Configuration plugin.
84-
Runtime plugin is enabled for a specific runtime (`java` in our example), while Instance
85-
Configuration plugin is enabled for a specific artifact name alias (`timestamping` in our example).
86-
87-
```yaml
88-
plugins:
89-
runtime:
90-
java: "exonum_java_runtime_plugin.JavaDeploySpecLoader"
91-
artifact:
92-
timestamping: "exonum_instance_configuration_plugin.InstanceSpecLoader"
93-
```
94-
95-
In our example we will use the Instance Configuration plugin to serialize initial configuration parameters of
96-
the `timestamping` service in Protobuf. We need to take a `service.proto` file with the message
97-
description from the service sources and place it inside some known directory.
98-
99-
```proto
100-
syntax = "proto3";
101-
102-
package exonum.examples.timestamping;
103-
104-
message Config {
105-
string time_service_name = 1;
106-
}
107-
```
108-
109-
Finally, add an `instances` section that describes the list of service instances you want to
110-
start in the blockchain. For each instance you need to specify its artifact name alias.
111-
Instance Configuration plugin also requires a list of additional parameters, which we
112-
provide for the `timestamping` instance:
113-
114-
- `sources`. Points to a directory with the Protobuf sources of the service configuration
115-
message. We use the `proto_sources` directory.
116-
- `config_message_source`. A file name where the `message_name` message
117-
is located. In our example we use the `service.proto` file.
118-
- `message_name`. A name of the Protobuf message used to represent the service configuration.
119-
Optional, defaults to `Config`.
120-
- `data`. Your actual configuration in the format corresponding to the `message_name` message.
121-
122-
```yaml
123-
instances:
124-
cryptocurrency:
125-
artifact: cryptocurrency
126-
time:
127-
artifact: time
128-
timestamping:
129-
artifact: timestamping
130-
config:
131-
sources: "proto_sources"
132-
config_message_source: "service.proto"
133-
message_name: "Config"
134-
data:
135-
time_service_name: "time"
136-
```
31+
See [Deploy and Start the Service][deploy-and-start].
13732

138-
See [sample-config.yml](sample-config.yml) for the final state of the configuration file.
33+
[deploy-and-start]: https://exonum.com/doc/version/0.13-rc.2/get-started/java-binding/#deploy-and-start-the-service
13934

14035
# License
14136

exonum-java-binding/exonum_launcher_java_plugins/setup.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,35 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
from distutils.core import setup
17+
import setuptools
1818

19-
install_requires = ["exonum-launcher"]
19+
INSTALL_REQUIRES = ["exonum-launcher"]
2020

21-
python_requires = ">=3.6"
21+
PYTHON_REQUIRES = ">=3.6"
2222

23-
setup(
23+
with open("README.md", "r") as readme:
24+
LONG_DESCRIPTION = readme.read()
25+
26+
setuptools.setup(
2427
name="exonum_launcher_java_plugins",
2528
version="0.10.0-SNAPSHOT",
26-
description="Exonum Java plugins for exonum_launcher",
29+
author="The Exonum team",
30+
author_email="contact@exonum.com",
31+
description="Exonum Java plugins for exonum-launcher",
32+
long_description=LONG_DESCRIPTION,
33+
long_description_content_type="text/markdown",
2734
url="https://github.com/exonum/exonum-java-binding",
28-
packages=["exonum_java_runtime_plugin", "exonum_instance_configuration_plugin"],
29-
install_requires=install_requires,
30-
python_requires=python_requires,
35+
packages=[
36+
"exonum_java_runtime_plugin",
37+
"exonum_java_runtime_plugin.proto",
38+
"exonum_instance_configuration_plugin",
39+
],
40+
install_requires=INSTALL_REQUIRES,
41+
python_requires=PYTHON_REQUIRES,
42+
classifiers=[
43+
"Programming Language :: Python :: 3",
44+
"License :: OSI Approved :: Apache Software License",
45+
"Operating System :: OS Independent",
46+
"Topic :: Security :: Cryptography",
47+
],
3148
)

0 commit comments

Comments
 (0)