commit e7c41cd68e46d78fb79810e16ec2d833d6d67bff Author: omicron Date: Mon Jul 27 00:11:50 2026 +0200 Initial commit Initial structure with little functionality diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9c21c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/venv +__pycache__ +*.egg-info +*.pyc diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6de904b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) 2026 omicron + +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. diff --git a/omicron/ssg/__init__.py b/omicron/ssg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/omicron/ssg/cli.py b/omicron/ssg/cli.py new file mode 100644 index 0000000..cee1fcf --- /dev/null +++ b/omicron/ssg/cli.py @@ -0,0 +1,20 @@ +import logging +import sys +from omicron.ssg.site import Site +from pathlib import Path + + +def setup_logging(verbose: bool = False, log_file: str | None = None) -> None: + logger = logging.getLogger("omicron.ssg") + logger.setLevel(logging.DEBUG) + + console = logging.StreamHandler(sys.stderr) + console.setLevel(logging.DEBUG if verbose else logging.INFO) + console.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(console) + + +def main(): + setup_logging(verbose=True) + site = Site(Path(".")) + site.build() diff --git a/omicron/ssg/content.py b/omicron/ssg/content.py new file mode 100644 index 0000000..39ea6be --- /dev/null +++ b/omicron/ssg/content.py @@ -0,0 +1,8 @@ +import logging + +log = logging.getLogger(__name__) + + +class Content: + def __init__(self, path): + pass diff --git a/omicron/ssg/site.py b/omicron/ssg/site.py new file mode 100644 index 0000000..b4d7b2c --- /dev/null +++ b/omicron/ssg/site.py @@ -0,0 +1,35 @@ +import logging + +from omicron.ssg.content import Content +from pathlib import Path +import yaml + +log = logging.getLogger(__name__) + + +class Site: + def __init__(self, site: Path): + self.site_path = site.absolute() + self.content: list[Content] = [] + self.config: dict = {} + self.by_tag: dict[str, list[Content]] + self.by_uri: dict[str, Content] + self.read_config() + + def read_config(self) -> None: + config_path = self.site_path / "config.yml" + log.debug("Reading config file %s", config_path) + with open(config_path, "r") as f: + self.config = yaml.safe_load(f) + + def discover(self) -> None: + log.info("Discovering content...") + content_path = self.site_path / "content" + for file in content_path.rglob("*"): + if file.is_file(): + self.content.append(Content(file)) + log.info("Discovered %d content items", len(self.content)) + + def build(self): + self.discover() + pass diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e2c020e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "omicron-ssg" +version = "0.1.0" +requires-python = ">=3.11" +dependencies = [ + "Jinja2", + "markdown-it-py", + "Pygments", + "PyYAML", +] + +[project.scripts] +ossg = "omicron.ssg.cli:main" + +[tool.setuptools.packages.find] +where = ["."] +include = ["omicron.ssg*"]