Skip to content

Commit

Permalink
Migrates poetry to pdm
Browse files Browse the repository at this point in the history
  • Loading branch information
mrharpo committed Aug 3, 2023
1 parent 4991b7d commit 8e7d1b9
Show file tree
Hide file tree
Showing 8 changed files with 973 additions and 2,024 deletions.
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'
10 changes: 5 additions & 5 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 @@ async def http_exception_handler(request, exc):
@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)
json_value = loads(str(mmif))
log.debug(f'sourced: {json_value}')
return json_value
Expand Down
1 change: 0 additions & 1 deletion fastclam/version.py

This file was deleted.

930 changes: 930 additions & 0 deletions pdm.lock

Large diffs are not rendered by default.

1,975 changes: 0 additions & 1,975 deletions poetry.lock

This file was deleted.

2 changes: 0 additions & 2 deletions poetry.toml

This file was deleted.

75 changes: 34 additions & 41 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
[tool.poetry]
[project]
name = "FastCLAM"
version = "0.0.1"
description = "FastAPI for CLAMS Applications"
authors = ["WGBH-MLA"]
dynamic = ['version']
description = "FastAPI for CLAMS utilities"
authors = [{ name = "WGBH-MLA", email = "ryan_harbert@wgbh.org" }]
dependencies = [
"clams-python~=1.0",
"mmif-python~=1.0",
"pydantic~=1.10",
"fastapi~=0.100",
"loguru~=0.7",
"rich~=13.5",
]
requires-python = ">=3.11"
readme = "README.md"
packages = [{include = "fastclam"}]

[tool.poetry.dependencies]
python = "^3.8.1"
clams-python = "^0.5.2"
mmif-python = "^0.4.2"
pydantic = "^1.8.2"
fastapi = "^0.94.0"
loguru = "^0.6.0"
rich = "^13.3.2"


[tool.poetry.group.dev.dependencies]
uvicorn = "^0.21.0"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.2.2"
httpx = "^0.23.3"
pytest-cov = "^4.0.0"
black = "^23.1.0"
flake8 = "^6.0.0"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.4.2"
mkdocs-material = "^9.1.2"
mkdocs-git-revision-date-localized-plugin = "^1.2.0"
mkdocstrings = {extras = ["python"], version = "^0.20.0"}
mike = "^1.1.2"

license = { text = "MIT" }

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

[tool.ruff.flake8-quotes]
inline-quotes = 'single'

[tool.pdm]
version = { source = 'file', path = 'fastclam/_version.py' }

[tool.pdm.dev-dependencies]
dev = [
"uvicorn~=0.23",
"black~=23.7",
"ruff~=0.0",
]
test = [
"pytest~=7.4",
"pytest-cov~=4.1",
"httpx~=0.24",
]

0 comments on commit 8e7d1b9

Please sign in to comment.