Skip to content

Commit

Permalink
Merge pull request #281 from seapagan/develop
Browse files Browse the repository at this point in the history
Merge version 0.5.0
  • Loading branch information
seapagan authored Feb 7, 2024
2 parents 76db810 + 04961f9 commit 64dd665
Show file tree
Hide file tree
Showing 118 changed files with 7,128 additions and 3,883 deletions.
14 changes: 6 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
# http://localhost:8000
BASE_URL=http://localhost:8000

# Database Settings These must be changed to match your setup.
# Database Settings These must be changed to match your setup, and the database
# must already exist.
DB_USER=dbuser
DB_PASSWORD=my_secret_passw0rd
DB_ADDRESS=postgres #localhost if not using Docker
DB_ADDRESS=localhost # use 'postgres' if using using Docker
DB_PORT=5432
DB_NAME=my_database_name

# Database settings to use for testing. These must be changed to match your
# setup.
# NOTE: This is NOT USED at present, the tests use SQLite.
TEST_DB_USER=dbuser
TEST_DB_PASSWORD=my_secret_passw0rd
TEST_DB_ADDRESS=localhost
TEST_DB_PORT=5432
# setup. Note that User/Pass and Server/Port are the same as above, but the
# database name should be different to avoid conflicts. This database needs to
# already exist.
TEST_DB_NAME=my_database_name_tests

# generate your own super secret key here, used by the JWT functions.
Expand Down
6 changes: 3 additions & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: seapagan
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
ko_fi: grantramsay
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://www.buymeacoffee.com/seapagan']
custom: ["https://www.buymeacoffee.com/seapagan"]
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
17 changes: 17 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linting

on: [push, pull_request, workflow_dispatch]

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Linting
uses: chartboost/ruff-action@v1
with:
args: check
- name: Check Formatting
uses: chartboost/ruff-action@v1
with:
args: format --check
25 changes: 19 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

on:
push:
branches: ["main"]
branches: ["main", "develop"]
pull_request:
branches: ["main"]
branches: ["main", "develop"]
workflow_dispatch:

jobs:
Expand All @@ -13,7 +13,20 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: fastapi-template-test
ports:
- 5432:5432
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5

steps:
# ---------------------------------------------------------------------- #
Expand All @@ -39,7 +52,7 @@ jobs:
# ---------------------------------------------------------------------- #
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key:
Expand All @@ -59,10 +72,10 @@ jobs:
run: |
poetry run pytest --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-python-${{ matrix.python-version }}
# - name: Run codacy-coverage-reporter
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@ cython_debug/
openapi.json
test.db
docs/CNAME
.changelog_generator.toml
.python-version
.changelog_generator.toml
7 changes: 6 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"MD014": false,
"MD046": false
"MD046": false,
"MD033": {
"allowed_elements": [
"swagger-ui"
]
}
}
79 changes: 48 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,71 @@ repos:
hooks:
- id: check-yaml
args: [--unsafe]
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black
args: [--line-length=80]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: [--max-line-length=80]
additional_dependencies: [flake8-docstrings, flake8-pyproject]
# files: ^my_appname/|^test_suite_name/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: isort
args: [--profile=black, --line-length=80]
- id: ruff
name: "lint with ruff"
- id: ruff-format
name: "format with ruff"

- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.13.4
rev: v0.9.15
hooks:
- id: pymarkdown
exclude: ^.github/|^docs/
args: [-d, "MD014", scan]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
name: "check markdown"
exclude: ^.github/|CHANGELOG
args: [-d, "MD046", scan]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0" # Use the sha / tag you want to point at
hooks:
- id: pydocstyle
additional_dependencies: ["pydocstyle[toml]"]
exclude: ^app/migrations/|__init__.py
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
- id: mypy
name: "Check with Mypy"

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.346
hooks:
- id: bandit
args: ["--silent", "-c", "pyproject.toml", "-r"]
additional_dependencies: ["bandit[toml]"]
- id: pyright
name: "Check with Pyright"
exclude: tests

- repo: https://github.com/python-poetry/poetry
rev: "1.6.0"
rev: "1.7.0"
hooks:
- id: poetry-check
name: "check poetry files"
# - id: poetry-lock

- repo: https://github.com/python-poetry/poetry-plugin-export
rev: "1.6.0"
hooks:
- id: poetry-export
name: "export production dependencies"
args:
[
"--without-hashes",
"-f",
"requirements.txt",
"-o",
"requirements.txt",
"--without",
"dev",
]
- id: poetry-export
name: "export development dependencies"
args:
[
"--without-hashes",
"-f",
"requirements.txt",
"-o",
"requirements-dev.txt",
"--with",
"dev",
]
19 changes: 0 additions & 19 deletions .vscode/launch.json

This file was deleted.

43 changes: 25 additions & 18 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
{
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
},
"autoDocstring.startOnNewLine": true,
"beautify.language": {
"html": ["htm", "html", "django-html"]
},
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"emmet.includeLanguages": {
"django-html": "html",
"jinja-html": "html"
},
"emmet.triggerExpansionOnTab": true,
"files.associations": {
"**/*.html": "html",
"**/*.tpl": "jinja",
"**/requirements{/**,*}.{txt,in}": "pip-requirements",
"**/templates/**/*": "django-txt",
"**/templates/**/*.html": "jinja-html"
},
"files.eol": "\n",
"files.exclude": {
"**/.cache": true,
"**/.mypy_cache": true,
"**/.pytest_cache": true,
"**/.ruff_cache": true,
"**/__pycache__": true
},
"git.alwaysSignOff": true,
"git.enableCommitSigning": true,
"html.format.indentHandlebars": true,
"html.format.templating": true,
"markdownlint.ignore": ["CHANGELOG.md"],
"material-icon-theme.languages.associations": {
"jinja-html": "django"
},
"mypy-type-checker.args": ["--strict"],
"mypy-type-checker.importStrategy": "useBundled",
"mypy-type-checker.reportingScope": "workspace",
"python.analysis.autoImportCompletions": true,
"python.analysis.autoImportUserSymbols": true,
"python.analysis.extraPaths": [],
"python.analysis.indexing": true,
"python.analysis.stubPath": "/home/seapagan/stubs",
"python.analysis.typeCheckingMode": "basic",
"python.formatting.blackArgs": ["--line-length=80"],
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "off",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.flake8Args": ["--max-line-length=80"],
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": false,
"python.linting.pydocstyleArgs": ["--convention=google"],
"python.linting.pylintArgs": [],
"python.linting.pylintEnabled": false,
"python.linting.pylintUseMinimalCheckers": false,
"python.pythonPath": "/home/seapagan/.pyenv/versions/calendar/bin/python",
"python.sortImports.args": ["--profile", "black", "--src=${workspaceFolder}"],
"python.testing.nosetestsEnabled": false,
"python.pythonPath": "./.venv/bin/python",
"python.testing.pytestArgs": ["tests"],
"python.testing.pytestEnabled": true,
"python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "*_test.py"],
"python.testing.unittestEnabled": false,
"testExplorer.addToEditorContextMenu": true
"ruff.fixAll": false,
"ruff.organizeImports": true
}
8 changes: 7 additions & 1 deletion BUGS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Bugs

1) if user is deleted while logged in gives 500 (Internal Server Error).
Below is a (non-exhaustive) list of known bugs in the application. Check the
[Issues](https://github.com/seapagan/fastapi-template/issues) also. If you find
a bug, please report it.

- If a user is deleted while logged in, the API returns a 500 (Internal Server
Error).
- Tests dont work under Docker since we don't have a 'test' database configured.
Loading

0 comments on commit 64dd665

Please sign in to comment.