mirror of
https://github.com/enpaul/kodak.git
synced 2024-11-14 02:27:24 +00:00
Rename project to fresnel-lens
This commit is contained in:
parent
f9c38a5bcc
commit
888225bdf7
4
.gitignore
vendored
4
.gitignore
vendored
@ -16,9 +16,9 @@ dist/
|
||||
|
||||
docs/_build/
|
||||
docs/modules.rst
|
||||
docs/imagemuck*.rst
|
||||
docs/fresnel_lens*.rst
|
||||
|
||||
imagemuck/openapi.yaml
|
||||
fresnel_lens/openapi.yaml
|
||||
|
||||
.vscode/
|
||||
.idea/
|
||||
|
@ -32,7 +32,7 @@ repos:
|
||||
name: reorder-python-imports
|
||||
entry: reorder-python-imports
|
||||
args:
|
||||
- "--unclassifiable-application-module=imagemuck"
|
||||
- "--unclassifiable-application-module=fresnel_lens"
|
||||
language: system
|
||||
types: [python]
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -1,7 +1,7 @@
|
||||
# ImageMuck makefile
|
||||
# fresnel-lens makefile
|
||||
|
||||
# You can set these variables from the command line
|
||||
PROJECT = imagemuck
|
||||
PROJECT = fresnel_lens
|
||||
|
||||
.PHONY: help
|
||||
# Put it first so that "make" without argument is like "make help"
|
||||
|
@ -1,4 +1,4 @@
|
||||
# imagemuck
|
||||
# fresnel-lens
|
||||
|
||||
HTTP server for handling image uploads and thumbnail generation.
|
||||
|
||||
|
@ -12,7 +12,7 @@ from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).parent.resolve()
|
||||
ABOUT = {}
|
||||
with open(Path(BASE_DIR, "..", "imagemuck", "__about__.py")) as infile:
|
||||
with open(Path(BASE_DIR, "..", "fresnel_lens", "__about__.py")) as infile:
|
||||
exec(infile.read(), ABOUT)
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
ImageMuck
|
||||
=========
|
||||
Fresnel Lens
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
API Reference <imagemuck>
|
||||
API Reference <fresnel_lens>
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
"""Programatically accessible project metadata"""
|
||||
|
||||
|
||||
__title__ = "imagemuck"
|
||||
__title__ = "fresnel-lens"
|
||||
__version__ = "0.1.0"
|
||||
__authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||
__license__ = "MIT"
|
||||
__summary__ = "HTTP server for uploading images and generating thumbnails"
|
||||
__url__ = "https://github.com/mocproject/imagemuck/"
|
||||
__url__ = "https://github.com/enpaul/fresnel-lens/"
|
@ -1,12 +1,12 @@
|
||||
"""Development server stub entrypoint
|
||||
|
||||
Flask comes with a built-in development server. This entrypoint allows ``imagemuck``
|
||||
Flask comes with a built-in development server. This entrypoint allows ``fresnel_lens``
|
||||
to be run directly to run the development server and expose some simple config options for ease of
|
||||
access. Run the below command to start the server:
|
||||
|
||||
::
|
||||
|
||||
python -m imagemuck
|
||||
python -m fresnel_lens
|
||||
|
||||
In addition to the helpful CLI flags, the Flask development server run by this module will also
|
||||
load any ``.env`` files in the current working directory when running the application.
|
||||
@ -17,7 +17,7 @@ load any ``.env`` files in the current working directory when running the applic
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from imagemuck.application import APPLICATION
|
||||
from fresnel_lens.application import APPLICATION
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
@ -1,15 +1,16 @@
|
||||
import flask
|
||||
|
||||
from imagemuck import __about__
|
||||
from imagemuck import configuration
|
||||
from imagemuck import constants
|
||||
from imagemuck import database
|
||||
from imagemuck import exceptions
|
||||
from imagemuck.resources import ResponseHeaders
|
||||
from fresnel_lens import __about__
|
||||
from fresnel_lens import configuration
|
||||
from fresnel_lens import constants
|
||||
from fresnel_lens import database
|
||||
from fresnel_lens import exceptions
|
||||
from fresnel_lens.resources import ResponseHeaders
|
||||
|
||||
|
||||
def make_the_tea() -> None:
|
||||
"""Just for fun
|
||||
|
||||
https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol
|
||||
"""
|
||||
if flask.request.content_type == "message/coffeepot":
|
||||
@ -23,7 +24,7 @@ def initialize_database() -> None:
|
||||
database.initialize(flask.current_app.appconfig)
|
||||
|
||||
|
||||
class ImageMuckRequest(flask.Request):
|
||||
class FresnelRequest(flask.Request):
|
||||
"""Extend the default Flask request object to add custom application state settings"""
|
||||
|
||||
def make_response_headers(self) -> ResponseHeaders:
|
||||
@ -46,8 +47,8 @@ class ImageMuckFlask(flask.Flask):
|
||||
There's probably an easier/more kosher way to do this, but ¯\\_(ツ)_/¯
|
||||
"""
|
||||
|
||||
request_class = ImageMuckRequest
|
||||
request_class = FresnelRequest
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.appconfig: configuration.ImageMuckConfig = configuration.load()
|
||||
self.appconfig: configuration.FresnelConfig = configuration.load()
|
@ -1,9 +1,9 @@
|
||||
import flask_restful
|
||||
|
||||
from imagemuck import resources
|
||||
from imagemuck._server import ImageMuckFlask
|
||||
from imagemuck._server import initialize_database
|
||||
from imagemuck._server import make_the_tea
|
||||
from fresnel_lens import resources
|
||||
from fresnel_lens._server import ImageMuckFlask
|
||||
from fresnel_lens._server import initialize_database
|
||||
from fresnel_lens._server import make_the_tea
|
||||
|
||||
|
||||
APPLICATION = ImageMuckFlask(__name__)
|
@ -1,3 +1,5 @@
|
||||
import datetime
|
||||
import enum
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
@ -5,10 +7,20 @@ from dataclasses import field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import NamedTuple
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
from typing import Tuple
|
||||
|
||||
from imagemuck import constants
|
||||
import peewee
|
||||
|
||||
from fresnel_lens import constants
|
||||
|
||||
|
||||
class DimensionConfig(NamedTuple):
|
||||
strategy: constants.DimensionStrategy
|
||||
anchor: constants.Anchor
|
||||
value: int
|
||||
|
||||
|
||||
def _default_sqlite_pragmas() -> Dict[str, Any]:
|
||||
@ -31,7 +43,7 @@ def _default_sqlite_pragmas() -> Dict[str, Any]:
|
||||
|
||||
@dataclass
|
||||
class _DBSqliteConfig:
|
||||
path: Path = Path.cwd() / "imagemuck.db"
|
||||
path: Path = Path.cwd() / "fresnel_lens.db"
|
||||
pragmas: Dict[str, Any] = field(default_factory=_default_sqlite_pragmas)
|
||||
|
||||
@classmethod
|
||||
@ -51,7 +63,7 @@ class _DBMariaConfig:
|
||||
username: str = "root"
|
||||
password: Optional[str] = None
|
||||
port: int = 3306
|
||||
schema: str = "imagemuck"
|
||||
schema: str = "fresnel_lens"
|
||||
|
||||
@classmethod
|
||||
def build(cls):
|
||||
@ -67,52 +79,40 @@ class _DBMariaConfig:
|
||||
@dataclass
|
||||
class _DBConfig:
|
||||
|
||||
backend: constants.SupportedDatabaseBackend = (
|
||||
constants.SupportedDatabaseBackend.SQLITE
|
||||
)
|
||||
backend: constants.DatabaseBackend = constants.DatabaseBackend.SQLITE
|
||||
sqlite: _DBSqliteConfig = field(default_factory=_DBSqliteConfig.build)
|
||||
mariadb: _DBMariaConfig = field(default_factory=_DBMariaConfig.build)
|
||||
|
||||
@classmethod
|
||||
def build(cls):
|
||||
return cls(
|
||||
backend=constants.SupportedDatabaseBackend[
|
||||
os.environ[constants.ENV_CONF_DB_BACKEND]
|
||||
]
|
||||
backend=constants.DatabaseBackend[os.environ[constants.ENV_CONF_DB_BACKEND]]
|
||||
if constants.ENV_CONF_DB_BACKEND in os.environ
|
||||
else cls.backend
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class _UploadConfig:
|
||||
|
||||
size_limit: int = 1 * 1024 * 1024
|
||||
formats: Tuple[str] = ("jpg", "jpeg")
|
||||
|
||||
@classmethod
|
||||
def build(cls):
|
||||
return cls(
|
||||
size_limit=(int(os.environ[constants.ENV_CONF_FS_UPLOAD_MAX_SIZE]) * 1024)
|
||||
if constants.ENV_CONF_FS_UPLOAD_MAX_SIZE in os.environ
|
||||
else cls.size_limit,
|
||||
formats=(
|
||||
item.strip().lower()
|
||||
for item in os.environ[constants.ENV_CONF_FS_UPLOAD_FORMATS].split(",")
|
||||
)
|
||||
if constants.ENV_CONF_FS_UPLOAD_MAX_SIZE in os.environ
|
||||
else cls.formats,
|
||||
)
|
||||
class ManipConfig:
|
||||
alias: str
|
||||
formats: Sequence[constants.ImageFormat] = (
|
||||
constants.ImageFormat.JPEG,
|
||||
constants.ImageFormat.PNG,
|
||||
)
|
||||
horizontal: None
|
||||
vertical: None
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageMuckConfig:
|
||||
database: _DBConfig = field(default_factory=_DBConfig.build)
|
||||
upload: _UploadConfig = field(default_factory=_UploadConfig.build)
|
||||
storage_path: Path = Path.cwd()
|
||||
images: Path = Path.cwd() / "images"
|
||||
cache_dir: Path = Path.cwd() / "cache"
|
||||
expose_source: bool = False
|
||||
manips: Sequence[ManipConfig] = ()
|
||||
|
||||
@classmethod
|
||||
def build(cls):
|
||||
def from_env(cls):
|
||||
return cls(
|
||||
storage_path=Path(
|
||||
os.getenv(constants.ENV_CONF_FS_STORAGE_PATH, cls.storage_path)
|
||||
@ -121,5 +121,4 @@ class ImageMuckConfig:
|
||||
|
||||
|
||||
def load() -> ImageMuckConfig:
|
||||
|
||||
return ImageMuckConfig.build()
|
||||
return ImageMuckConfig.from_env()
|
29
fresnel_lens/constants.py
Normal file
29
fresnel_lens/constants.py
Normal file
@ -0,0 +1,29 @@
|
||||
import enum
|
||||
|
||||
import peewee
|
||||
|
||||
|
||||
class DatabaseBackend(enum.Enum):
|
||||
MARIADB = peewee.MySQLDatabase
|
||||
SQLITE = peewee.SqliteDatabase
|
||||
|
||||
|
||||
class DimensionStrategy(enum.Enum):
|
||||
CROP = enum.auto()
|
||||
SCALE = enum.auto()
|
||||
RELATIVE = enum.auto()
|
||||
|
||||
|
||||
class ImageFormat(enum.Enum):
|
||||
JPEG = ("jpg", "jpeg")
|
||||
PNG = ("png",)
|
||||
GIF = ("gif",)
|
||||
|
||||
|
||||
class Anchor(enum.Enum):
|
||||
C = "center"
|
||||
|
||||
|
||||
HTTP_HEADER_RESPONSE_VERSION = "x-fresnel_lens-version"
|
||||
|
||||
HTTP_HEADER_RESPONSE_DIGEST = "Digest"
|
@ -3,18 +3,18 @@ from typing import Tuple
|
||||
|
||||
import peewee
|
||||
|
||||
from imagemuck import constants
|
||||
from imagemuck.configuration import ImageMuckConfig
|
||||
from imagemuck.database._shared import ImageMuckModel
|
||||
from imagemuck.database._shared import INTERFACE as interface
|
||||
from imagemuck.database.image import ImageRecord
|
||||
from imagemuck.database.thumbnail import ThumbnailRecord
|
||||
from fresnel_lens import constants
|
||||
from fresnel_lens.configuration import FresnelConfig
|
||||
from fresnel_lens.database._shared import FresnelModel
|
||||
from fresnel_lens.database._shared import INTERFACE as interface
|
||||
from fresnel_lens.database.image import ImageRecord
|
||||
from fresnel_lens.database.thumbnail import ThumbnailRecord
|
||||
|
||||
|
||||
MODELS: Tuple[ImageMuckModel, ...] = (ImageRecord, ThumbnailRecord)
|
||||
MODELS: Tuple[FresnelModel, ...] = (ImageRecord, ThumbnailRecord)
|
||||
|
||||
|
||||
def initialize(config: ImageMuckConfig):
|
||||
def initialize(config: FresnelConfig):
|
||||
"""Initialize the database interface
|
||||
|
||||
Defining the database as an
|
@ -7,7 +7,7 @@ import peewee
|
||||
INTERFACE = peewee.DatabaseProxy()
|
||||
|
||||
|
||||
class ImageMuckModel(peewee.Model):
|
||||
class FresnelModel(peewee.Model):
|
||||
class Meta: # pylint: disable=too-few-public-methods,missing-class-docstring
|
||||
database = INTERFACE
|
||||
|
@ -4,10 +4,10 @@ from typing import List
|
||||
|
||||
import peewee
|
||||
|
||||
from imagemuck.database._shared import ImageMuckModel
|
||||
from fresnel_lens.database._shared import FresnelModel
|
||||
|
||||
|
||||
class ImageRecord(ImageMuckModel):
|
||||
class ImageRecord(FresnelModel):
|
||||
"""Database record for"""
|
||||
|
||||
width = peewee.IntegerField(null=False)
|
@ -1,10 +1,10 @@
|
||||
import peewee
|
||||
|
||||
from imagemuck.database._shared import ImageMuckModel
|
||||
from imagemuck.database.image import ImageRecord
|
||||
from fresnel_lens.database._shared import FresnelModel
|
||||
from fresnel_lens.database.image import ImageRecord
|
||||
|
||||
|
||||
class ThumbnailRecord(ImageMuckModel):
|
||||
class ThumbnailRecord(FresnelModel):
|
||||
|
||||
parent = peewee.ForeignKeyField(ImageRecord)
|
||||
width = peewee.IntegerField(null=False)
|
@ -2,13 +2,13 @@
|
||||
|
||||
::
|
||||
|
||||
ImageMuckException
|
||||
FresnelException
|
||||
+-- ClientError
|
||||
+-- ServerError
|
||||
"""
|
||||
|
||||
|
||||
class ImageMuckException(Exception):
|
||||
class FresnelException(Exception):
|
||||
"""Whomp whomp, something went wrong
|
||||
|
||||
But seriously, don't ever raise this exception
|
||||
@ -17,7 +17,7 @@ class ImageMuckException(Exception):
|
||||
status: int
|
||||
|
||||
|
||||
class ClientError(ImageMuckException):
|
||||
class ClientError(FresnelException):
|
||||
"""Error while processing client side input"""
|
||||
|
||||
status = 400
|
||||
@ -29,7 +29,7 @@ class ImageResourceDeletedError(ClientError):
|
||||
status = 410
|
||||
|
||||
|
||||
class ServerError(ImageMuckException):
|
||||
class ServerError(FresnelException):
|
||||
"""Error while processing server side data"""
|
||||
|
||||
status = 500
|
19
fresnel_lens/resources/__init__.py
Normal file
19
fresnel_lens/resources/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
from typing import Tuple
|
||||
|
||||
from fresnel_lens.resources._shared import FresnelResource
|
||||
from fresnel_lens.resources._shared import ResponseBody
|
||||
from fresnel_lens.resources._shared import ResponseHeaders
|
||||
from fresnel_lens.resources.image import Image
|
||||
from fresnel_lens.resources.image import ImageUpload
|
||||
from fresnel_lens.resources.openapi import OpenAPI
|
||||
from fresnel_lens.resources.thumbnail import ThumbnailResize
|
||||
from fresnel_lens.resources.thumbnail import ThumbnailScale
|
||||
|
||||
|
||||
RESOURCES: Tuple[FresnelResource, ...] = (
|
||||
ImageUpload,
|
||||
Image,
|
||||
OpenAPI,
|
||||
ThumbnailScale,
|
||||
ThumbnailResize,
|
||||
)
|
@ -31,7 +31,7 @@ class ResponseTuple(NamedTuple):
|
||||
headers: ResponseHeaders
|
||||
|
||||
|
||||
class ImageMuckResource(flask_restful.Resource):
|
||||
class FresnelResource(flask_restful.Resource):
|
||||
"""Extension of the default :class:`flask_restful.Resource` class
|
||||
|
||||
Add a couple of useful things to the default resource class:
|
@ -4,13 +4,13 @@ import uuid
|
||||
|
||||
import flask
|
||||
|
||||
from imagemuck import constants
|
||||
from imagemuck import database
|
||||
from imagemuck import exceptions
|
||||
from imagemuck.resources._shared import ImageMuckResource
|
||||
from fresnel_lens import constants
|
||||
from fresnel_lens import database
|
||||
from fresnel_lens import exceptions
|
||||
from fresnel_lens.resources._shared import FresnelResource
|
||||
|
||||
|
||||
class ImageUpload(ImageMuckResource):
|
||||
class ImageUpload(FresnelResource):
|
||||
|
||||
routes = ("/image/",)
|
||||
|
||||
@ -45,7 +45,7 @@ class ImageUpload(ImageMuckResource):
|
||||
return None, 201
|
||||
|
||||
|
||||
class Image(ImageMuckResource):
|
||||
class Image(FresnelResource):
|
||||
|
||||
routes = ("/image/<string:image_id>.jpeg",)
|
||||
|
@ -2,12 +2,12 @@ from pathlib import Path
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from imagemuck.resources._shared import ImageMuckResource
|
||||
from fresnel_lens.resources._shared import FresnelResource
|
||||
|
||||
yaml = YAML(typ="safe")
|
||||
|
||||
|
||||
class OpenAPI(ImageMuckResource):
|
||||
class OpenAPI(FresnelResource):
|
||||
|
||||
routes = ("/openapi.json",)
|
||||
|
@ -1,7 +1,7 @@
|
||||
from imagemuck.resources._shared import ImageMuckResource
|
||||
from fresnel_lens.resources._shared import FresnelResource
|
||||
|
||||
|
||||
class ThumbnailScale(ImageMuckResource):
|
||||
class ThumbnailScale(FresnelResource):
|
||||
|
||||
routes = ("/thumb/<string:image_id>/scale/<int:scale_width>.jpg",)
|
||||
|
||||
@ -9,7 +9,7 @@ class ThumbnailScale(ImageMuckResource):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class ThumbnailResize(ImageMuckResource):
|
||||
class ThumbnailResize(FresnelResource):
|
||||
|
||||
routes = ("/thumb/<string:image_id>/size/<int:width>x<int:height>.jpg",)
|
||||
|
@ -1,34 +0,0 @@
|
||||
import enum
|
||||
|
||||
|
||||
class SupportedDatabaseBackend(enum.Enum):
|
||||
|
||||
MARIADB = enum.auto()
|
||||
SQLITE = enum.auto()
|
||||
|
||||
|
||||
HTTP_HEADER_RESPONSE_VERSION = "x-imagemuck-version"
|
||||
|
||||
HTTP_HEADER_RESPONSE_DIGEST = "Digest"
|
||||
|
||||
ENV_CONF_DB_BACKEND = "IMGMONK_DATABASE_BACKEND"
|
||||
|
||||
ENV_CONF_DB_SQLITE_PATH = "IMGMONK_SQLITE_PATH"
|
||||
|
||||
ENV_CONF_DB_SQLITE_PRAGMAS = "IMGMONK_SQLITE_PRAGMAS"
|
||||
|
||||
ENV_CONF_DB_MARIA_HOSTNAME = "IMGMONK_MARIA_HOSTNAME"
|
||||
|
||||
ENV_CONF_DB_MARIA_USERNAME = "IMGMONK_MARIA_USERNAME"
|
||||
|
||||
ENV_CONF_DB_MARIA_PASSWORD = "IMGMONK_MARIA_PASSWORD"
|
||||
|
||||
ENV_CONF_DB_MARIA_PORT = "IMGMONK_MARIA_PORT"
|
||||
|
||||
ENV_CONF_DB_MARIA_SCHEMA = "IMGMONK_MARIA_SCHEMA"
|
||||
|
||||
ENV_CONF_FS_STORAGE_PATH = "IMGMONK_STORAGE_PATH"
|
||||
|
||||
ENV_CONF_FS_UPLOAD_MAX_SIZE = "IMGMONK_UPLOAD_LIMIT"
|
||||
|
||||
ENV_CONF_FS_UPLOAD_FORMATS = "IMGMONK_UPLOAD_FORMATS"
|
@ -1,19 +0,0 @@
|
||||
from typing import Tuple
|
||||
|
||||
from imagemuck.resources._shared import ImageMuckResource
|
||||
from imagemuck.resources._shared import ResponseBody
|
||||
from imagemuck.resources._shared import ResponseHeaders
|
||||
from imagemuck.resources.image import Image
|
||||
from imagemuck.resources.image import ImageUpload
|
||||
from imagemuck.resources.openapi import OpenAPI
|
||||
from imagemuck.resources.thumbnail import ThumbnailResize
|
||||
from imagemuck.resources.thumbnail import ThumbnailScale
|
||||
|
||||
|
||||
RESOURCES: Tuple[ImageMuckResource, ...] = (
|
||||
ImageUpload,
|
||||
Image,
|
||||
OpenAPI,
|
||||
ThumbnailScale,
|
||||
ThumbnailResize,
|
||||
)
|
@ -2,7 +2,7 @@
|
||||
openapi: "3.0.2"
|
||||
info:
|
||||
version: 0.1.0
|
||||
title: ImageMuck
|
||||
title: Fresnel Lens
|
||||
description: >-
|
||||
A simple HTTP service for mucking about with images. This is a super basic HTTP
|
||||
service for autogenerating website-ready banner and preview images from full-size
|
||||
@ -198,10 +198,10 @@ components:
|
||||
data: {}
|
||||
headers:
|
||||
Version:
|
||||
description: ImageMuck server application version
|
||||
description: Application name and version
|
||||
schema:
|
||||
type: string
|
||||
example: imagemuck-1.0.0
|
||||
example: fresnel-lens-1.0.0
|
||||
Allowed:
|
||||
description: Comma delimited list of valid HTTP verbs
|
||||
schema:
|
||||
|
@ -1,17 +1,17 @@
|
||||
[tool.poetry]
|
||||
name = "imagemuck"
|
||||
name = "fresnel-lens"
|
||||
version = "0.1.0"
|
||||
license = "MIT"
|
||||
authors = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
|
||||
description = "HTTP server for uploading images and generating thumbnails"
|
||||
repository = "https://github.com/mocproject/imagemuck/"
|
||||
repository = "https://github.com/enpaul/fresnel-lens/"
|
||||
packages = [
|
||||
{include = "imagemuck"},
|
||||
{include = "fresnel_lens"},
|
||||
{include = "tests", format = "sdist"}
|
||||
]
|
||||
include = [
|
||||
"imagemuck/py.typed",
|
||||
"imagemuck/openapi.yaml"
|
||||
"fresnel_lens/py.typed",
|
||||
"fresnel_lens/openapi.yaml"
|
||||
]
|
||||
keywords = ["flask", "image", "thumbnail", "hosting"]
|
||||
readme = "README.md"
|
||||
|
@ -3,7 +3,7 @@ from pathlib import Path
|
||||
|
||||
import toml
|
||||
|
||||
from imagemuck import __about__
|
||||
from fresnel_lens import __about__
|
||||
|
||||
|
||||
def test_about():
|
||||
|
@ -3,7 +3,7 @@ import importlib.resources
|
||||
import openapi_spec_validator
|
||||
import ruamel.yaml
|
||||
|
||||
from imagemuck import __about__
|
||||
from fresnel_lens import __about__
|
||||
|
||||
|
||||
yaml = ruamel.yaml.YAML(typ="safe") # pylint: disable=invalid-name
|
||||
@ -11,10 +11,10 @@ yaml = ruamel.yaml.YAML(typ="safe") # pylint: disable=invalid-name
|
||||
|
||||
def test_openapi():
|
||||
openapi_spec_validator.validate_spec(
|
||||
yaml.load(importlib.resources.read_text("imagemuck", "openapi.yaml"))
|
||||
yaml.load(importlib.resources.read_text("fresnel_lens", "openapi.yaml"))
|
||||
)
|
||||
|
||||
|
||||
def test_openapi_version():
|
||||
spec = yaml.load(importlib.resources.read_text("imagemuck", "openapi.yaml"))
|
||||
spec = yaml.load(importlib.resources.read_text("fresnel_lens", "openapi.yaml"))
|
||||
assert spec["info"]["version"] == __about__.__version__
|
||||
|
10
tox.ini
10
tox.ini
@ -19,7 +19,7 @@ locked_deps =
|
||||
ruamel.yaml
|
||||
toml
|
||||
commands =
|
||||
pytest --cov={envsitepackagesdir}/imagemuck --cov-config {toxinidir}/.coveragerc --cov-report term-missing {toxinidir}/tests/
|
||||
pytest --cov={envsitepackagesdir}/fresnel_lens --cov-config {toxinidir}/.coveragerc --cov-report term-missing {toxinidir}/tests/
|
||||
|
||||
[testenv:static]
|
||||
description = Static formatting and quality enforcement
|
||||
@ -38,8 +38,8 @@ locked_deps =
|
||||
pylint
|
||||
commands =
|
||||
pre-commit run --all-files
|
||||
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/imagemuck/
|
||||
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/imagemuck/
|
||||
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/fresnel_lens/
|
||||
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/fresnel_lens/
|
||||
|
||||
[testenv:static-tests]
|
||||
description = Static formatting and quality enforcement for the tests
|
||||
@ -63,7 +63,7 @@ locked_deps =
|
||||
safety
|
||||
poetry
|
||||
commands =
|
||||
bandit --recursive --quiet {toxinidir}/imagemuck/
|
||||
bandit --recursive --quiet {toxinidir}/fresnel_lens/
|
||||
bandit --recursive --quiet --skip B101 {toxinidir}/tests/
|
||||
poetry export --format requirements.txt --output {envtmpdir}/requirements.txt --without-hashes --dev
|
||||
safety check --bare --file {envtmpdir}/requirements.txt
|
||||
@ -75,5 +75,5 @@ locked_deps =
|
||||
sphinx
|
||||
sphinx-autodoc-typehints
|
||||
commands =
|
||||
sphinx-apidoc --no-toc --output-dir {toxinidir}/docs/ {toxinidir}/imagemuck/
|
||||
sphinx-apidoc --no-toc --output-dir {toxinidir}/docs/ {toxinidir}/fresnel_lens/
|
||||
sphinx-build -W -b html {toxinidir}/docs/ {toxinidir}/docs/_build
|
||||
|
Loading…
Reference in New Issue
Block a user