Skip to content

Commit

Permalink
Adding metadata, modifying file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhoyer committed Aug 16, 2024
1 parent 21f872d commit fb5d9da
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install pytest
run: |
python -m pip install pytest
python -m pip install -r src/requirements.txt
python -m pip install .
- name: Build the web image
Expand All @@ -54,14 +54,14 @@ jobs:
podman run -d --pod tmt-web-pod --name celery \
-e REDIS_URL=redis://localhost:6379 \
-e API_HOSTNAME=http://localhost:8000 \
tmt-web:latest celery --app=src.api.service worker --loglevel=INFO
tmt-web:latest celery --app=tmt_web.api.service worker --loglevel=INFO
- name: Start Web container
run: |
podman run -d --pod tmt-web-pod --name web \
-e REDIS_URL=redis://localhost:6379 \
-e API_HOSTNAME=http://localhost:8000 \
tmt-web:latest uvicorn src.api:app --reload --host 0.0.0.0 --port 8000
tmt-web:latest uvicorn tmt_web.api:app --reload --host 0.0.0.0 --port 8000
- name: Wait for services to be ready
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ venv
.venv
.idea
.vscode
dist
.ruff_cache
.mypy_chache
__pycache__
4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM python:${PYTHON_VERSION}

RUN mkdir /app
WORKDIR /app
COPY ./src /app/src
RUN pip install -r /app/src/requirements.txt
COPY ./src/tmt_web /app/tmt_web
RUN pip install -r /app/tmt_web

COPY /entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ APP=$1

case $APP in
uvicorn)
COMMAND="uvicorn src.api:app --reload --host 0.0.0.0 --port 8000"
COMMAND="uvicorn tmt_web.api:app --reload --host 0.0.0.0 --port 8000"
;;
celery)
COMMAND="celery --app=src.api.service worker --loglevel=INFO"
COMMAND="celery --app=tmt_web.api.service worker --loglevel=INFO"
;;
*)
echo "Unknown app '$APP'"
Expand Down
113 changes: 113 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "tmt-web"
dynamic = ["version"]
description = 'Web app for checking tmt tests, plans and stories'
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
keywords = []
authors = [
{ name = "Petr Splichal", email = "[email protected]" },
{ name = "Tomas Koscielniak", email = "[email protected]" }
]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tmt~=1.35",
"fastapi~=0.112",
"httpx~=0.27",
"uvicorn~=0.30",
"celery[redis]~=5.4",
]

[project.urls]
Source = "https://github.com/teemtee/web teemtee/tmt-web"

[tool.hatch.version]
source = "vcs"
raw-options.version_scheme = "release-branch-semver"

[tool.hatch.build.targets.wheel]
packages = [
"src/tmt_web",
"entrypoint.sh",
"LICENSE",
"README.md",
]

[tool.hatch.envs.dev]
extra-dependencies = [
"mypy~=1.11.1",
"ruff~=0.5.7",
"hatch",
]

[tool.hatch.envs.dev.scripts]
check = "mypy --install-types --non-interactive src/tmt_web"

[tool.ruff]
# Based on teemtee/tmt/pyproject.toml
line-length = 100
target-version = "py312"
lint.select = [
"F", # pyflakes
"E", # pycodestyle error
"W", # pycodestyle warning
"I", # isort
"N", # pep8-naming
#"D", # pydocstyle TODO
"UP", # pyupgrade
"YTT", # flake8-2020
"ASYNC", # flake8-async
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EXE", # flake8-executable
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"G", # flake8-logging-format
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q003", # avoidable-escaped-quote
"Q004", # unnecessary-escaped-quote
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"INT", # flake8-gettext
"PGH", # pygrep-hooks
"PLC", # pylint-convention
"PLE", # pylint-error
"PLR", # pylint-refactor
"RUF", # ruff
]
lint.ignore = [
#"E501", # TODO line lenght
"PLR0913", # Too many arguments
"RET505", # Unnecessary 'else' after 'return'
"COM812", # Trailing comma missing
]

[tool.ruff.lint.per-file-ignores]
# Less strict security checks in tests
"tests/*" = [
"S101", # Assert usage
"PLR2004", # Magic value
"E501", # Line length
]
"src/tmt_web/generators/html_generator.py" = [
"W291", # Trailing whitespace
"E501", # Line length
]
5 changes: 0 additions & 5 deletions src/requirements.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit fb5d9da

Please sign in to comment.