Skip to content

Commit 1fa9d99

Browse files
authored
Moved docs to other repo (#220)
* docs: moved docs to other repo * docs: updated readme * docs: updated docstrings * fix: GHA python 3.6
1 parent d4e8683 commit 1fa9d99

35 files changed

+27
-2106
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ on:
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615
strategy:
1716
matrix:
18-
python-version: [3.7, 3.8]
19-
17+
python-version: [3.6, 3.7, 3.8]
2018
steps:
2119
- uses: actions/checkout@v2
2220
- name: Set up Python ${{ matrix.python-version }}
@@ -27,8 +25,7 @@ jobs:
2725
run: |
2826
python -m pip install --upgrade pip
2927
pip install pipenv
30-
pipenv lock --dev --requirements > requirements.txt
31-
pip install -r requirements.txt
28+
pipenv install --dev --system
3229
- name: Test with pytest
3330
run: |
3431
python setup.py test

.readthedocs.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,6 @@
11
# Contributing
22

3-
## Branch workflow
4-
5-
**READ BEFORE CREATE A BRANCH OR OPEN A PR/MR**
6-
- We use [Github Glow](https://guides.github.com/introduction/flow/)
7-
8-
9-
## Commit Message Guidelines
10-
11-
- The messages of the commits use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
12-
- See [Angular guideline](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines)
13-
14-
15-
## Installation
16-
17-
After cloning this repo, create a [virtualenv](https://virtualenv.pypa.io/en/stable/) and ensure dependencies are installed by running:
18-
19-
```sh
20-
virtualenv venv
21-
source venv/bin/activate
22-
pip install -e ".[test]"
23-
```
24-
25-
Well-written tests and maintaining good test coverage is important to this project. While developing, run new and existing tests with:
26-
27-
```sh
28-
pytest --cov=pyms --cov=tests tests/
29-
```
30-
31-
Add the `-s` flag if you have introduced breakpoints into the code for debugging.
32-
Add the `-v` ("verbose") flag to get more detailed test output. For even more detailed output, use `-vv`.
33-
Check out the [pytest documentation](https://docs.pytest.org/en/latest/) for more options and test running controls.
34-
35-
PyMS supports several versions of Python3. To make sure that changes do not break compatibility with any of those versions, we use `tox` to create virtualenvs for each Python version and run tests with that version. To run against all Python versions defined in the `tox.ini` config file, just run:
36-
37-
```sh
38-
tox
39-
```
40-
41-
If you wish to run against a specific version defined in the `tox.ini` file:
42-
43-
```sh
44-
tox -e py36
45-
```
46-
47-
Tox can only use whatever versions of Python are installed on your system. When you create a pull request, Travis will also be running the same tests and report the results, so there is no need for potential contributors to try to install every single version of Python on their own system ahead of time.
48-
49-
## Pipenv
50-
51-
### Advantages over plain pip and requirements.txt
52-
[Pipenv](https://pipenv.readthedocs.io/en/latest/) generates two files: a `Pipfile`and a `Pipfile.lock`.
53-
* `Pipfile`: Is a high level declaration of the dependencies of your project. It can contain "dev" dependencies (usually test related stuff) and "standard" dependencies which are the ones you'll need for your project to function
54-
* `Pipfile.lock`: Is the "list" of all the dependencies your Pipfile has installed, along with their version and their hashes. This prevents two things: Conflicts between dependencies and installing a malicious module.
55-
56-
### How to...
57-
58-
Here the most 'common' `pipenv` commands, for a more in-depth explanation please refer to the [official documentation](https://pipenv.readthedocs.io/en/latest/).
59-
60-
#### Install pipenv
61-
```bash
62-
pip install pipenv
63-
```
64-
65-
#### Install dependencies defined in a Pipfile
66-
```bash
67-
pipenv install
68-
```
69-
70-
#### Install both dev and "standard" dependencies defined in a Pipfile
71-
```bash
72-
pipenv install --dev
73-
```
74-
75-
#### Install a new module
76-
```bash
77-
pipenv install django
78-
```
79-
80-
#### Install a new dev module (usually test related stuff)
81-
```bash
82-
pipenv install nose --dev
83-
```
84-
85-
#### Install dependencies in production
86-
```bash
87-
pipenv install --deploy
88-
```
89-
90-
#### Start a shell
91-
```bash
92-
pipenv shell
93-
```
3+
See this [webpage](https://python-microservices.github.io/contributing/)
944

955
## Documentation
966

@@ -106,60 +16,4 @@ This project use MkDocs
10616
mkdocs.yml # The configuration file.
10717
docs/
10818
index.md # The documentation homepage.
109-
... # Other markdown pages, images and other files.
110-
111-
## Tutorial: Create your own service
112-
113-
* First, you must create a file with the name of your service inside of `pyms.flask.service`, for example,
114-
"myawesomesrv":
115-
116-
pyms/flask/services/myawesomesrv.py
117-
```python
118-
from pyms.flask.services.driver import DriverService
119-
120-
121-
class Service(DriverService):
122-
service = "myawesomesrv"
123-
default_values = {
124-
"myvalue": 0,
125-
"myvalue2": 1
126-
}
127-
```
128-
129-
* Now, you can configure your service from `config.yml`
130-
```yaml
131-
pyms:
132-
config:
133-
myawesomesrv:
134-
myvalue: 5
135-
```
136-
137-
* Your service will be instanced inside the `ms` object in `flask.current_app` object. For example, with the last config,
138-
you could print the folowing code:
139-
140-
```python
141-
from flask import jsonify, current_app
142-
143-
from pyms.flask.app import Microservice
144-
145-
ms = Microservice(service="my-minimal-microservice", path=__file__)
146-
app = ms.create_app()
147-
148-
149-
@app.route("/")
150-
def example():
151-
return jsonify({
152-
"myvalue": current_app.ms.myawesomesrv.myvalue,
153-
"myvalue2": current_app.ms.myawesomesrv.myvalue2
154-
})
155-
156-
157-
if __name__ == '__main__':
158-
app.run()
159-
```
160-
161-
This would be the output in `http://localhost:5000/`:
162-
163-
```json
164-
{"myvalue": 5, "myvalue2": 1}
165-
```
19+
... # Other markdown pages, images and other files.

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
py-ms = {editable = true,extras = ["tests"],path = "."}
7+
py-ms = {editable = true,extras = ["tests"], path = "."}
88

99
[packages]
10-
py-ms = {editable = true,extras = ["all"],path = "."}
10+
py-ms = {editable = true,extras = ["all"], path = "."}

README.md

Lines changed: 6 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Requirements Status](https://requires.io/github/python-microservices/pyms/requirements.svg?branch=master)](https://requires.io/github/python-microservices/pyms/requirements/?branch=master)
77
[![Total alerts](https://img.shields.io/lgtm/alerts/g/python-microservices/pyms.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/python-microservices/pyms/alerts/)
88
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/python-microservices/pyms.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/python-microservices/pyms/context:python)
9-
[![Documentation Status](https://readthedocs.org/projects/py-ms/badge/?version=latest)](https://py-ms.readthedocs.io/en/latest/?badge=latest)
9+
[![Documentation Status](https://readthedocs.org/projects/py-ms/badge/?version=latest)](https://python-microservices.github.io/home/)
1010
[![Gitter](https://img.shields.io/gitter/room/DAVFoundation/DAV-Contributors.svg)](https://gitter.im/python-microservices/pyms)
1111

1212
PyMS, Python MicroService, is a [Microservice chassis pattern](https://microservices.io/patterns/microservice-chassis.html)
@@ -26,27 +26,7 @@ Get started with [Installation](./docs/installation.md) and then get an overview
2626

2727
## Documentation
2828

29-
To know how to use, install or build a project see the [docs](https://py-ms.readthedocs.io/en/latest/).
30-
31-
## Motivation
32-
33-
When we started creating a microservice with no idea, we were looking for tutorials, guides, best practices, but we found
34-
nothing to create professional projects. Most articles say:
35-
36-
- "Install flask"
37-
- "Create routes"
38-
- (Sometimes) "Create a swagger specs"
39-
- "TA-DA! you have a microservice"
40-
41-
But... what happens with our configuration out of code like Kubernetes configmap? what happens with transactionality?
42-
If we have many microservices, what happens with traces?.
43-
44-
There are many problems around Python and microservices and we can't find anyone to give a solution.
45-
46-
We start creating these projects to try to solve all the problems we have found in our professional lives about
47-
microservices architecture.
48-
49-
Nowadays, is not perfect and we have a looong roadmap, but we hope this library could help other fellas and friends ;)
29+
To know how to use, install or build a project see the [docs](https://python-microservices.github.io/).
5030

5131
## Installation
5232

@@ -56,95 +36,13 @@ pip install py-ms[all]
5636

5737
## Quickstart
5838

59-
You need to create 2 files: main.py and config.yml:
60-
61-
- **main.py**
62-
63-
```python
64-
from flask import jsonify
65-
66-
from pyms.flask.app import Microservice
67-
68-
ms = Microservice() # 1.1
69-
app = ms.create_app() # 2.1
70-
71-
72-
@app.route("/") # 3.1
73-
def example():
74-
return jsonify({"main": "hello world"})
75-
76-
77-
if __name__ == '__main__':
78-
app.run()
79-
```
80-
81-
- **config.yml**
82-
83-
```yaml
84-
pyms:
85-
services: # 1.2
86-
requests:
87-
data: {}
88-
config: # 1.3
89-
DEBUG: true
90-
APP_NAME: business-glossary
91-
APPLICATION_ROOT : ""
92-
SECRET_KEY: "gjr39dkjn344_!67#"
93-
```
94-
95-
## So what did that code do?
96-
97-
1. Create a instance of PyMS Microservice class (#1.1). This initialization injects the configuration defined in the
98-
1.3 block and could be accessed through current_app.config like typical
99-
[Flask config](https://flask.palletsprojects.com/en/1.1.x/config/).
100-
Then, initialize the service defined in the 1.2 block. See [Services](./docs/services.md) for more details.
101-
102-
2. Initialize a [Flask](https://flask.palletsprojects.com/en/1.1.x/) instance, [Connexion](https://github.com/zalando/connexion)
103-
if it was defined in the pyms configuration block, create a tracer, add health-check blueprint, initialize libs and set
104-
the PyMS Microservice in `ms` attribute and you can access to it with `current_app.ms`.
105-
This steps has their each functions and you can easy
106-
override it.
107-
108-
3. `create_app` returns the flask instance which you can interact with as a typical flask app
109-
110-
See [Documentation](https://py-ms.readthedocs.io/en/latest/) to learn more.
39+
See our [quickstart webpage](https://python-microservices.github.io/quickstart/)
11140

11241
## Create a project from scaffold
11342

114-
PyMS has a command line option to create a project template like [Microservices Scaffold](https://github.com/python-microservices/microservices-scaffold).
115-
This command uses [cookiecutter](https://github.com/cookiecutter/cookiecutter) to download and install this [template](https://github.com/python-microservices/microservices-template)
116-
117-
**[Warning]** You must run first `pip install cookiecutter==1.7.0`
118-
119-
```bash
120-
pyms startproject
121-
```
122-
123-
this output a lot of options step by step:
124-
125-
```bash
126-
project_repo_url [https://github.com/python-microservices/microservices-scaffold]:
127-
project_name [Python Microservices Boilerplate]: 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]:
135-
Select open_source_license:
136-
1 - MIT license
137-
2 - BSD license
138-
3 - ISC license
139-
4 - Apache Software License 2.0
140-
5 - GNU General Public License v3
141-
6 - Not open source
142-
Choose from 1, 2, 3, 4, 5, 6 [1]:
143-
```
144-
145-
When you finish introducing the options, a project will be created in `[project_folder]` folder
43+
See our [Create a project from scaffold webpage](https://python-microservices.github.io/quickstart/#create-a-project-from-scaffold)
14644

14745
## How To contribute
14846

149-
We appreciate opening issues and pull requests to make PyMS even more stable & useful! See [This doc](CONTRIBUTING.md)
150-
for more details.
47+
We appreciate opening issues and pull requests to make PyMS even more stable & useful! See [This doc](https://python-microservices.github.io/contributing/)
48+
for more details.

docs/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)