Skip to content

Commit

Permalink
fix: adjust to poetry rebase, fix conflicts, minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cakeinsauce committed Mar 22, 2023
1 parent 6682c90 commit 80accee
Show file tree
Hide file tree
Showing 42 changed files with 677 additions and 1,762 deletions.
45 changes: 22 additions & 23 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- "**" # TOOD: remove before merging
jobs:
annotation:
runs-on: ubuntu-latest
Expand All @@ -24,12 +23,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./annotation
run: poetry run python annotation/cli.py openapi .$SPEC_PATH
run: poetry run annotation openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -56,12 +55,12 @@ jobs:
sudo apt-get update && sudo apt-get -y install poppler-utils
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./assets
run: poetry run python assets/cli.py openapi .$SPEC_PATH
run: poetry run assets openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -87,11 +86,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./convert
run: poetry run python convert/cli.py openapi .$SPEC_PATH
run: poetry run convert openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -117,12 +116,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./jobs
run: poetry run python jobs/cli.py openapi .$SPEC_PATH
run: poetry run jobs openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -148,12 +147,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./models
run: poetry run python models/cli.py openapi .$SPEC_PATH
run: poetry run models openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -179,12 +178,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./pipelines
run: poetry run python pipelines/cli.py openapi .$SPEC_PATH
run: poetry run pipelines openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -210,11 +209,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./processing
run: poetry run python processing/cli.py openapi .$SPEC_PATH
run: poetry run processing openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -240,11 +239,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./scheduler
run: poetry run python scheduler/cli.py openapi .$SPEC_PATH
run: poetry run scheduler openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -270,12 +269,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./search
run: poetry run python search/cli.py openapi .$SPEC_PATH
run: poetry run search openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -301,12 +300,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/filter_lib
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./taxonomy
run: poetry run python taxonomy/cli.py openapi .$SPEC_PATH
run: poetry run taxonomy openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand All @@ -332,11 +331,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
poetry install --no-root --without dev
poetry add --editable ../lib/tenants
- name: Generate documentation
working-directory: ./users
run: poetry run python users/cli.py openapi .$SPEC_PATH
run: poetry run users openapi .$SPEC_PATH
env:
PYTHONPATH: .
- name: Save documentation
Expand Down
10 changes: 4 additions & 6 deletions annotation/annotation/annotations/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
500: {"model": ConnectionErrorSchema},
},
summary="Save annotation by user.",
tags=[ANNOTATION_TAG],
)
def post_annotation_by_user(
doc: DocForSaveSchema,
Expand Down Expand Up @@ -232,7 +231,6 @@ def post_annotation_by_user(
500: {"model": ConnectionErrorSchema},
},
summary="Save annotation by pipeline.",
tags=[ANNOTATION_TAG],
)
def post_annotation_by_pipeline(
doc: DocForSaveSchema,
Expand Down Expand Up @@ -365,7 +363,7 @@ def get_jobs_by_file_id(
},
summary="Get latest revision made by particular "
"user (or by pipeline) for particular pages.",
tags=[REVISION_TAG, ANNOTATION_TAG],
tags=[REVISION_TAG],
)
def get_latest_revision_by_user(
job_id: int = Path(..., example=3),
Expand Down Expand Up @@ -407,7 +405,7 @@ def get_latest_revision_by_user(
summary="Get annotation for given revision."
"Info will be accumulated from first revision up to"
"given.",
tags=[REVISION_TAG, ANNOTATION_TAG],
tags=[REVISION_TAG],
)
def get_annotations_up_to_given_revision(
job_id: int = Path(..., example=1),
Expand Down Expand Up @@ -500,7 +498,7 @@ def get_annotations_up_to_given_revision(
500: {"model": ConnectionErrorSchema},
},
summary="Get annotation for latest or particular revision.",
tags=[REVISION_TAG, ANNOTATION_TAG],
tags=[REVISION_TAG],
)
def get_annotation_for_given_revision(
job_id: int = Path(..., example=1),
Expand Down Expand Up @@ -544,7 +542,7 @@ def get_annotation_for_given_revision(
},
summary="Get all users revisions (or pipeline revision) "
"for particular pages.",
tags=[REVISION_TAG, ANNOTATION_TAG],
tags=[REVISION_TAG],
)
def get_all_revisions(
job_id: int,
Expand Down
8 changes: 6 additions & 2 deletions annotation/annotation/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def init_cli_handlers(app: FastAPI, arguments: Any) -> None:
parser.print_help()


if __name__ == "__main__":
from main import app
def main():
from .main import app

init_cli_handlers(app, sys.argv[1:])


if __name__ == "__main__":
main()
13 changes: 2 additions & 11 deletions annotation/annotation/jobs/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
UnassignedFilesInfoSchema,
ValidationSchema,
)
from annotation.tags import FILES_TAG, JOBS_TAG
from annotation.tags import JOBS_TAG
from annotation.token_dependency import TOKEN

from ..models import (
Expand Down Expand Up @@ -81,13 +81,13 @@
router = APIRouter(
prefix="/jobs",
responses={500: {"model": ConnectionErrorSchema}},
tags=[JOBS_TAG],
)


@router.post(
"/{job_id}",
status_code=status.HTTP_201_CREATED,
tags=[JOBS_TAG],
responses={
400: {"model": BadRequestErrorSchema},
},
Expand Down Expand Up @@ -206,7 +206,6 @@ def post_job(
@router.patch(
"/{job_id}",
status_code=status.HTTP_204_NO_CONTENT,
tags=[JOBS_TAG],
responses={
400: {"model": BadRequestErrorSchema},
404: {"model": NotFoundErrorSchema},
Expand Down Expand Up @@ -289,7 +288,6 @@ def update_job(
"/{job_id}/files",
status_code=status.HTTP_200_OK,
response_model=JobFilesInfoSchema,
tags=[FILES_TAG],
responses={
404: {"model": NotFoundErrorSchema},
},
Expand Down Expand Up @@ -337,7 +335,6 @@ def get_job_files(
"/{job_id}/files/unassigned",
status_code=status.HTTP_200_OK,
response_model=UnassignedFilesInfoSchema,
tags=[FILES_TAG],
summary="Get list of unassigned files by job id.",
)
def get_unassigned_files(
Expand Down Expand Up @@ -408,7 +405,6 @@ def get_unassigned_files(

@router.post(
"/{job_id}/start",
tags=[JOBS_TAG],
status_code=status.HTTP_200_OK,
response_model=List[ManualAnnotationTaskSchema],
responses={
Expand Down Expand Up @@ -482,7 +478,6 @@ def start_job(
"/{job_id}/users",
status_code=status.HTTP_200_OK,
response_model=List[Dict[str, Union[UUID, int]]],
tags=[JOBS_TAG],
responses={
404: {"model": NotFoundErrorSchema},
},
Expand Down Expand Up @@ -510,7 +505,6 @@ def get_users_for_job(
@router.get(
"/{job_id}/categories",
status_code=status.HTTP_200_OK,
tags=[JOBS_TAG],
response_model=Page[Union[CategoryResponseSchema, str, dict]],
summary="Get list of categories for provided job_id",
responses={
Expand Down Expand Up @@ -542,7 +536,6 @@ def fetch_job_categories(
@router.post(
"/{job_id}/categories/search",
status_code=status.HTTP_200_OK,
tags=[JOBS_TAG],
response_model=Page[Union[CategoryResponseSchema, str, dict]],
summary="Search categories for provided job_id",
responses={
Expand Down Expand Up @@ -579,7 +572,6 @@ def search_job_categories(
@router.get(
"",
status_code=status.HTTP_200_OK,
tags=[JOBS_TAG],
summary="Get info about jobs, in which provided file ids participate",
)
def get_jobs_info_by_files(
Expand All @@ -602,7 +594,6 @@ def get_jobs_info_by_files(
"/{job_id}/progress",
status_code=status.HTTP_200_OK,
response_model=JobProgressSchema,
tags=[JOBS_TAG],
responses={
404: {"model": NotFoundErrorSchema},
},
Expand Down
4 changes: 2 additions & 2 deletions annotation/annotation/metadata/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
X_CURRENT_TENANT_HEADER,
)
from annotation.schemas import EntitiesStatusesSchema
from annotation.tags import METADATA_TAG, TASKS_TAG
from annotation.tags import METADATA_TAG

router = APIRouter(
prefix="/metadata",
tags=[TASKS_TAG, METADATA_TAG],
tags=[METADATA_TAG],
)


Expand Down
4 changes: 2 additions & 2 deletions annotation/annotation/revisions/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
)
from annotation.models import AnnotatedDoc
from annotation.schemas import AnnotatedDocSchema, ConnectionErrorSchema
from annotation.tags import ANNOTATION_TAG, REVISION_TAG
from annotation.tags import REVISION_TAG

router = APIRouter(
prefix="/revisions",
tags=[REVISION_TAG, ANNOTATION_TAG],
tags=[REVISION_TAG],
responses={500: {"model": ConnectionErrorSchema}},
)

Expand Down
3 changes: 1 addition & 2 deletions annotation/annotation/tasks/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
ValidationEndSchema,
ValidationSchema,
)
from annotation.tags import REVISION_TAG, TASKS_TAG
from annotation.tags import TASKS_TAG
from annotation.tasks.validation import (
create_annotation_tasks,
create_validation_tasks,
Expand Down Expand Up @@ -716,7 +716,6 @@ def delete_batch_tasks(
"/{task_id}/pages_summary",
status_code=status.HTTP_200_OK,
response_model=PagesInfoSchema,
tags=[REVISION_TAG],
responses={
404: {"model": NotFoundErrorSchema},
},
Expand Down
5 changes: 4 additions & 1 deletion annotation/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cachetools = "^5.0.0"
kafka-python = "^2.0.2"
sqlalchemy-utils = "^0.38.3"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pre-commit = "^2.14.0"
commitizen = "^2.18.0"
black = "^21.7b0"
Expand All @@ -31,6 +31,9 @@ responses = "^0.14.0"
moto = {extras = ["s3"], version = "^2.2.8"}
pytest-cov = "^3.0.0"

[tool.poetry.scripts]
annotation = "annotation.cli:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 80accee

Please sign in to comment.