Skip to content

Commit 63375f2

Browse files
committed
Requirements upgrade, python3.7 tests in travis, coverage report
1 parent 9fc5958 commit 63375f2

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bootstrap.min.css
99
*.egg-info/
1010
env
1111
env3
12+
venv
1213
.idea
1314
.vscode
1415
dist

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
sudo: false
2-
language:
3-
- python
2+
dist: xenial
3+
language: python
44
python:
55
- "3.5"
6+
- "3.6"
7+
- "3.7"
68

79
install:
810
- pip install -r requirements.txt
911
- pip install coveralls
1012

1113
script:
12-
- coverage run --source pygmy -m py.test
14+
- coverage run --omit="*/templates*,*/venv*,*/tests*,*/python*" -m py.test
1315

1416
after_success:
1517
- coveralls

README.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Pygmy
44

55
[![Build Status](https://travis-ci.org/amitt001/pygmy.svg?branch=master)](https://travis-ci.org/amitt001/pygmy)
6+
[![Coverage Status](https://img.shields.io/coveralls/github/amitt001/pygmy.svg?color=yellowgreen)](https://coveralls.io/github/amitt001/pygmy?branch=master)
67
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Django.svg)
78
[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)
89
![Docker Pulls](https://img.shields.io/docker/pulls/amit19/pygmy.svg)
@@ -12,7 +13,8 @@ Live version of this project @ [https://pygy.co](https://pygy.co)
1213

1314
Check link stats by adding **+** to the URL. Example [pygy.co/pygmy+](https://pygy.co/pygmy+)
1415

15-
*Note that pygy.co is a demo website for this project and should be used as such. While the website is going to be up for the foreseeable future, its future depends on the sponsorship and hosting that I get. Currently, the project is hosted on Digitalocean, as they were kind enough to offer me one year of sponsorship. I would like to keep the project website up and maintain the project but I do not make any money out of this project or website.
16+
*Note that pygy.co is a demo website for this project and should be used as such. While the website is going to be up for the foreseeable future, its future depends on the sponsorship and hosting that I get. Currently, the project is hosted on Digitalocean, as they were kind enough to offer me one year of sponsorship. I would like to keep the project website up and maintain the project but I do not make any financial gains out of this project or website. Website is
17+
free to use and is completely ad-free.
1618
If you would like to support the project, Please use the donate link in [Donations](#donations) section.*
1719

1820
# Table of Contents
@@ -29,7 +31,7 @@ If you would like to support the project, Please use the donate link in [Donatio
2931
- [Use SQLite](#use-sqlite)
3032
- [Docker](#docker-1)
3133
- [Using Pygmy API](#using-pygmy-api)
32-
- [## Create User:](#create-user)
34+
- [Create User:](#create-user)
3335
- [Shell Usage](#shell-usage)
3436
- [How Link Stats Are Generated?](#how-link-stats-are-generated)
3537
- [How Pygmy Auth Token Works?](#how-pygmy-auth-token-works)
@@ -94,19 +96,19 @@ Note:
9496
- The project has two config files:
9597
- pygmy.cfg: `pygmy/config/pygmy.cfg` rest API and pygmy core settings file
9698
- settings.py: `pygmyui/pygmyui/settings.py` Django settings file
97-
- SQLite is default db, if you are using PostgreSQL or MySQL with this project, make sure they are installed into the system.
98-
- You can run pygmy shell present in the root directory to run the program on the terminal. `python shell`
99-
- By default in `pygmyui/pygmyui/settings.py` DEBUG is set to True, set it to False in production
99+
- SQLite is default DB, if you are using PostgreSQL or MySQL with this project, make sure they are installed into the system.
100+
- You can run pygmy shell also. Present in the root directory. To run the program on the terminal: `python shell`
101+
- By default, DEBUG is set to True in `pygmyui/pygmyui/settings.py` file, set it to False in production.
100102

101103
## DB Setup:
102104

103-
By default Pygmy uses SQLite but any of the SQLite, MySQL or PostgreSQL DB can be used. Configs are present in `pygmy/config/pygmy.cfg` directory.
105+
By default, Pygmy uses SQLite but any of the DB, SQLite, MySQL or PostgreSQL, can be used. Configs is present at `pygmy/config/pygmy.cfg`.
104106

105-
Use db specific instruction below. Make sure to check and modify values in pygmy.cfg file according to your DB setup.
107+
Use DB specific instruction below. Make sure to check and modify values in pygmy.cfg file according to your DB setup.
106108

107109
### Use MySQL
108110

109-
First install `pymysql`:
111+
First, install `pymysql`:
110112

111113
`pip install pymysql`
112114

@@ -131,7 +133,7 @@ Enter MySQL URL
131133

132134
`CREATE DATABASE pygmy;`
133135

134-
Note: It's better to use Mysql with version > `5.6.5` to use default value of `CURRENT_TIMESTAMP` for `DATETIME`.
136+
Note: It's better to use Mysql with version > `5.6.5` to use the default value of `CURRENT_TIMESTAMP` for `DATETIME`.
135137

136138
### Use Postgresql
137139

@@ -167,14 +169,13 @@ Docker image name: amit19/pygmy
167169

168170
Docker image can be built by: `docker build -t amit19/pygmy .`
169171

170-
Both Dockerfile and docker-compose file are present at the root of the project.
172+
Both the Dockerfile and docker-compose file are present at the root of the project.
171173

172174
To use docker-compose you need to pass DB credentials in the docker-compose file
173175

174176
## Using Pygmy API
175177

176-
## Create User:
177-
------------
178+
### Create User:
178179

179180
curl -XPOST http://127.0.0.1:9119/api/user/1 -H 'Content-Type: application/json' -d '{
180181
"email": "[email protected]",
@@ -249,7 +250,7 @@ Out[4]:
249250
'time_stats': 0,
250251
'total_hits': 0}
251252
252-
In [5]: # check available context of the shell
253+
In [5]: # check the available context of the shell
253254
In [6]: pygmy_context
254255
255256
In [7]: # Create custom short URL
@@ -274,7 +275,7 @@ For getting geo location stats from IP maxminds' [GeoLite2-Country.mmd](http://p
274275

275276
###### How Pygmy Auth Token Works?
276277

277-
It uses JWT. When user logs in using username and password two tokens are generated, refresh token and auth token. Auth token is used for authentication with the Pygmy API. Refresh token can only be used to generate new auth token. Auth token has a very short TTL but refresh token has a longer TTL. After 30 minutes. When a request comes with the old auth token and a new token is generated from the refresh token API. User passwords are encrypted by [bcrypt](https://en.wikipedia.org/wiki/Bcrypt) hash algorithm.
278+
It uses JWT. When user logs in using username and password two tokens are generated, refresh token and auth token. Auth token is used for authentication with the Pygmy API. The refresh token can only be used to generate a new auth token. Auth token has a very short TTL but refresh token has a longer TTL. After 30 minutes. When a request comes with the old auth token and a new token is generated from the refresh token API. User passwords are encrypted by [bcrypt](https://en.wikipedia.org/wiki/Bcrypt) hash algorithm.
278279

279280
## Development
280281

@@ -287,9 +288,13 @@ To contribute to the project:
287288
3. Test the changer by running: `docker run -it -p 8000:8000 pygmy`
288289
4. The website will be available at http://127.0.0.1:8000/
289290

290-
Run tests and generate a coverage report:
291+
Run tests:
291292

292-
`coverage run --source pygmy -m py.test`
293+
In root directory run this command: `py.test`
294+
295+
Or with coverage report(`pip install coverage`):
296+
297+
`coverage run --omit="*/templates*,*/venv*,*/tests*" -m py.test`
293298

294299
See coverage report(Coverage is bad because the coverage for integration tests is not generated yet):
295300

requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
attrs==17.4.0
2-
bcrypt==3.1.4
2+
bcrypt==3.1.6
33
certifi==2018.1.18
44
cffi==1.11.4
55
chardet==3.0.4
66
click==6.7
7-
Django==2.1.3
7+
Django==2.2.1
88
Flask==1.0.2
99
Flask-Cors==3.0.3
1010
Flask-JWT-Extended==3.6.0
1111
geoip2==2.7.0
1212
gunicorn==19.7.1
1313
idna==2.6
1414
itsdangerous==0.24
15-
Jinja2==2.10
15+
Jinja2==2.10.1
1616
MarkupSafe==1.0
1717
marshmallow==2.16.3
1818
maxminddb==1.3.0
@@ -24,8 +24,8 @@ pycparser==2.18
2424
PyJWT==1.5.3
2525
pytest==3.4.0
2626
pytz==2017.3
27-
requests==2.20.1
27+
requests==2.22.0
2828
six==1.11.0
29-
SQLAlchemy==1.2.2
30-
urllib3==1.24.1
29+
SQLAlchemy==1.3.3
30+
urllib3==1.25.3
3131
Werkzeug==0.14.1

0 commit comments

Comments
 (0)