Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
File renamed without changes.
53 changes: 0 additions & 53 deletions config.py

This file was deleted.

126 changes: 0 additions & 126 deletions main.py

This file was deleted.

27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "itter"
version = "0.1.0"
description = "Micro-Blogging via Terminal"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"asyncssh>=2.21.0",
"pydantic-settings>=2.9.1",
"python-dotenv>=1.1.0",
"supabase>=2.15.2",
"textwrap ; python_full_version < '3.9'",
"typer>=0.15.4",
"wcwidth>=0.2.13",
]

[dependency-groups]
dev = [
"pytest>=8.3.5",
]

[project.scripts]
itter = "itter.main:app"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

File renamed without changes.
Empty file added src/itter/__init__.py
Empty file.
1 change: 1 addition & 0 deletions command_history.py → src/itter/command_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

MAX_HISTORY_SIZE = 10


class CommandHistory:
def __init__(self):
self.history = deque(maxlen=MAX_HISTORY_SIZE)
Expand Down
21 changes: 21 additions & 0 deletions src/itter/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pydantic_settings import BaseSettings


# --- Environment Loading ---
class Config(BaseSettings):
"""Main config class."""

banner_file: str = "itter_banner.txt"
eet_max_length: int = 180
ssh_host_key_path: str = "./ssh_host_key"
min_timeline_page_size: int = 1
max_timeline_page_size: int = 30
default_timeline_page_size: int = 10
watch_refresh_interval_seconds: int = 15 # How often watch mode refreshes
itter_debug_mode: bool
supabase_url: str
supabase_key: str
supabase_wsurl: str
ssh_host: str = "0.0.0.0"
ssh_port: str = "8022"
ip_hash_salt: str
17 changes: 17 additions & 0 deletions src/itter/context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from contextvars import ContextVar
from pathlib import Path
from typing import Any

from dotenv import load_dotenv
from realtime import AsyncRealtimeClient
from supabase import Client

from itter.config import Config

_ = load_dotenv(Path(__file__).parent.parent.parent.joinpath(".env"))
config: Config = Config()
db_client_ctx: ContextVar[Client] = ContextVar("db_client_ctx")
rt_client_ctx: ContextVar[AsyncRealtimeClient] = ContextVar("rt_client_ctx")
active_sessions_ref_ctx: ContextVar[dict[str, Any]] = ContextVar(
"active_sessions_ref_ctx"
)
Loading