Skip to content

Commit aa74ab5

Browse files
Merge branch 'trustyai-explainability:main' into main
2 parents ec533cf + c535d4c commit aa74ab5

21 files changed

+1699
-1160
lines changed

.flake8

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[flake8]
2+
# UFN plugin must be run in serial
3+
jobs = 0
4+
max-line-length = 120
5+
6+
exclude =
7+
doc,
8+
.venv,
9+
.git,
10+
.yml,
11+
Pipfile.*,
12+
docs/*,
13+
14+
fcn_exclude_functions =
15+
re,
16+
logging,
17+
LOGGER,
18+
os,
19+
json,
20+
yaml,
21+
pytest,
22+
23+
enable-extensions =
24+
FCN,
25+
UFN,
26+
NIC,
27+
NIT,

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ cython_debug/
159159
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
162+
.idea/
163163
.idea/.gitignore
164164
.idea/misc.xml
165165
.idea/modules.xml

.pre-commit-config.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
minimum_pre_commit_version: 3.3.0
2+
default_install_hook_types: [pre-commit, commit-msg]
3+
4+
default_language_version:
5+
python: python3
6+
7+
repos:
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: "v5.0.0"
10+
hooks:
11+
- id: check-merge-conflict
12+
- id: debug-statements
13+
- id: trailing-whitespace
14+
args: [--markdown-linebreak-ext=md] # Do not process Markdown files.
15+
- id: end-of-file-fixer
16+
- id: check-ast
17+
- id: check-builtin-literals
18+
- id: check-docstring-first
19+
- id: check-toml
20+
21+
- repo: https://github.com/PyCQA/flake8
22+
rev: "7.1.2"
23+
hooks:
24+
- id: flake8
25+
args: [--config=.flake8, '--ignore=FCN001,W503']
26+
additional_dependencies:
27+
[
28+
"git+https://github.com/RedHatQE/[email protected]",
29+
"flake8-mutable",
30+
]
31+
32+
- repo: https://github.com/Yelp/detect-secrets
33+
rev: v1.5.0
34+
hooks:
35+
- id: detect-secrets
36+
37+
- repo: https://github.com/astral-sh/ruff-pre-commit
38+
rev: v0.9.10
39+
hooks:
40+
- id: ruff
41+
- id: ruff-format
42+
43+
- repo: https://github.com/gitleaks/gitleaks
44+
rev: v8.24.0
45+
hooks:
46+
- id: gitleaks
47+
48+
- repo: https://github.com/pre-commit/mirrors-mypy
49+
rev: v1.15.0
50+
hooks:
51+
- id: mypy
52+
additional_dependencies: ["types-PyYAML", "types-requests"]
53+
exclude: ^(docs/|.*/test_.*)

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# New contributor guide
2+
3+
## Installation
4+
5+
TrustyAIService uses `uv` as a package manager. To install it, follow the official [installation guide](https://github.com/astral-sh/uv).
6+
7+
First, create a virtual environment:
8+
```bash
9+
uv venv
10+
source .venv/bin/activate
11+
```
12+
13+
Then install the project dependencies into your virtual environment:
14+
```bash
15+
uv pip install -e .
16+
```
17+
18+
## pre-commit
19+
20+
In order to ensure proper and consistent code formatting, we use `pre-commit` in combination with tools like `ruff`, `flake8`, and `mypy`. When committing your code, make sure that all the pre-commit checks pass in your local environment.
21+
To install pre-commit:
22+
23+
```bash
24+
pre-commit install -t pre-commit -t commit-msg
25+
```
26+
27+
Run manually pre-commit:
28+
29+
```bash
30+
pre-commit run --all-files
31+
```

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ WORKDIR /app
66

77
COPY pyproject.toml poetry.lock* ./
88

9-
RUN pip install poetry==1.6.1
10-
11-
RUN poetry export -f requirements.txt --without dev > requirements.txt && \
9+
USER root
10+
RUN pip install poetry==1.6.1 && \
11+
poetry export -f requirements.txt --without dev > requirements.txt && \
1212
pip install --no-cache-dir -r requirements.txt
13-
1413
COPY . .
14+
USER 1001
15+
EXPOSE 4443
1516

16-
EXPOSE 8080
17-
18-
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8080"]
17+
#CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "4443", "--ssl-keyfile", "/etc/tls/internal/tls.key", "--ssl-certfile", "/etc/tls/internal/tls.crt", "--log-level", "trace"]
18+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "4443", "--ssl-keyfile", "/etc/tls/internal/tls.key", "--ssl-certfile", "/etc/tls/internal/tls.crt"]

poetry.lock

Lines changed: 0 additions & 1113 deletions
This file was deleted.

pyproject.toml

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1-
[tool.poetry]
1+
[project]
22
name = "trustyai-service"
33
version = "1.0.0rc0"
44
description = "TrustyAI Service"
5-
authors = ["Rui Vieira", "TrustyAI team"]
5+
authors = [
6+
{ name = "Rui Vieira" },
7+
{ name = "TrustyAI team" },
8+
]
9+
requires-python = "~=3.11"
610
readme = "README.md"
7-
packages = [{include = "src"}]
8-
9-
[tool.poetry.dependencies]
10-
python = "^3.11"
11-
fastapi = "^0.115.9"
12-
pandas = "^2.2.3"
13-
prometheus-client = "^0.21.1"
14-
pydantic = "^2.4.2"
15-
uvicorn = "^0.34.0"
16-
protobuf = "^4.24.4"
17-
requests = "^2.31.0"
18-
19-
[tool.poetry.group.dev.dependencies]
20-
pytest = "^7.4.2"
21-
black = "^23.9.1"
22-
isort = "^5.12.0"
23-
flake8 = "^6.1.0"
24-
mypy = "^1.5.1"
25-
pytest-cov = "^4.1.0"
26-
httpx = "^0.25.0"
11+
dependencies = [
12+
"fastapi>=0.115.9,<0.116",
13+
"pandas>=2.2.3,<3",
14+
"prometheus-client>=0.21.1,<0.22",
15+
"pydantic>=2.4.2,<3",
16+
"uvicorn>=0.34.0,<0.35",
17+
"protobuf>=4.24.4,<5",
18+
"requests>=2.31.0,<3",
19+
"cryptography>=44.0.2,<45",
20+
"h5py>=3.13.0,<4",
21+
]
2722

28-
[build-system]
29-
requires = ["poetry-core"]
30-
build-backend = "poetry.core.masonry.api"
23+
[dependency-groups]
24+
dev = [
25+
"pytest>=7.4.2,<8",
26+
"isort>=5.12.0,<6",
27+
"flake8>=6.1.0,<7",
28+
"mypy>=1.5.1,<2",
29+
"pytest-cov>=4.1.0,<5",
30+
"httpx>=0.25.0,<0.26",
31+
]
32+
33+
[tool.hatch.build.targets.sdist]
34+
include = ["src"]
35+
36+
[tool.hatch.build.targets.wheel]
37+
include = ["src"]
3138

32-
[tool.black]
33-
line-length = 88
34-
target-version = ["py311"]
35-
include = '\.pyi?$'
39+
[build-system]
40+
requires = ["hatchling"]
41+
build-backend = "hatchling.build"
3642

3743
[tool.isort]
3844
profile = "black"
@@ -44,8 +50,22 @@ warn_return_any = true
4450
warn_unused_configs = true
4551
disallow_untyped_defs = true
4652
disallow_incomplete_defs = true
53+
check_untyped_defs = true
54+
no_implicit_optional = true
55+
show_error_codes = true
56+
warn_unused_ignores = true
57+
58+
[tool.ruff]
59+
preview = true
60+
line-length = 120
61+
fix = true
62+
output-format = "grouped"
63+
extend-exclude = ["utilities/manifests"]
64+
65+
[tool.ruff.format]
66+
exclude = [".git", ".venv", ".mypy_cache", "__pycache__"]
4767

4868
[tool.pytest.ini_options]
4969
testpaths = ["tests"]
5070
python_files = "test_*.py"
51-
python_functions = "test_*"
71+
python_functions = "test_*"

src/__init__.py

Whitespace-only changes.

src/core/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)