Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛂 Migrates poetry to pdm #12

Merged
merged 4 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: 🧪 Integration Tests

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
tests:
name: ⚗️ Application Tests
uses: ./.github/workflows/pytest.yml
uses: WGBH-MLA/.github/.github/workflows/pytest.yml@main
secrets: inherit
with:
pdm_args: -G test
pytest_args: -v

lint:
name: 👕 Lint
uses: ./.github/workflows/lint.yml
uses: WGBH-MLA/.github/.github/workflows/lint.yml@main

black:
name: 🖤 Black
uses: ./.github/workflows/black.yml
uses: WGBH-MLA/.github/.github/workflows/black.yml@main
30 changes: 0 additions & 30 deletions .github/workflows/lint.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/pytest.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RUN pip install -U pip uvicorn

WORKDIR /app

COPY pyproject.toml poetry.lock README.md ./
COPY pyproject.toml pdm.lock README.md ./
COPY fastclam fastclam

RUN pip install .
Expand Down
3 changes: 3 additions & 0 deletions fastclam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[localhost:8000/docs](http://localhost:8000/docs)

"""
from ._version import __version__

__all__ = ['__version__']
1 change: 1 addition & 0 deletions fastclam/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.2.0'
14 changes: 7 additions & 7 deletions fastclam/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
from xml.etree.ElementTree import ParseError

import requests
from clams.source import generate_source_mmif
from clams.source import generate_source_mmif_from_file
from fastapi import FastAPI, HTTPException
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException

from ._version import __version__
from .log import log
from .models import Inputs, Pipeline
from .version import __VERSION__


class MMIFException(HTTPException):
pass


app = FastAPI(title='FastCLAM')
app = FastAPI(title='FastCLAM', version=__version__)


@app.exception_handler(StarletteHTTPException)
Expand All @@ -29,14 +29,14 @@
@app.get('/')
def home() -> dict:
"""Return version info"""
return {'FastCLAM': __VERSION__}
return {'FastCLAM': __version__}


@app.post('/source')
def generate_source(files: Inputs) -> dict:
"""Generate a new source MMIF from multiple input files"""
log.info(f'sourcing media {files.files}')
mmif = generate_source_mmif(files.files)
mmif = generate_source_mmif_from_file(files.files)

Check warning on line 39 in fastclam/app.py

View check run for this annotation

Codecov / codecov/patch

fastclam/app.py#L39

Added line #L39 was not covered by tests
json_value = loads(str(mmif))
log.debug(f'sourced: {json_value}')
return json_value
Expand Down Expand Up @@ -76,7 +76,7 @@
log.debug(response.content)
raise HTTPException(
status_code=response.status_code,
detail=f'Unsuccessful response from {app}: {response.status_code} - {response.content}',
detail=f'Unsuccessful response from {app}: {response.status_code} - {response.content}', # noqa E501
)
content_type = response.headers.get('Content-Type')
if 'application/json' in content_type:
Expand All @@ -95,7 +95,7 @@
log.debug(response.content)
raise MMIFException(
status_code=499,
detail=f'Failed to parse XML from {app}: {response.status_code} - {response.content}',
detail=f'Failed to parse XML from {app}: {response.status_code} - {response.content}', # noqa E501
)

log.info(f'Ran {len(pipeline.files)} files through {len(pipeline.apps)} apps')
Expand Down
2 changes: 1 addition & 1 deletion fastclam/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
handlers=[
{
"sink": RichHandler(),
"format": "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
"format": "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>", # noqa E501
}
]
)
1 change: 0 additions & 1 deletion fastclam/version.py

This file was deleted.

Loading