Skip to content
Open
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
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DB_HOST=localhost
DB_PORT=5432
DB_NAME=inventory
DB_USER=postgres
DB_PASSWORD=postgres

DEBUG=false
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
venv/
env/
.venv/
.env/
__pycache__/

.pytest_cache/


postgres_data/

# Local dev stuff
.env
.env.local

# MacOS BS
.DS_Store
Thumbs.db

server_inventory.egg-info
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY api/ ./api/
COPY cli/ ./cli/

EXPOSE 8000

CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.PHONY: install dev test clean docker-up docker-down

PYTHON := $(shell command -v .venv/bin/python 2>/dev/null || echo python3)
PIP := $(shell command -v .venv/bin/pip 2>/dev/null || echo pip3)
PYTEST := $(shell command -v .venv/bin/pytest 2>/dev/null || echo pytest)

help:
@echo "make install - install deps"
@echo "make dev - run dev server"
@echo "make test - run tests"
@echo "make run - start stack"
@echo "make stop - stop stack"
@echo "make clean - cleanup"
@echo "make install-cli- install CLI tool"
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text formatting is inconsistent. "make install-cli- install CLI tool" is missing a space between "install-cli" and the dash. It should be "make install-cli - install CLI tool".

Suggested change
@echo "make install-cli- install CLI tool"
@echo "make install-cli - install CLI tool"

Copilot uses AI. Check for mistakes.

install:
$(PIP) install -r requirements.txt

install-dev: install
$(PIP) install -r requirements-dev.txt

dev:
$(PYTHON) -m uvicorn api.main:app --reload

install-cli: install
$(PIP) install -e .

test:
DB_HOST=localhost DB_PORT=5433 DB_NAME=inventory_test DB_USER=postgres DB_PASSWORD=postgres \
$(PYTEST) -v

test-cov:
DB_HOST=localhost DB_PORT=5433 DB_NAME=inventory_test DB_USER=postgres DB_PASSWORD=postgres \
$(PYTEST) --cov=api --cov-report=html
Comment on lines +29 to +34
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test and test-cov targets hardcode database environment variables. These should be sourced from docker-compose or a .env.test file to ensure consistency with the docker-compose.yml test database configuration and avoid having multiple sources of truth.

Suggested change
DB_HOST=localhost DB_PORT=5433 DB_NAME=inventory_test DB_USER=postgres DB_PASSWORD=postgres \
$(PYTEST) -v
test-cov:
DB_HOST=localhost DB_PORT=5433 DB_NAME=inventory_test DB_USER=postgres DB_PASSWORD=postgres \
$(PYTEST) --cov=api --cov-report=html
set -a; \
[ -f .env.test ] && . .env.test; \
set +a; \
$(PYTEST) -v
test-cov:
set -a; \
[ -f .env.test ] && . .env.test; \
set +a; \
$(PYTEST) --cov=api --cov-report=html

Copilot uses AI. Check for mistakes.

db-up:
docker-compose up -d db

db-test-up:
docker-compose --profile test up -d db-test

run:
docker-compose up -d

stop:
docker-compose down

build:
docker-compose build --no-cache

logs:
docker-compose logs -f

init-db:
$(PYTHON) -c "from api.database import init_db; init_db(); print('Done')"

clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name htmlcov -exec rm -rf {} + 2>/dev/null || true
rm -f .coverage
Loading
Loading