1
1
# time-tracker-api
2
2
3
+ The API of the TSheets killer app.
4
+
3
5
## Getting started
4
- Follow the following instructions to get the project ready to use ASAP:
6
+ Follow the following instructions to get the project ready to use ASAP.
5
7
6
8
### Requirements
7
9
Be sure you have installed in your system
@@ -10,7 +12,7 @@ Be sure you have installed in your system
10
12
automatically [ pip] ( https://pip.pypa.io/en/stable/ ) as well.
11
13
- A virtual environment, namely [ venv] ( https://docs.python.org/3/library/venv.html ) .
12
14
13
- ## Setup
15
+ ### Setup
14
16
15
17
- Create and activate the environment,
16
18
@@ -26,13 +28,16 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
26
28
virtualenv .venv
27
29
source .venv/bin/activate
28
30
```
31
+
29
32
- Install the requirements:
30
33
```
31
- python3 -m pip install -r requirements/prod .txt
34
+ python3 -m pip install -r requirements/<stage> .txt
32
35
```
36
+
37
+ The `stage` can be `dev` or `prod`.
33
38
Remember to do it with Python 3.
34
39
35
- ## How to use it
40
+ ### How to use it
36
41
- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:
37
42
38
43
In Windows
@@ -50,7 +55,47 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
50
55
a link to the swagger.json with the definition of the api.
51
56
52
57
53
- ## CLI
58
+ ## Development
59
+
60
+ ### Test
61
+ We are using Pytest](https://docs.pytest.org/en/latest/index.html) for tests. The tests are located in the package
62
+ `tests` and use the [conventions for python test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery).
63
+
64
+ To run the tests just execute:
65
+
66
+ ```
67
+ python3 -m pytest -v
68
+ ```
69
+
70
+ The option `-v` shows which tests failed or succeeded. Have into account that you can also debug each test
71
+ (test_* files) with the help of an IDE like PyCharm.
72
+
73
+ #### Coverage
74
+ To check the coverage of the tests execute
75
+
76
+ ```bash
77
+ coverage run -m pytest -v
78
+ ```
79
+
80
+ To get a report table
81
+
82
+ ``` bash
83
+ coverage report
84
+ ```
85
+
86
+ To get a full report in html
87
+ ``` bash
88
+ coverage html
89
+ ```
90
+ Then check in the [ htmlcov/index.html] ( ./htmlcov/index.html ) to see it
91
+
92
+ If you want that previously collected coverage data is erased, you can execute:
93
+
94
+ ```
95
+ coverage erase
96
+ ```
97
+
98
+ ### CLI
54
99
55
100
There are available commands, aware of the API, that can be very helpful to you. You
56
101
can check them out by running
@@ -64,4 +109,20 @@ as well as its correspondent options.
64
109
65
110
```
66
111
python cli.py gen_swagger_json -f ~/Downloads/swagger.json
67
- ```
112
+ ```
113
+
114
+ ## Built with
115
+ - [ Python version 3] ( https://www.python.org/download/releases/3.0/ ) as backend programming language. Strong typing for
116
+ the win.
117
+ - [ Flask] ( http://flask.pocoo.org/ ) as the micro framework of choice.
118
+ - [ Flask RestPlus] ( https://flask-restplus.readthedocs.io/en/stable/ ) for building Restful APIs with Swagger.
119
+ - [ Pytest] ( https://docs.pytest.org/en/latest/index.html ) for tests
120
+ - [ Coverage] ( https://coverage.readthedocs.io/en/coverage-4.5.4/ ) for coverage
121
+ - [ Swagger] ( https://swagger.io/ ) for documentation and standardization, taking into account the
122
+ [ API import restrictions and known issues] ( https://docs.microsoft.com/en-us/azure/api-management/api-management-api-import-restrictions )
123
+ in Azure.
124
+
125
+
126
+ ## License
127
+
128
+ Copyright 2020 ioet Inc. All Rights Reserved.
0 commit comments