Skip to content

Commit 94e9e69

Browse files
committed
feat: spell checker added, python 3.14 bump
1 parent fee6dcf commit 94e9e69

File tree

8 files changed

+50
-47
lines changed

8 files changed

+50
-47
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Python 3",
3-
"image": "mcr.microsoft.com/devcontainers/python:3.13-bookworm",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.14-bookworm",
44
"remoteUser": "vscode",
55
"mounts": [
66
"source=/run/host-services/ssh-auth.sock,target=/ssh-agent,type=bind",
@@ -26,7 +26,8 @@
2626
"github.vscode-github-actions",
2727
"eamodio.gitlens",
2828
"redhat.vscode-yaml",
29-
"christian-kohler.path-intellisense"
29+
"christian-kohler.path-intellisense",
30+
"streetsidesoftware.code-spell-checker"
3031
]
3132
}
3233
},

.github/workflows/build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,3 @@ jobs:
6464
org.opencontainers.image.version=${{ steps.meta.outputs.VERSION }}
6565
org.opencontainers.image.revision=${{ steps.meta.outputs.COMMIT }}
6666
org.opencontainers.image.created=${{ steps.meta.outputs.DATE }}
67-
org.opencontainers.image.description=minimalistic Python image for backend development
68-
org.opencontainers.image.licenses=MIT
69-
org.opencontainers.image.vendor=LevArc
70-
org.opencontainers.image.documentation=https://github.com/levpa/python-try

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"yaml.format.enable": true,
1414
"yaml.schemas": {},
1515
"yaml.customTags": [],
16+
"cSpell.enabledFileTypes": {
17+
"*": false,
18+
"python": true
19+
},
1620
"editor.formatOnSave": true,
1721
"editor.codeActionsOnSave": [
1822
"source.organizeImports",

Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
FROM python:3.13-slim-bookworm
1+
FROM python:3.14-slim-bookworm
2+
3+
LABEL maintainer="LevPa"
4+
LABEL description="Production-ready Python server container"
5+
LABEL licenses="MIT"
6+
LABEL documentation="https://github.com/levpa/python-try"
7+
28
WORKDIR /app
9+
RUN useradd -m appuser
10+
USER appuser
311

412
COPY src/requirements.txt ./requirements.txt
13+
RUN grep -E '==' requirements.txt || (echo "Unpinned dependencies found!" && exit 1)
514
RUN pip install --no-cache-dir -r requirements.txt
15+
616
COPY src/ ./src/
717

818
EXPOSE 8080
9-
CMD ["python", "src/server.py"]
19+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
20+
CMD curl -f http://localhost:8080/health || exit 1
21+
22+
CMD ["python", "src/server.py"]

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.PHONY: verify test hook lint check-build precommit release version-inject docker-build chlog
22

33
SRC_FOLDER := src
4-
REPO := levpa/python-try
54
verify:
65
@echo "🔍 Verifying Python environment..."
76
@python3.13 --version
@@ -34,6 +33,7 @@ release:
3433
@echo "🚀 Releasing version bump..."
3534
bash scripts/bump.sh $(BUMP_TYPE)
3635

36+
REPO := levpa/python-try
3737
VERSION := $(shell git tag --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$$' | head -n 1)
3838
COMMIT := $(shell git rev-parse --short HEAD)
3939
BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
@@ -54,11 +54,10 @@ docker-build:
5454
-t ghcr.io/$(REPO):$(VERSION) .
5555
docker run -p 8080:8080 py-server
5656

57-
CHLOG_LENGTH ?= 5
57+
CHLOG_LENGTH ?= 20
5858
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
5959
VERSION := $(shell git describe --tags --abbrev=0)
6060

61-
6261
chlog:
6362
@echo "# Changelog for $(VERSION)\n" > CHANGELOG.md
6463
@printf "## Date: $(shell date '+%Y-%m-%d')\n\n" >> CHANGELOG.md

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ pip install -r src/requirements.txt
3636
# CI test
3737
make verify lint test check-build
3838

39-
# Commit add and signing with SSH keys:
40-
git sm "new signed commit"
41-
git push
42-
43-
## bump version and push tags to remote (default -> patch version)
39+
# add and commit files:
40+
git add -A && git commit -m "new signed commit" && git push
4441

42+
## bump version and push tags to remote (default behavior -> patch version)
4543
# !! runs build -> push pipeline to ghcr
4644
# !! runs release pipeline to make release on github
47-
4845
make release # make release <patch/minor/major>
4946

5047
## Server local test

scripts/bootstrap.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ sudo ln -sf /usr/share/zoneinfo/Europe/Kyiv /etc/localtime
1111
sudo dpkg-reconfigure -f noninteractive tzdata
1212

1313
# Ensure Python 3.12 is available
14-
if ! command -v python3.13 &> /dev/null; then
15-
echo "❌ Python 3.13 not found. Please install it in the container base image."
14+
if ! command -v python3.14 &> /dev/null; then
15+
echo "❌ Python 3.14 not found. Please install it in the container base image."
1616
exit 1
1717
fi
1818

19-
python3.13 -m pip install --upgrade pip
19+
python3.14 -m pip install --upgrade pip
2020
pip install -r src/requirements.txt
2121

2222
# Run Makefile targets

src/server.py

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,38 @@
11
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
2-
import requests
32
import sys
3+
import time
4+
5+
try:
6+
from version import VERSION, COMMIT, BUILD_DATE
7+
except ImportError:
8+
VERSION = COMMIT = BUILD_DATE = "unknown"
9+
10+
print(f"\nVersion: {VERSION}, Commit: {COMMIT}, Built: {BUILD_DATE}\n")
11+
sys.stdout.flush()
412

513
class SimpleHandler(BaseHTTPRequestHandler):
614
def do_GET(self):
7-
print(f"{self.client_address[0]} requested {self.path}", file=sys.stderr)
15+
start = time.time()
16+
client_ip = self.client_address[0]
17+
path = self.path
818

9-
if self.path == "/favicon.ico":
10-
self.send_response(204) # No Content
19+
print(f"{client_ip} requested {path}", file=sys.stderr)
20+
21+
if path == "/favicon.ico":
22+
self.send_response(204)
1123
self.end_headers()
1224
return
1325

14-
# GitHub API call
15-
response = requests.get("https://api.github.com")
16-
try:
17-
data = response.json()
18-
user_related = {k: v for k, v in data.items() if 'user' in k.lower()}
19-
print("🔍 Filtered 'user' keys:")
20-
for key, value in user_related.items():
21-
print(f"{key}: {value}")
22-
except ValueError:
23-
print("❌ Not JSON. Content-Type:", response.headers.get("Content-Type"))
24-
25-
# Response to client
2626
self.send_response(200)
2727
self.send_header("Content-type", "text/plain; charset=utf-8")
2828
self.end_headers()
2929
self.wfile.write(b"Hello from Python 3.12 HTTP server!\n")
3030

31-
def log_message(self, format, *args):
32-
# Cleaner logging to stderr for Docker visibility
33-
print(f"{self.client_address[0]} requested {self.path}", file=sys.stderr)
31+
duration = time.time() - start
32+
print(f"⏱️ Served {path} in {duration:.3f}s", file=sys.stderr)
3433

35-
try:
36-
from version import VERSION, COMMIT, BUILD_DATE
37-
except ImportError:
38-
VERSION = COMMIT = BUILD_DATE = "unknown"
39-
40-
print(f"\nVersion: {VERSION}, Commit: {COMMIT}, Built: {BUILD_DATE}\n")
41-
42-
sys.stdout.flush()
34+
def log_message(self, format, *args):
35+
return
4336

4437
if __name__ == "__main__":
4538
host = "0.0.0.0"

0 commit comments

Comments
 (0)