Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FawltyDeps linter #406

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
- name: black Lint
uses: psf/[email protected]
- name: isort Lint
Expand All @@ -26,6 +30,10 @@ jobs:
uses: py-actions/flake8@v2
with:
plugins: "flake8-pyproject"
- name: lint - FawltyDeps
uses: tweag/[email protected]
with:
options: --detailed

templates:
name: Templates Lint
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ repos:
hooks:
- id: djlint-reformat
- id: djlint
- repo: https://github.com/tweag/FawltyDeps
rev: v0.18.0
hooks:
- id: check-undeclared
- id: check-unused
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ COPY leaderboards /data/leaderboards
COPY alembic.ini /app
COPY pyproject.toml /app/
WORKDIR /app
RUN pip3 install .
RUN pip3 install '.[runtime]'
ENV LEADERBOARDS_DIR=/data/leaderboards
USER freezing
EXPOSE 8000
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
REGISTRATION_SITE: ${REGISTRATION_SITE:-https://freezingsaddles.info/}
SECRET_KEY: ${SECRET_KEY:-e6c07402-0307-11e8-b087-000000000000} # yamllint disable-line
SQLALCHEMY_URL: "mysql+pymysql://${MYSQL_USER:-freezing}:${MYSQL_PASSWORD:-zeer0}@freezing-db-dev/${MYSQL_DATABASE:-freezing}?charset=utf8mb4&binary_prefix=true" # yamllint disable-line
SQLALCHEMY_URL_ROOT: "mysql+pymysql://${MYSQL_ROOT_USER:-freezing}:${MYSQL_ROOT_PASSWORD:-zeer0}@freezing-db-dev/mysql?charset=utf8mb4&binary_prefix=true" # yamllint disable-line
SQLALCHEMY_URL_ROOT: "mysql+pymysql://${MYSQL_ROOT_USER:-root}:${MYSQL_ROOT_PASSWORD:-fr33z3}@freezing-db-dev/mysql?charset=utf8mb4&binary_prefix=true" # yamllint disable-line
START_DATE: ${START_DATE:-2018-01-01T00:00:00-05:00}
STRAVA_CLIENT_ID: ${STRAVA_CLIENT_ID:-?}
STRAVA_CLIENT_SECRET: ${STRAVA_CLIENT_SECRET:-?}
Expand Down
2 changes: 1 addition & 1 deletion freezing/web/static/css/leaflet-gesture-handling.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 33 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

# PEP 420 namespace packages need some special treatment, see
# Thanks @jherland for the hints!
# https://realpython.com/python-namespace-package/
# https://peps.python.org/pep-0420/
[tool.setuptools.packages.find]
where = ["."]
include = ["freezing"]
namespaces = true

[project]
name = "freezing-web"
version = "1.6.0"
Expand All @@ -18,23 +27,20 @@ authors = [
license = {text = "Apache License (2.0)"}
dependencies = [
"Flask==3.1.0",
"GeoAlchemy2==0.16.0",
"PyMySQL[rsa]==1.1.1",
"PyYAML==6.0.2",
"SQLAlchemy==1.4.54",
# Thanks https://stackoverflow.com/a/77214086/424301 - Flask did not pin Werkzeug dep
"Werkzeug==3.1.3",
"arrow==1.3.0",
"autoflake==2.3.1",
"beautifulsoup4==4.12.3",
"colorlog==6.9.0",
"python-dateutil==2.9.0.post0",
"envparse==0.2.0",
"freezing-model @ https://github.com/freezingsaddles/freezing-model/archive/0.10.4.tar.gz",
"gunicorn==23.0.0",
"marshmallow==3.23.2",
"marshmallow-enum @ https://github.com/lyft/marshmallow_enum/archive/support-for-marshamallow-3.tar.gz",
"python-instagram==1.3.2",
"pytz==2024.2",
"simplejson==3.19.3",
"stravalib==1.2.0",
]
classifiers = [
Expand All @@ -50,15 +56,20 @@ classifiers = [

[project.optional-dependencies]
dev = [
"autoflake",
"bandit",
"black",
"djlint",
"fawltydeps",
"flake8",
"flake8-pyproject",
"isort",
"pre-commit",
"pymarkdownlnt",
]
runtime = [
"gunicorn==23.0.0",
]

[tool.isort]
profile = "black"
Expand All @@ -71,10 +82,6 @@ max_line_length=88
plugins.md013.enabled = false
extensions.front-matter.enabled = true

[tool.setuptools]
# Thanks https://stackoverflow.com/a/72547402/424301
py-modules = ["freezing"]

[project.scripts]
freezing-server = "freezing.web.runserver:main"

Expand All @@ -89,3 +96,20 @@ max-line-length = 88
max-complexity = 39
extend-ignore = "E203"
inline-quotes = "double"

[tool.fawltydeps]
ignore_unused = [
"PyMySQL",
"autoflake",
"bandit",
"black",
"djlint",
"fawltydeps",
"flake8",
"flake8-pyproject",
"freezing-model",
"gunicorn",
"isort",
"pre-commit",
"pymarkdownlnt",
]
Loading