Compare commits

..

No commits in common. "54327432fae98957576fc42f1f80c81cc39ad656" and "61ff43722fa1b2377712be2888a44585c8df9cbf" have entirely different histories.

29 changed files with 84 additions and 116 deletions

22
LICENSE
View File

@ -1,22 +0,0 @@
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
`execlib` is a lightweight multi-threaded job framework written in Python. It implements a
`execlog` is a lightweight multi-threaded job framework written in Python. It implements a
simple event-based model over core Python utilities like `ThreadPoolExecutor` to
facilitate reactivity and manage concurrent responses.

View File

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

View File

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

View File

@ -1,10 +0,0 @@
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

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

View File

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

View File

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

View File

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

10
execlog/__init__.py Normal file
View File

@ -0,0 +1,10 @@
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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
from execlog.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 import Differ, Syncer, Database
from execlib.event import Event
from execlib.router import CancelledFrameError
from execlib.routers import PathRouter
from execlib.util.generic import color_text
from execlog.event import Event
from execlog.router import CancelledFrameError
from execlog.routers import PathRouter
from execlog.util.generic import color_text
logger = logging.getLogger(__name__)

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

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

View File

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

View File

@ -1,56 +1,25 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools-git-versioning>=2.0,<3"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
# populates dynamically set version with latest git tag
[tool.setuptools-git-versioning]
enabled = true
[project]
name = "execlib"
name = "execlog"
version = "0.4.1"
authors = [
{ name="Sam Griesemer", email="samgriesemer@gmail.com" },
]
description = "Lightweight multi-threaded job framework"
readme = "README.md"
requires-python = ">=3.12"
dynamic = ["version"]
#license = {file = "LICENSE"}
authors = [
{ name="Sam Griesemer", email="samgriesemer+git@gmail.com" },
]
keywords = ["concurrent", "async", "inotify"]
classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
]
dependencies = [
"tqdm",
"wcmatch",
"uvicorn",
"fastapi",
"colorama",
"starlette",
"inotify_simple",
"tqdm"
]
[project.optional-dependencies]
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
include = ["execlog*"] # pattern to match package names

21
requirements.txt Normal file
View File

@ -0,0 +1,21 @@
# -- 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 functools import partial
from execlib import util
from execlib import ChainRouter, Event
from execlib.routers import PathRouter
from execlib.listeners import PathListener
from execlog import util
from execlog import ChainRouter, Event
from execlog.routers import PathRouter
from execlog.listeners import PathListener
logger = logging.getLogger()

View File

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

View File

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