Compare commits

..

2 Commits

Author SHA1 Message Date
54327432fa rename to execlib, update package details 2024-05-14 22:05:02 -07:00
e7b97e8b8c update pyproject.toml 2024-05-14 20:01:06 -07:00
29 changed files with 117 additions and 85 deletions

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2024 Sam Griesemer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,5 +1,5 @@
# Overview # Overview
`execlog` is a lightweight multi-threaded job framework written in Python. It implements a `execlib` is a lightweight multi-threaded job framework written in Python. It implements a
simple event-based model over core Python utilities like `ThreadPoolExecutor` to simple event-based model over core Python utilities like `ThreadPoolExecutor` to
facilitate reactivity and manage concurrent responses. facilitate reactivity and manage concurrent responses.

View File

@ -6,7 +6,7 @@
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'execlog' project = 'execlib'
copyright = '2024, Sam Griesemer' copyright = '2024, Sam Griesemer'
author = 'Sam Griesemer' author = 'Sam Griesemer'

View File

@ -1,4 +1,4 @@
# `execlog` package docs # `execlib` package docs
{ref}`genindex` {ref}`genindex`
{ref}`modindex` {ref}`modindex`
{ref}`search` {ref}`search`
@ -10,18 +10,18 @@
:nosignatures: :nosignatures:
:recursive: :recursive:
execlog.Handler execlib.Handler
execlog.Listener execlib.Listener
execlog.Router execlib.Router
execlog.Server execlib.Server
execlog.listeners execlib.listeners
``` ```
## Auto-reference contents ## Auto-reference contents
```{toctree} ```{toctree}
:maxdepth: 3 :maxdepth: 3
_autoref/execlog.rst _autoref/execlib.rst
``` ```
```{toctree} ```{toctree}

10
execlib/__init__.py Normal file
View File

@ -0,0 +1,10 @@
from execlib import util
from execlib import routers
from execlib import syncers
from execlib import listeners
from execlib.server import Server
from execlib.handler import Handler
from execlib.listener import Listener
from execlib.event import Event, FileEvent
from execlib.router import Router, ChainRouter, Event, RouterBuilder, route

View File

@ -5,7 +5,7 @@ See also:
''' '''
import threading import threading
from execlog.event import Event from execlib.event import Event
class Listener[E: Event](threading.Thread): class Listener[E: Event](threading.Thread):

View File

@ -0,0 +1 @@
from execlib.listeners.path import PathListener

View File

@ -8,10 +8,10 @@ from collections import defaultdict
from colorama import Fore, Back, Style from colorama import Fore, Back, Style
from inotify_simple import INotify, Event as iEvent, flags as iflags, masks as imasks from inotify_simple import INotify, Event as iEvent, flags as iflags, masks as imasks
from execlog import util from execlib import util
from execlog.util.generic import color_text from execlib.util.generic import color_text
from execlog.event import FileEvent from execlib.event import FileEvent
from execlog.listener import Listener from execlib.listener import Listener
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -18,9 +18,9 @@ from concurrent.futures import ThreadPoolExecutor, wait, as_completed
from tqdm.auto import tqdm from tqdm.auto import tqdm
from execlog.event import Event from execlib.event import Event
from execlog.listener import Listener from execlib.listener import Listener
from execlog.util.generic import color_text, get_func_name from execlib.util.generic import color_text, get_func_name
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -0,0 +1 @@
from execlib.routers.path import PathRouter

View File

@ -2,10 +2,10 @@ import logging
from pathlib import Path from pathlib import Path
from typing import Callable from typing import Callable
from execlog.router import Router from execlib.router import Router
from execlog.event import FileEvent from execlib.event import FileEvent
from execlog.util.path import glob_match from execlib.util.path import glob_match
from execlog.listeners.path import PathListener from execlib.listeners.path import PathListener
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -26,8 +26,8 @@ from inotify_simple import flags
from fastapi import FastAPI, WebSocket from fastapi import FastAPI, WebSocket
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from execlog.routers.path import PathRouter from execlib.routers.path import PathRouter
from execlog.handler import Handler as LREndpoint from execlib.handler import Handler as LREndpoint
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -0,0 +1 @@
from execlib.syncers.router import PathDiffer, PathRouterSyncer

View File

@ -10,10 +10,10 @@ from inotify_simple import flags as iflags
from co3.resources import DiskResource from co3.resources import DiskResource
from co3 import Differ, Syncer, Database from co3 import Differ, Syncer, Database
from execlog.event import Event from execlib.event import Event
from execlog.router import CancelledFrameError from execlib.router import CancelledFrameError
from execlog.routers import PathRouter from execlib.routers import PathRouter
from execlog.util.generic import color_text from execlib.util.generic import color_text
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

2
execlib/util/__init__.py Normal file
View File

@ -0,0 +1,2 @@
from execlib.util import path
from execlib.util import generic

View File

@ -46,8 +46,8 @@ class ColorFormatter(logging.Formatter):
formatter = self.FORMATS[submodule] formatter = self.FORMATS[submodule]
name = record.name name = record.name
if package == 'execlog': if package == 'execlib':
name = f'execlog.{subsubmodule}' name = f'execlib.{subsubmodule}'
limit = 26 limit = 26
name = name[:limit] name = name[:limit]

View File

@ -1,10 +0,0 @@
from execlog import util
from execlog import routers
from execlog import syncers
from execlog import listeners
from execlog.server import Server
from execlog.handler import Handler
from execlog.listener import Listener
from execlog.event import Event, FileEvent
from execlog.router import Router, ChainRouter, Event, RouterBuilder, route

View File

@ -1 +0,0 @@
from execlog.listeners.path import PathListener

View File

@ -1 +0,0 @@
from execlog.routers.path import PathRouter

View File

@ -1 +0,0 @@
from execlog.syncers.router import PathDiffer, PathRouterSyncer

View File

@ -1,2 +0,0 @@
from execlog.util import path
from execlog.util import generic

View File

@ -1,25 +1,56 @@
[build-system] [build-system]
requires = ["setuptools"] requires = ["setuptools", "wheel", "setuptools-git-versioning>=2.0,<3"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
# populates dynamically set version with latest git tag
[tool.setuptools-git-versioning]
enabled = true
[project] [project]
name = "execlog" name = "execlib"
version = "0.4.1"
authors = [
{ name="Sam Griesemer", email="samgriesemer@gmail.com" },
]
description = "Lightweight multi-threaded job framework" description = "Lightweight multi-threaded job framework"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
dynamic = ["version"]
#license = {file = "LICENSE"}
authors = [
{ name="Sam Griesemer", email="samgriesemer+git@gmail.com" },
]
keywords = ["concurrent", "async", "inotify"]
classifiers = [ classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
] ]
dependencies = [ dependencies = [
"tqdm" "tqdm",
"wcmatch",
"uvicorn",
"fastapi",
"colorama",
"starlette",
"inotify_simple",
] ]
[tool.setuptools.packages.find] [project.optional-dependencies]
include = ["execlog*"] # pattern to match package names tests = ["pytest", "websockets"]
docs = [
"sphinx",
"sphinx-togglebutton",
"sphinx-autodoc-typehints",
"furo",
"myst-parser",
]
[project.urls]
Homepage = "https://doc.olog.io/execlib"
Documentation = "https://doc.olog.io/execlib"
Repository = "https://git.olog.io/olog/execlib"
Issues = "https://git.olog.io/olog/execlib/issues"
[tool.setuptools.packages.find]
include = ["execlib*"] # pattern to match package names

View File

@ -1,21 +0,0 @@
# -- package-specific --
fastapi
starlette
uvicorn
inotify_simple
tqdm
wcmatch
websockets
# -- logging --
colorama
# -- sphinx docs --
sphinx
sphinx-togglebutton
furo
myst-parser
sphinx-autodoc-typehints
# -- testing ---
pytest

View File

@ -3,10 +3,10 @@ import logging
from pathlib import Path from pathlib import Path
from functools import partial from functools import partial
from execlog import util from execlib import util
from execlog import ChainRouter, Event from execlib import ChainRouter, Event
from execlog.routers import PathRouter from execlib.routers import PathRouter
from execlog.listeners import PathListener from execlib.listeners import PathListener
logger = logging.getLogger() logger = logging.getLogger()

View File

@ -3,10 +3,10 @@ from pathlib import Path
from functools import partial from functools import partial
from concurrent.futures import wait from concurrent.futures import wait
from execlog import util from execlib import util
from execlog import ChainRouter, Event from execlib import ChainRouter, Event
from execlog.routers import PathRouter from execlib.routers import PathRouter
from execlog.listeners import PathListener from execlib.listeners import PathListener
logger = logging.getLogger() logger = logging.getLogger()

View File

@ -4,8 +4,8 @@ import threading
import logging import logging
from pathlib import Path from pathlib import Path
from execlog import Server from execlib import Server
from execlog.routers import PathRouter from execlib.routers import PathRouter
logger = logging.getLogger() logger = logging.getLogger()