9
9
[ ![ Documentation Status] ( https://readthedocs.org/projects/py-ms/badge/?version=latest )] ( https://py-ms.readthedocs.io/en/latest/?badge=latest )
10
10
[ ![ Gitter] ( https://img.shields.io/gitter/room/DAVFoundation/DAV-Contributors.svg )] ( https://gitter.im/python-microservices/pyms )
11
11
12
-
13
- PyMS, Python MicroService, is a [ Microservice chassis pattern] ( https://microservices.io/patterns/microservice-chassis.html )
14
- like Spring Boot (Java) or Gizmo (Golang). PyMS is a collection of libraries, best practices and recommended ways to build
15
- microservices with Python which handles cross-cutting concerns:
12
+ PyMS, Python MicroService, is a [ Microservice chassis pattern] ( https://microservices.io/patterns/microservice-chassis.html )
13
+ like Spring Boot (Java) or Gizmo (Golang). PyMS is a collection of libraries, best practices and recommended ways to build
14
+ microservices with Python which handles cross-cutting concerns:
16
15
17
16
- Externalized configuration
18
17
- Logging
19
18
- Health checks
20
19
- Metrics
21
20
- Distributed tracing
22
21
23
- PyMS is powered by [ Flask] ( https://flask.palletsprojects.com/en/1.1.x/ ) , [ Connexion] ( https://github.com/zalando/connexion )
22
+ PyMS is powered by [ Flask] ( https://flask.palletsprojects.com/en/1.1.x/ ) , [ Connexion] ( https://github.com/zalando/connexion )
24
23
and [ Opentracing] ( https://opentracing.io/ ) .
25
24
26
25
Get started with [ Installation] ( ./docs/installation.md ) and then get an overview with the [ Quickstart] ( ./docs/quickstart.md ) .
27
26
28
27
## Documentation
29
28
30
- To know how use, install or build a project see the [ docs] ( https://py-ms.readthedocs.io/en/latest/ ) .
29
+ To know how to use, install or build a project see the [ docs] ( https://py-ms.readthedocs.io/en/latest/ ) .
31
30
32
31
## Motivation
33
32
34
- When we started to create microservice with no idea, we were looking for tutorials, guides, best practices, but we found
33
+ When we started creating a microservice with no idea, we were looking for tutorials, guides, best practices, but we found
35
34
nothing to create professional projects. Most articles say:
36
35
37
36
- "Install flask"
38
37
- "Create routes"
39
38
- (Sometimes) "Create a swagger specs"
40
39
- "TA-DA! you have a microservice"
41
40
42
- But... what happens with our configuration out of code like Kubernetes configmap? what happens with transactionality?
41
+ But... what happens with our configuration out of code like Kubernetes configmap? what happens with transactionality?
43
42
If we have many microservices, what happens with traces?.
44
43
45
- There are many problems around Python and microservices and we can` t find anyone to give a solution.
44
+ There are many problems around Python and microservices and we can' t find anyone to give a solution.
46
45
47
- We start creating these projects to try to solve all the problems we have found in our professional lives about
46
+ We start creating these projects to try to solve all the problems we have found in our professional lives about
48
47
microservices architecture.
49
48
50
- Nowadays, is not perfect and we have a looong roadmap, but we hope this library could help other fellas and friends ;)
49
+ Nowadays, is not perfect and we have a looong roadmap, but we hope this library could help other fellas and friends ;)
51
50
52
51
## Installation
53
52
54
53
``` bash
55
54
pip install py-ms[all]
56
55
```
57
56
58
- # Quickstart
57
+ ## Quickstart
59
58
60
59
You need to create 2 files: main.py and config.yml:
61
60
@@ -93,27 +92,27 @@ pyms:
93
92
SECRET_KEY : " gjr39dkjn344_!67#"
94
93
` ` `
95
94
96
- ### So what did that code do?
95
+ ## So what did that code do?
97
96
98
- 1. Create a instance of PyMS Microservice class (#1.1). This initialization inject the configuration defined in the
97
+ 1. Create a instance of PyMS Microservice class (#1.1). This initialization injects the configuration defined in the
99
98
1.3 block and could be accessed through current_app.config like typical
100
99
[Flask config](https://flask.palletsprojects.com/en/1.1.x/config/).
101
100
Then, initialize the service defined in the 1.2 block. See [Services](./docs/services.md) for more details.
102
101
103
- 2. Initialize [Flask](https://flask.palletsprojects.com/en/1.1.x/) instance, [Connexion](https://github.com/zalando/connexion)
102
+ 2. Initialize a [Flask](https://flask.palletsprojects.com/en/1.1.x/) instance, [Connexion](https://github.com/zalando/connexion)
104
103
if it was defined in the pyms configuration block, create a tracer, add health-check blueprint, initialize libs and set
105
- the PyMS Microservice in ` ms` attribute and you can access to it with `current_app.ms`.
104
+ the PyMS Microservice in ` ms` attribute and you can access to it with `current_app.ms`.
106
105
This steps has their each functions and you can easy
107
106
override it.
108
107
109
- 3. `create_app` return the flask instance and you can interact with it as a typical flask app
108
+ 3. `create_app` returns the flask instance which you can interact with as a typical flask app
110
109
111
110
See [Documentation](https://py-ms.readthedocs.io/en/latest/) to learn more.
112
111
113
112
# # Create a project from scaffold
114
113
115
114
PyMS has a command line option to create a project template like [Microservices Scaffold](https://github.com/python-microservices/microservices-scaffold).
116
- This command use [cookiecutter](https://github.com/cookiecutter/cookiecutter) to download and install this [template](https://github.com/python-microservices/microservices-template)
115
+ This command uses [cookiecutter](https://github.com/cookiecutter/cookiecutter) to download and install this [template](https://github.com/python-microservices/microservices-template)
117
116
118
117
**[Warning]** You must run first `pip install cookiecutter==1.7.0`
119
118
@@ -124,27 +123,28 @@ pyms startproject
124
123
this output a lot of options step by step :
125
124
126
125
` ` ` bash
127
- project_repo_url [https://github.com/python-microservices/microservices-scaffold]:
126
+ project_repo_url [https://github.com/python-microservices/microservices-scaffold]:
128
127
project_name [Python Microservices Boilerplate]: example project
129
- project_folder [example_project]:
130
- project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]:
131
- create_model_class [y]:
132
- microservice_with_swagger_and_connexion [y]:
133
- microservice_with_traces [y]:
134
- microservice_with_metrics [y]:
135
- application_root [/example_project]:
128
+ project_folder [example_project]:
129
+ project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]:
130
+ create_model_class [y]:
131
+ microservice_with_swagger_and_connexion [y]:
132
+ microservice_with_traces [y]:
133
+ microservice_with_metrics [y]:
134
+ application_root [/example_project]:
136
135
Select open_source_license:
137
136
1 - MIT license
138
137
2 - BSD license
139
138
3 - ISC license
140
139
4 - Apache Software License 2.0
141
140
5 - GNU General Public License v3
142
141
6 - Not open source
143
- Choose from 1, 2, 3, 4, 5, 6 [1]:
142
+ Choose from 1, 2, 3, 4, 5, 6 [1]:
144
143
` ` `
145
144
146
- When you finish to introduce the options, a project will be created in `[project_folder]` folder
145
+ When you finish introducing the options, a project will be created in `[project_folder]` folder
147
146
148
147
# # How To contribute
148
+
149
149
We appreciate opening issues and pull requests to make PyMS even more stable & useful! See [This doc](CONTRIBUTING.md)
150
150
for more details.
0 commit comments