Skip to content

Commit 4dafd1e

Browse files
committed
Update dependencies; Makefile.
1 parent 7cba344 commit 4dafd1e

File tree

6 files changed

+598
-512
lines changed

6 files changed

+598
-512
lines changed

Makefile

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
SRCPATH := $(CURDIR)
2-
PROJECTNAME := $(shell basename $(CURDIR))
1+
PROJECT_NAME := $(shell basename $CURDIR)
2+
VIRTUAL_ENVIRONMENT := $(CURDIR)/.venv
3+
LOCAL_PYTHON := $(VIRTUAL_ENVIRONMENT)/bin/python3
34

45
define HELP
5-
Manage $(PROJECTNAME). Usage:
6-
7-
make run - Run $(PROJECTNAME).
8-
make deploy - Install requirements and run app for the first time.
9-
make update - Update pip dependencies via Python Poetry.
10-
make format - Format code with Python's `Black` library.
6+
Manage $(PROJECT_NAME). Usage:
7+
8+
make run - Run $(PROJECT_NAME).
9+
make install - Create virtual env, install dependencies, and run project.
10+
make deploy - Install and run script by running `make install` and `make run` in succession.
11+
make update - Update pip dependencies via Poetry and export output to requirements.txt.
12+
make format - Format code with Pythons `Black` library.
13+
make lint - Check code formatting with `flake8`.
1114
make clean - Remove cached files and lock files.
15+
1216
endef
1317
export HELP
1418

15-
.PHONY: run deploy update format clean help
1619

20+
.PHONY: run install deploy update format lint clean help
1721

1822
requirements: .requirements.txt
19-
env: .venv/bin/activate
23+
env: ./.venv/bin/activate
2024

2125

2226
.requirements.txt: requirements.txt
@@ -29,30 +33,57 @@ all help:
2933

3034
.PHONY: run
3135
run: env
32-
$(shell . .venv/bin/activate && flask run)
36+
flask run
37+
38+
39+
.PHONY: install
40+
install:
41+
if [ ! -d "./.venv" ]; then python3 -m venv $(VIRTUAL_ENVIRONMENT); fi
42+
. .venv/bin/activate
43+
$(LOCAL_PYTHON) -m pip install --upgrade pip setuptools wheel
44+
$(LOCAL_PYTHON) -m pip install -r requirements.txt
3345

3446

3547
.PHONY: deploy
3648
deploy:
37-
$(shell . ./deploy.sh)
49+
make install
50+
make run
3851

3952

4053
.PHONY: update
41-
update: env
42-
.venv/bin/python3 -m pip install -U pip
54+
update:
55+
if [ ! -d "./.venv" ]; then python3 -m venv $(VIRTUAL_ENVIRONMENT); fi
56+
.venv/bin/python3 -m pip install --upgrade pip setuptools wheel
4357
poetry update
4458
poetry export -f requirements.txt --output requirements.txt --without-hashes
4559

4660

4761
.PHONY: format
4862
format: env
49-
$(shell . .venv/bin/activate && isort ./)
50-
$(shell . .venv/bin/activate && black ./)
63+
isort --multi-line=3 .
64+
black .
65+
66+
67+
.PHONY: lint
68+
lint:
69+
flake8 . --count \
70+
--select=E9,F63,F7,F82 \
71+
--exclude .git,.github,__pycache__,.pytest_cache,.venv,logs,creds,.venv,docs,logs \
72+
--show-source \
73+
--statistics
5174

5275

5376
.PHONY: clean
5477
clean:
5578
find . -name '*.pyc' -delete
5679
find . -name '__pycache__' -delete
5780
find . -name 'poetry.lock' -delete
58-
find . -name 'Pipefile.lock' -delete
81+
find . -name '*.log' -delete
82+
find . -name '.DS_Store' -delete
83+
find . -wholename 'logs/*.json' -delete
84+
find . -wholename '.pytest_cache' -delete
85+
find . -wholename '**/.pytest_cache' -delete
86+
find . -wholename './logs/*.json' -delete
87+
find . -wholename './logs' -delete
88+
find . -wholename '*.html' -delete
89+
find . -wholename '**/.webassets-cache' -delete

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Flask-Session Tutorial
22

33
![Python](https://img.shields.io/badge/Python-v^3.8-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
4-
![Flask](https://img.shields.io/badge/Flask-v^1.1.1-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
5-
![Flask-Login](https://img.shields.io/badge/Flask--Login-v0.5.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
4+
![Flask](https://img.shields.io/badge/Flask-v^2.1.1-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
5+
![Flask-Login](https://img.shields.io/badge/Flask--Login-v0.6.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
66
![Flask-Assets](https://img.shields.io/badge/Flask--Assets-v2.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
7-
![Flask-Session](https://img.shields.io/badge/Flask--Session-v0.3.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
8-
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-v2.3.2-red.svg?longCache=true&style=flat-square&logo=flask&logoColor=white&colorA=4c566a&colorB=5e81ac)
7+
![Flask-Session](https://img.shields.io/badge/Flask--Session-v0.4.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
8+
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-v2.5.1-red.svg?longCache=true&style=flat-square&logo=flask&logoColor=white&colorA=4c566a&colorB=5e81ac)
99
![WTForms](https://img.shields.io/badge/WTForms-v2.2.1-blue.svg?longCache=true&logo=python&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
10-
![PyMySQL](https://img.shields.io/badge/PyMySQL-v0.9.3-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
11-
![Redis](https://img.shields.io/badge/Redis-v3.2.1-red.svg?longCache=true&style=flat-square&logo=redis&logoColor=white&colorA=4c566a&colorB=bf616a)
10+
![PyMySQL](https://img.shields.io/badge/PyMySQL-v1.0.2-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
11+
![Redis](https://img.shields.io/badge/Redis-v4.2.2-red.svg?longCache=true&style=flat-square&logo=redis&logoColor=white&colorA=4c566a&colorB=bf616a)
1212
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=4c566a&colorB=a3be8c&logo=GitHub)
1313
[![GitHub Issues](https://img.shields.io/github/issues/hackersandslackers/flask-session-tutorial.svg?style=flat-square&colorA=4c566a&logo=GitHub&colorB=ebcb8b)](https://github.com/hackersandslackers/flask-session-tutorial/issues)
1414
[![GitHub Stars](https://img.shields.io/github/stars/hackersandslackers/flask-session-tutorial.svg?style=flat-square&colorA=4c566a&logo=GitHub&colorB=ebcb8b)](https://github.com/hackersandslackers/flask-session-tutorial/stargazers)

flask_session_tutorial/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
from flask_login import LoginManager
44
from flask_session import Session
55
from flask_sqlalchemy import SQLAlchemy
6-
from ddtrace import patch_all
76

87

98
db = SQLAlchemy()
109
login_manager = LoginManager()
1110
sess = Session()
12-
patch_all()
1311

1412

1513
def create_app():

0 commit comments

Comments
 (0)