Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a2d0f92
Add ability to add dependencies for FastAPI
sanders41 Sep 19, 2025
97825cc
Add fastapi cli options
sanders41 Sep 19, 2025
35beb11
Create example .env file
sanders41 Sep 19, 2025
b186c99
Create some core files
sanders41 Sep 20, 2025
90fff99
Create directories in parallel
sanders41 Sep 20, 2025
acd3f00
Add docker compose files
sanders41 Sep 20, 2025
e0c5c9b
Add db and exceptions files
sanders41 Sep 20, 2025
3fcccdf
Add user services file
sanders41 Sep 20, 2025
37bc8f0
Split files for easier maintenance
sanders41 Sep 20, 2025
758ed36
Add user models
sanders41 Sep 20, 2025
221154f
Add types file
sanders41 Sep 20, 2025
e2d8531
Add token models
sanders41 Sep 20, 2025
19fbdcf
Add router file
sanders41 Sep 20, 2025
f1e5778
Fix function call
sanders41 Sep 20, 2025
450baf8
Add routes and set minimum python version to 3.11 for fastapi
sanders41 Sep 21, 2025
aac5a8c
Add cfg feature to fastapi version check
sanders41 Sep 21, 2025
f38a170
Add migrations
sanders41 Sep 21, 2025
72daf3e
Add migration runner Dockerfile
sanders41 Sep 21, 2025
3326280
Add entrypoint script
sanders41 Sep 21, 2025
2973345
Add valkey cache
sanders41 Sep 21, 2025
fad1306
Fix mypy errors
sanders41 Sep 22, 2025
1afc880
Fix lint errors
sanders41 Sep 22, 2025
b1d906e
Fix docker build
sanders41 Sep 22, 2025
42bc4af
Fix build error
sanders41 Sep 22, 2025
8fd2db7
Remove extra space at end of file
sanders41 Sep 22, 2025
105e9aa
Fix spacing
sanders41 Sep 22, 2025
92b2c19
Fix end of file error
sanders41 Sep 22, 2025
968630f
Use pre-build sqlx migrations container
sanders41 Sep 22, 2025
25bea92
Don't all Pixi with FastAPI projects
sanders41 Sep 22, 2025
14794b2
Prep for supporting other databases
sanders41 Sep 22, 2025
d7316e8
Use v1 sqlx-migration-runner tag
sanders41 Sep 22, 2025
5b71b23
Merge remote-tracking branch 'origin/main' into fastapi-template
sanders41 Sep 23, 2025
6c41bde
Merge remote-tracking branch 'origin/main' into fastapi-template
sanders41 Sep 23, 2025
6aa58f1
Add test helpers
sanders41 Sep 23, 2025
2794d90
Add test for deps
sanders41 Sep 23, 2025
7c58a8a
Add config tests
sanders41 Sep 23, 2025
0077167
Add user model tests
sanders41 Sep 23, 2025
819588e
Merge remote-tracking branch 'origin/main' into fastapi-template
sanders41 Sep 23, 2025
e06894e
Add user route tests
sanders41 Sep 24, 2025
2ecb882
Add health route tests
sanders41 Sep 24, 2025
4ad0fd4
Add version route test
sanders41 Sep 24, 2025
5dee664
Add login route tests
sanders41 Sep 24, 2025
4ad262f
Add user service tests
sanders41 Sep 25, 2025
16dd62c
Fix lint errors
sanders41 Sep 25, 2025
4fd6463
Add user service cache tests
sanders41 Sep 25, 2025
524eb15
Fix deps test
sanders41 Sep 25, 2025
a47d698
Add main tests
sanders41 Sep 25, 2025
51b1ffd
added windows support to fastapi template generator
alexmunoz502 Sep 25, 2025
1702fe8
added in pytest xdist
alexmunoz502 Sep 25, 2025
199f3b9
made dependency check system platform instead of cli tool
alexmunoz502 Sep 25, 2025
7d4d8f7
Merge pull request #909 from alexmunoz502/fastapi-template-windows
sanders41 Sep 25, 2025
26d9993
Generate pyproject.toml without minijinja
sanders41 Sep 25, 2025
5a57677
Merge remote-tracking branch 'origin/main' into fastapi-template
sanders41 Sep 25, 2025
5624110
Remove POSTGRES_DB from docker override
sanders41 Sep 25, 2025
25413aa
Fix lint error
sanders41 Sep 25, 2025
e147884
Add fastapi feature to ci tests
sanders41 Sep 25, 2025
ac01631
Add components
sanders41 Sep 25, 2025
d67d696
Fix command
sanders41 Sep 25, 2025
3a81691
Add clippy and rustfmt for pyo3
sanders41 Sep 25, 2025
2237251
Rename to match other tests
sanders41 Sep 25, 2025
54ab7aa
Fix components
sanders41 Sep 25, 2025
2a0fde8
Add CI tests for fastapi project
sanders41 Sep 26, 2025
9b55806
Add runs on
sanders41 Sep 26, 2025
04f5fef
Fix env var reference
sanders41 Sep 26, 2025
10d2044
Fix lint errors
sanders41 Sep 26, 2025
295a7af
Add empty .env file to prevent error
sanders41 Sep 26, 2025
d080f06
Install sqlx
sanders41 Sep 26, 2025
9ee5776
Fix migration path in conftest.py
sanders41 Sep 26, 2025
c7370ce
Update name
sanders41 Sep 26, 2025
37d0095
Update for future installers
sanders41 Sep 26, 2025
3e54b46
Test non-fastapi project when fastapi is enabled
sanders41 Sep 26, 2025
3a38d9b
Remove Mac CI tests
sanders41 Sep 26, 2025
3afbdcd
A lib does not create default tests so skip in CI
sanders41 Sep 26, 2025
d2ddbd4
Add just commands for fastapi projects
sanders41 Sep 26, 2025
7640d71
Add snapshots
sanders41 Sep 26, 2025
b3f3b86
Make fastapi projects app only
sanders41 Sep 26, 2025
1d194d1
Add testing workflow for fastapi projects
sanders41 Sep 26, 2025
6fe9e8c
Add fastapi deploy files
sanders41 Sep 26, 2025
b0d5508
Use exact bounds for uv application projects
sanders41 Sep 27, 2025
dbb9587
Merge remote-tracking branch 'origin/main' into fastapi-template
sanders41 Sep 27, 2025
e09a484
Temporarily disable sqlalchemy option
sanders41 Sep 27, 2025
812f385
Update pre-commit ruff command
sanders41 Sep 27, 2025
60cfddc
Build packages with fastapi feature enabled
sanders41 Sep 27, 2025
d3d81a0
Update test script
sanders41 Sep 27, 2025
23fe5b1
Fix script paramaters
sanders41 Sep 27, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/publish_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
run: cargo build --release --locked --target ${{ matrix.target }} --all-features
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Create package
id: create-deb
run: |
cargo deb --deb-revision="" # --deb-revision="" removes the -1 post tag
cargo deb --locked --all-features --deb-revision="" # --deb-revision="" removes the -1 post tag
cd target/debian
echo "DEB_FILE=$(find python-project-generator*_*.deb)" >> "$GITHUB_OUTPUT"
- name: Upload deb package to release
Expand Down
119 changes: 70 additions & 49 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Run cargo clippy
run: cargo clippy --all-targets -- --deny warnings
clippy-fastapi:
name: clippy-fastapi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Run cargo clippy
run: cargo clippy --all-targets -F fastapi -- --deny warnings
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
with:
components: rustfmt
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Run cargo fmt
Expand All @@ -42,17 +57,31 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Run cargo test
run: cargo test --locked
test-fastapi:
name: test-fastapi
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Run cargo test
run: cargo test --locked -F fastapi
uv-linting:
strategy:
fail-fast: false
Expand All @@ -61,12 +90,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install uv on Linux and Mac
- name: Install uv on Linux
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv on Windows
Expand Down Expand Up @@ -99,16 +127,15 @@ jobs:
fail-fast: false
matrix:
project_type: ["application", "lib"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install uv on Linux and Mac
- name: Install uv on Linux
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv on Windows
Expand Down Expand Up @@ -146,9 +173,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install Poetry
Expand Down Expand Up @@ -182,13 +208,12 @@ jobs:
fail-fast: false
matrix:
project_type: ["application", "lib"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install Poetry
Expand Down Expand Up @@ -228,12 +253,13 @@ jobs:
- uses: actions/checkout@v5
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install uv on Linux and Mac
- name: Install uv on Linux
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv on Windows
Expand Down Expand Up @@ -273,16 +299,15 @@ jobs:
fail-fast: false
matrix:
project_type: ["application", "lib"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Install uv on Linux and Mac
- name: Install uv on Linux
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install uv on Windows
Expand Down Expand Up @@ -320,9 +345,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Set up Python
Expand Down Expand Up @@ -353,13 +377,12 @@ jobs:
fail-fast: false
matrix:
project_type: ["application", "lib"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Set up Python
Expand Down Expand Up @@ -394,9 +417,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Build package
Expand Down Expand Up @@ -426,13 +448,12 @@ jobs:
fail-fast: false
matrix:
project_type: ["application", "lib"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/[email protected]
- name: Build package
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/testing_fastapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Testing FastAPI
on:
push:
branches:
- main
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
WORKING_DIR: "my-project"
MIN_PYTHON_VERSION: "3.11"
SECRET_KEY: someKey
FIRST_SUPERUSER_EMAIL: [email protected]
FIRST_SUPERUSER_PASSWORD: My_password1
FIRST_SUPERUSER_NAME: "Wade Watts"
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test_password
POSTGRES_DB: test_db
VALKEY_HOST: 127.0.0.1
VALKEY_PASSWORD: test_password
STACK_NAME: test-stack
DOMAIN: 127.0.0.1
PRODUCTION_MODE: false
DATABASE_URL: postgresql://postgres:[email protected]:5432/test_db
jobs:
test-uv-fastapi-project:
name: test-fastapi-uv-setup-fastapi
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Install sqlx-cli
run: cargo install sqlx-cli --no-default-features -F native-tls -F postgres
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Build package
run: cargo build --release -F fastapi
- name: Run creation
run: ./scripts/ci_run_fastapi.sh "fastapi" 1
shell: bash
- name: Install Dependencies
working-directory: ${{ env.WORKING_DIR }}
run: |
uv lock
uv sync --frozen
- name: Pre-commit check
working-directory: ${{ env.WORKING_DIR }}
run: |
uv run pre-commit install
git add .
uv run pre-commit run --all-files
- name: make .env
working-directory: ${{ env.WORKING_DIR }}
run: touch .env
- name: Build and start Docker containers
working-directory: ${{ env.WORKING_DIR }}
run: docker compose up -d
- name: Test with pytest
working-directory: ${{ env.WORKING_DIR }}
run: uv run pytest -n auto
test-uv-non-fastapi-project:
name: test-fastapi-uv-setup-non-fastapi
strategy:
fail-fast: false
matrix:
project_type: ["application", "lib"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/[email protected]
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Build package
run: cargo build --release -F fastapi
- name: Run creation
run: ./scripts/ci_run_fastapi.sh ${{ matrix.project_type }} 1
shell: bash
- name: Install Dependencies
working-directory: ${{ env.WORKING_DIR }}
run: |
uv lock
uv sync --frozen
- name: Pre-commit check
working-directory: ${{ env.WORKING_DIR }}
run: |
uv run pre-commit install
git add .
uv run pre-commit run --all-files
- name: Test with pytest
working-directory: ${{ env.WORKING_DIR }}
if: matrix.project_type == 'application'
run: uv run pytest
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ license = "MIT"
name = "python-project"
path = "src/main.rs"

[features]
fastapi = []

[dependencies]
anyhow = "1.0.100"
clap = { version = "4.5.48", features = ["color", "suggestions", "derive"] }
Expand Down
Loading
Loading