Skip to content

Commit

Permalink
self-contained packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFehseTNG committed Apr 12, 2024
1 parent 8fcf76b commit 25ba9a1
Show file tree
Hide file tree
Showing 7 changed files with 5,792 additions and 15 deletions.
Empty file.
10 changes: 10 additions & 0 deletions src/examples/issue_classification_user_journey/env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
AA_TOKEN=token
CLIENT_URL="https://api.aleph-alpha.com"
ARGILLA_API_URL="http://localhost:6900/"
ARGILLA_API_KEY="argilla.apikey"
HUGGING_FACE_TOKEN=token
TRACE_VIEWER_URL="http://localhost:3000" # local dev builds run on 5173
JIRA_API_URL="https://aleph-alpha.atlassian.net"
JIRA_API_TOKEN=
JIRA_API_MAIL=
JIRA_PROJECT_ID=
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dotenv import load_dotenv
from jira import JIRA

from examples.issue_classification_user_journey.issue_dispatcher.issue_dispatcher import ClassifierPort, Issue, IssueAssigner, IssuePort
from issue_dispatcher.issue_dispatcher import ClassifierPort, Issue, IssueAssigner, IssuePort


def jira_client() -> JIRA:
Expand Down
5,674 changes: 5,674 additions & 0 deletions src/examples/issue_classification_user_journey/poetry.lock

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions src/examples/issue_classification_user_journey/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "issue_classification_user_journey"
version = "0.1"
description = ""
authors = ["Aleph Alpha Engineering <[email protected]>"]
readme = "README.md"
license = "Aleph Alpha Licensed"
packages = [{ include = "issue_dispatcher", from = "." }]

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
pydantic = ">=2.0"
fastapi = "*"
uvicorn = "*"
aleph-alpha-client = ">=4.0.0"
python-dotenv = "*"
semantic-text-splitter = "^0.10.0"
qdrant-client = "^1.8.2"
rich = "^13.7.1"
nbconvert = "^7.16.3"
datasets = "^2.18.0"
jupyter = "^1.0.0"
requests = "^2.31.0"
langdetect = "^1.0.9"
nltk = "^3.8.1"
pycountry = "23.12.11"
rouge = "^1.0.1"
opentelemetry-api = "^1.22.0"
opentelemetry-sdk = "^1.22.0"
huggingface-hub = "^0.22.2"
opentelemetry-exporter-otlp-proto-http = "1.23.0"
jira = "*"
intelligence-layer = { git = "https://github.com/Aleph-Alpha/intelligence-layer.git", branch = "main" }

[tool.poetry.group.dev.dependencies]
# lint & format
mypy = "^1.9.0"
nbqa = "^1.8.5"
ruff = "^0.3.5"
pre-commit = "*"
pylama = { extras = ["radon", "vulture", "toml"], version = "^8.4.1" }
faker = "^24.7.1"

# tests
pytest = "*"
pytest-xdist = "^3.5.0"
hypercorn = "0.16.0"

# typing
httpx = "*"
types-Pygments = "*"
types-colorama = "*"
types-docutils = "*"
types-setuptools = "*"
types-decorator = "*"
types-requests = "*"
types-tqdm = "*"
pandas-stubs = "^2.2.1.240316"
# docs
sphinx-rtd-theme = "^2.0.0"
sphinx = "^7.2.6"
matplotlib = "^3.8.4"

[tool.mypy]
files = "src,tests"
strict = "True"

[tool.pytest.ini_options]
markers = [
"internal: marks tests as internal (deselect with '-k \"not internal\"')",
"docker: the test depends on having a docker container running."
]
addopts = "--capture=tee-sys"
filterwarnings = [
'ignore:.*\`general_plain_validator_function\` is deprecated.*',
]

[tool.pylama]
skip = "*/__init__.py,.venv/*,*/node_modules/*"
ignore = "E501,E203"

[tool.ruff]
extend-include = ["*.ipynb"]

[tool.ruff.lint.mccabe]
max-complexity = 11

# we double check this, maybe pylama isn't necessary anymore
[tool.pylama.linter.mccabe]
max-complexity = "11"

[tool.isort]
profile = "black"
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from examples.issue_classification_user_journey.issue_dispatcher.issue_dispatcher import ClassifierPort, Issue, IssueAssigner

from jira import Issue
from issue_dispatcher.issue_dispatcher import ClassifierPort, IssueAssigner


class AlwaysSameClass(ClassifierPort):
def __init__(self, label: str):
Expand All @@ -16,9 +19,3 @@ def test_should_dispatch_new_issue() -> None:
assignements = issue_assigner.assign_issues(issues)
# Then
assert assignements == {"1": "IT"}






Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os
from typing import Sequence
from dotenv import load_dotenv
from jira import JIRA
from jira import JIRA, Issue
from jira import Issue as JiraIssue
from examples.issue_classification_user_journey.issue_dispatcher.issue_dispatcher import ClassifierPort, Issue, IssueAssigner
from examples.issue_classification_user_journey.issue_dispatcher.jira_adapter import JiraAdapter, jira_client

from issue_dispatcher.issue_dispatcher import ClassifierPort, IssueAssigner
from issue_dispatcher.jira_adapter import jira_client


class AlwaysSameClass(ClassifierPort):
Expand All @@ -13,10 +14,10 @@ def __init__(self, label: str):

def classify(self, _issue: Issue) -> str:
return self.label







def board_with_tickets(jira_client: JIRA, project_id: str, issue_titles: list[str]) -> None:
old_issues = jira_client.search_issues(f"project={project_id}")
Expand Down Expand Up @@ -59,5 +60,3 @@ def test_should_connect_to_jira():
jira = jira_client()
boards = jira.boards()
assert len(boards) >= 1


0 comments on commit 25ba9a1

Please sign in to comment.