Skip to content

Commit

Permalink
Upgrade to Python 3.10; resolve dependency changes; minor refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbirchard committed Oct 18, 2023
1 parent 6595488 commit a39eff7
Show file tree
Hide file tree
Showing 21 changed files with 843 additions and 580 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ venv.bak/
.idea
.DS_Store
.webassets-cache
.vscode

# Secrets
creds
creds/*
*.crt
gcloud.json

# Socket
*.sock
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"python.formatting.provider": "black"
}
"python.formatting.provider": "black",
"cSpell.words": ["pythonmyadmin"]
}
27 changes: 8 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PROJECT_NAME := $(shell basename $CURDIR)
VIRTUAL_ENV := $(CURDIR)/.venv
LOCAL_PYTHON := $(VIRTUAL_ENV)/bin/python3
VIRTUAL_ENVIRONMENT := $(CURDIR)/.venv
LOCAL_PYTHON := $(VIRTUAL_ENVIRONMENT)/bin/python3

define HELP
Manage $(PROJECT_NAME). Usage:
Expand All @@ -16,66 +16,56 @@ make clean - Remove extraneous compiled files, caches, logs, etc.
endef
export HELP


.PHONY: run install deploy update format lint clean help


all help:
@echo "$$HELP"


env: $(VIRTUAL_ENV)


$(VIRTUAL_ENV):
if [ ! -d $(VIRTUAL_ENV) ]; then \
echo "Creating Python virtual env in \`${VIRTUAL_ENV}\`"; \
python3 -m venv $(VIRTUAL_ENV); \
fi


.PHONY: run
run: env
$(VIRTUAL_ENV)/bin/uwsgi --socket 127.0.0.1:8090 --protocol=http -w wsgi


$(LOCAL_PYTHON) -m wsgi

.PHONY: install
install: env
$(LOCAL_PYTHON) -m pip install --upgrade pip setuptools wheel && \
$(LOCAL_PYTHON) -m pip install -r requirements.txt && \
echo Installed dependencies in \`${VIRTUAL_ENV}\`;

echo "Installed dependencies in virtualenv \`${VIRTUAL_ENVIRONMENT}\`";

.PHONY: deploy
deploy:
make clean \
make install \
make run


.PHONY: test
test: env
$(LOCAL_PYTHON) -m \
coverage run -m pytest -vv \
coverage run -m pytest -v \
--disable-pytest-warnings && \
coverage html --title='Coverage Report' -d .reports && \
open .reports/index.html


.PHONY: update
update: env
$(LOCAL_PYTHON) -m pip install --upgrade pip setuptools wheel && \
poetry update && \
poetry export -f requirements.txt --output requirements.txt --without-hashes && \
echo Installed dependencies in \`${VIRTUAL_ENV}\`;

echo "Updated dependencies in virtualenv \`${VIRTUAL_ENVIRONMENT}\`";

.PHONY: format
format: env
$(LOCAL_PYTHON) -m isort --multi-line=3 .
$(LOCAL_PYTHON) -m isort --multi-line=3 . && \
$(LOCAL_PYTHON) -m black .


.PHONY: lint
lint: env
$(LOCAL_PYTHON) -m flake8 . --count \
Expand All @@ -84,7 +74,6 @@ lint: env
--show-source \
--statistics


.PHONY: clean
clean:
find . -name 'poetry.lock' -delete && \
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# PythonMyAdmin

![Python](https://img.shields.io/badge/Python-^3.8-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
![Flask](https://img.shields.io/badge/Flask-1.1.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
![WTForms](https://img.shields.io/badge/WTForms-v^2.3.0-red.svg?longCache=true&style=flat-square&logo=flask&logoColor=white&colorA=4c566a&colorB=5e81ac)
![Pandas](https://img.shields.io/badge/Pandas-v^1.2.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
![Dash](https://img.shields.io/badge/Dash-v^1.18.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-^2.4.0-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
![Python](https://img.shields.io/badge/Python-^3.10-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
![Flask](https://img.shields.io/badge/Flask-2.2.5-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
![Dash](https://img.shields.io/badge/Dash-v^2.14.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-^3.1.1-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=4c566a&colorB=a3be8c)
[![GitHub Issues](https://img.shields.io/github/issues/toddbirchard/pythonmyadmin.svg?style=flat-square&colorA=4c566a&colorB=ebcb8b)](https://github.com/toddbirchard/pythonmyadmin/issues)
[![GitHub Stars](https://img.shields.io/github/stars/toddbirchard/pythonmyadmin.svg?style=flat-square&colorA=4c566a&colorB=ebcb8b)](https://github.com/toddbirchard/pythonmyadmin/stargazers)
Expand Down
6 changes: 2 additions & 4 deletions clients/database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd
from pandas import DataFrame
from sqlalchemy import create_engine
from sqlalchemy.types import String, Text, Integer, DateTime
from sqlalchemy.types import DateTime, Integer, String, Text


class Database:
Expand Down Expand Up @@ -48,7 +48,5 @@ def get_table_data(self):
@staticmethod
def column_dist_chart(table_df: DataFrame, column):
"""Aggregate column values"""
grouped_column = (
table_df.groupby(column).count().sort_values(column, ascending=False)
)
grouped_column = table_df.groupby(column).count().sort_values(column, ascending=False)
return grouped_column
12 changes: 0 additions & 12 deletions deploy.sh

This file was deleted.

Loading

0 comments on commit a39eff7

Please sign in to comment.