Skip to content

Commit a9dbfd9

Browse files
Merge pull request #1 from UmutHasanoglu/claude/plan-app-improvements-5YdPB
Plan app improvements and publication
2 parents 1b4ed14 + c42b103 commit a9dbfd9

23 files changed

Lines changed: 1487 additions & 54 deletions

.dockerignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Python
6+
__pycache__
7+
*.py[cod]
8+
*$py.class
9+
.pytest_cache
10+
*.egg-info
11+
dist
12+
build
13+
.eggs
14+
15+
# Virtual environments
16+
.venv
17+
venv
18+
ENV
19+
20+
# IDE
21+
.idea
22+
.vscode
23+
*.swp
24+
*.swo
25+
26+
# Testing
27+
htmlcov
28+
.coverage
29+
.tox
30+
.nox
31+
32+
# Logs
33+
*.log
34+
logs/
35+
36+
# OS
37+
.DS_Store
38+
Thumbs.db
39+
40+
# Documentation (not needed in container)
41+
*.md
42+
!README.md
43+
44+
# Development files
45+
.env
46+
*.bak
47+
*.backup
48+
49+
# Test files (optional - include if you want to run tests in container)
50+
test_*.py
51+
52+
# Windows batch files (not needed in container)
53+
*.bat

.env.example

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Library Management System Configuration
2+
# Copy this file to .env and modify as needed
3+
4+
# Server Configuration
5+
HOST=127.0.0.1
6+
PORT=8000
7+
DEBUG=false
8+
9+
# CORS Configuration
10+
# Comma-separated list of allowed origins
11+
# For production, specify your actual domain(s)
12+
CORS_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
13+
CORS_ALLOW_CREDENTIALS=true
14+
CORS_ALLOW_METHODS=GET,POST,PUT,DELETE,OPTIONS
15+
CORS_ALLOW_HEADERS=Content-Type,Authorization
16+
17+
# Data Configuration
18+
LIBRARY_FILE=library.json
19+
20+
# Logging Configuration
21+
# Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
22+
LOG_LEVEL=INFO
23+
# Leave empty for stdout only, or specify a file path
24+
LOG_FILE=
25+
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
26+
27+
# OpenLibrary API Configuration
28+
OPENLIBRARY_BASE_URL=https://openlibrary.org
29+
OPENLIBRARY_TIMEOUT=10

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Continuous Integration workflow for Library Management System
2+
# Runs tests and linting on every push and pull request
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [main, master]
9+
pull_request:
10+
branches: [main, master]
11+
12+
jobs:
13+
test:
14+
name: Test (Python ${{ matrix.python-version }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
cache: "pip"
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -r requirements.txt
35+
pip install ruff
36+
37+
- name: Lint with ruff
38+
run: |
39+
ruff check . --output-format=github
40+
41+
- name: Run tests
42+
run: |
43+
pytest -v --tb=short
44+
45+
- name: Run tests with coverage
46+
if: matrix.python-version == '3.11'
47+
run: |
48+
pytest --cov=. --cov-report=xml --cov-report=term-missing
49+
50+
- name: Upload coverage to Codecov
51+
if: matrix.python-version == '3.11'
52+
uses: codecov/codecov-action@v4
53+
with:
54+
files: ./coverage.xml
55+
fail_ci_if_error: false
56+
57+
docker:
58+
name: Docker Build
59+
runs-on: ubuntu-latest
60+
needs: test
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Build Docker image
70+
uses: docker/build-push-action@v5
71+
with:
72+
context: .
73+
push: false
74+
tags: library-management:latest
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max
77+
78+
- name: Test Docker image
79+
run: |
80+
docker run -d --name test-container -p 8000:8000 library-management:latest
81+
sleep 5
82+
curl -f http://localhost:8000/health || exit 1
83+
docker stop test-container

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Release workflow for Library Management System
2+
# Creates releases and publishes Docker images when tags are pushed
3+
4+
name: Release
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
jobs:
12+
release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -r requirements.txt
31+
32+
- name: Run tests
33+
run: pytest -v
34+
35+
- name: Extract version from tag
36+
id: get_version
37+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
38+
39+
- name: Create GitHub Release
40+
uses: softprops/action-gh-release@v1
41+
with:
42+
generate_release_notes: true
43+
body: |
44+
## Library Management System v${{ steps.get_version.outputs.VERSION }}
45+
46+
### Installation
47+
48+
**Using pip:**
49+
```bash
50+
pip install -r requirements.txt
51+
```
52+
53+
**Using Docker:**
54+
```bash
55+
docker pull ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
56+
docker run -p 8000:8000 ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
57+
```
58+
59+
See [CHANGELOG.md](CHANGELOG.md) for detailed changes.
60+
61+
docker-publish:
62+
name: Publish Docker Image
63+
runs-on: ubuntu-latest
64+
needs: release
65+
permissions:
66+
contents: read
67+
packages: write
68+
69+
steps:
70+
- name: Checkout code
71+
uses: actions/checkout@v4
72+
73+
- name: Set up Docker Buildx
74+
uses: docker/setup-buildx-action@v3
75+
76+
- name: Log in to GitHub Container Registry
77+
uses: docker/login-action@v3
78+
with:
79+
registry: ghcr.io
80+
username: ${{ github.actor }}
81+
password: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Extract metadata
84+
id: meta
85+
uses: docker/metadata-action@v5
86+
with:
87+
images: ghcr.io/${{ github.repository }}
88+
tags: |
89+
type=semver,pattern={{version}}
90+
type=semver,pattern={{major}}.{{minor}}
91+
type=semver,pattern={{major}}
92+
type=raw,value=latest
93+
94+
- name: Build and push Docker image
95+
uses: docker/build-push-action@v5
96+
with:
97+
context: .
98+
push: true
99+
tags: ${{ steps.meta.outputs.tags }}
100+
labels: ${{ steps.meta.outputs.labels }}
101+
cache-from: type=gha
102+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.nox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
*.py,cover
48+
.hypothesis/
49+
.pytest_cache/
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Environments
56+
.env
57+
.venv
58+
env/
59+
venv/
60+
ENV/
61+
env.bak/
62+
venv.bak/
63+
64+
# IDE settings
65+
.idea/
66+
.vscode/
67+
*.swp
68+
*.swo
69+
*~
70+
.project
71+
.pydevproject
72+
.settings/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# pyenv
78+
.python-version
79+
80+
# Logs
81+
*.log
82+
logs/
83+
84+
# Local development
85+
.DS_Store
86+
Thumbs.db
87+
88+
# Backup files
89+
*.bak
90+
*.backup
91+
library_backup*.json

0 commit comments

Comments
 (0)