From 2a27949a06d6b51394ce487950db264ab8db6553 Mon Sep 17 00:00:00 2001 From: Campbell Alden Date: Thu, 30 Jul 2026 00:12:33 +0900 Subject: [PATCH] Initialize repo --- .envrc | 9 +++++++++ .gitignore | 5 +++++ README.md | 0 default.nix | 2 ++ derivation.nix | 10 ++++++++++ result | 1 + ruff.toml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 9 +++++++++ shell.nix | 21 +++++++++++++++++++++ src/main.py | 3 +++ 10 files changed, 109 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 README.md create mode 100644 default.nix create mode 100644 derivation.nix create mode 120000 result create mode 100644 ruff.toml create mode 100644 setup.py create mode 100644 shell.nix create mode 100644 src/main.py diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..82b2b9e --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# the shebang is ignored, but nice for editors + +if type -P lorri &>/dev/null; then + eval "$(lorri direnv)" +else + echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' + use nix +fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12a0ed5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pyc +__pycache__/* +.env +result +todo.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..248a611 --- /dev/null +++ b/default.nix @@ -0,0 +1,2 @@ +{ pkgs ? import {} }: +pkgs.callPackage ./derivation.nix {} diff --git a/derivation.nix b/derivation.nix new file mode 100644 index 0000000..803e327 --- /dev/null +++ b/derivation.nix @@ -0,0 +1,10 @@ +{ lib, python313Packages }: +with python313Packages; +buildPythonApplication { + pname = "cereal"; + version = "0.0.1"; + propagatedBuildInputs = [ flask requests waitress]; + src = ./.; + pyproject = true; + build-system = [setuptools]; +} diff --git a/result b/result new file mode 120000 index 0000000..c40330e --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/3sidag2a6iy1mdpn341ksvmzfk1wmlma-cereal-0.0.1 \ No newline at end of file diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..8996527 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,49 @@ +exclude = [ + ".direnv", + ".git", + ".git-rewrite", + ".ipynb_checkpoints", + ".mypy_cache", + ".pytest_cache", + ".pytype", + ".ruff_cache", + "__pypackages__", + "result" +] + +line-length = 120 +indent-width = 4 + +target-version = "py313" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +quote-style = "single" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto" +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..af47279 --- /dev/null +++ b/setup.py @@ -0,0 +1,9 @@ +from setuptools import setup, find_packages + +setup( + name='cereal', + verison='0.0.1', + packages=find_packages(), + include_package_data=True, + scripts=['./src/main.py'], +) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..80b3c0d --- /dev/null +++ b/shell.nix @@ -0,0 +1,21 @@ +{ pkgs ? import {}}: +let + mypy = pkgs.python313.withPackages (ps: with ps; [ + requests + flask + waitress + ]); +in +with pkgs; +mkShell { + buildInputs = [ + mypy + pylint + python313Packages.ipython + python313Packages.ruff + python313Packages.python-lsp-server + python313Packages.jedi-language-server + ty + ffmpeg + ]; +} diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..536cb12 --- /dev/null +++ b/src/main.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python + +print('hello, world!')