From 03dbda064563cc49d03f7808b9a91e0c57ac1de7 Mon Sep 17 00:00:00 2001 From: Martin Kulich Date: Sun, 19 Jan 2025 12:47:36 +0100 Subject: [PATCH 1/2] Enable running in Heroku - gunicorn installed - Procfile set up --- Procfile | 1 + README.md | 2 +- requirements.txt | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..40b0792 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn run:app diff --git a/README.md b/README.md index 60369b6..241e62c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ flask run This will start the development server with debug mode enabled and auto-reload on code changes. ### Production use -The recommended way is running with gunicorn (uncomment `gunicorn` in `requirements.txt`): +The recommended way is running with gunicorn ``` gunicorn run:app diff --git a/requirements.txt b/requirements.txt index e7e543e..988792c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ Flask ~= 3.0 Flask-SQLAlchemy ~= 3.1 folium ~= 0.17 -# gunicorn ~= 23.0 +gunicorn ~= 23.0 ipaddress ~= 1.0 +pre-commit ~= 3.8 psycopg2-binary ~= 2.9 -requests ~= 2.32 \ No newline at end of file +pylint ~= 3.3 +requests ~= 2.32 From 037009c349fef22670a5f2bb112a1c9664d1348c Mon Sep 17 00:00:00 2001 From: Martin Kulich Date: Fri, 28 Feb 2025 17:37:15 +0100 Subject: [PATCH 2/2] Static code check add for each Pull Request Used tools: - pre-commit - pylint --- .github/workflows/pre-commit.yml | 26 ++++++++++++++++++++++++++ .pre-commit-config.yaml | 6 ++++++ .pylintrc | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .pylintrc diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..4ce8a6e --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,26 @@ +name: Pre-commit Hooks + +on: + pull_request: {} + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d5ad78e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/pre-commit/mirrors-pylint + rev: v3.0.0a5 + hooks: + - id: pylint + language: system diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..4e5bf4b --- /dev/null +++ b/.pylintrc @@ -0,0 +1,5 @@ +[MAIN] +errors-only=true + +# disable not callable (https://github.com/pylint-dev/pylint/issues/8138) +disable=E1102