From 3386f09d2b8ac24218fcb71899d9ed16e926de1a Mon Sep 17 00:00:00 2001 From: Skylar Saveland Date: Sat, 26 Oct 2024 18:51:46 -0700 Subject: [PATCH] chore(core): some cleanup (and messing about) before the real fun starts (#3) * some cleanup before the real fun starts * add dev container readme * .. * still futzing * add CODEOWNERS * .. * update TODO --- .devcontainer/Dockerfile | 7 ++++++- .devcontainer/README.md | 21 +++++++++++++++++++++ .devcontainer/docker-compose.yaml | 7 ++----- .devcontainer/entrypoint.sh | 3 +-- .devcontainer/setup.sh | 4 +++- .github/README.md | 5 ----- CODEOWNERS | 1 + README.md | 2 +- TODO.md | 11 +++++++---- 9 files changed, 42 insertions(+), 19 deletions(-) delete mode 100644 .github/README.md create mode 100644 CODEOWNERS diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 77d9f81..9e2192b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ FROM mcr.microsoft.com/devcontainers/python:3.12 -# Install PostgreSQL client and Zsh +# Install PostgreSQL client and zsh RUN apt-get update && apt-get install -y \ postgresql-client zsh && \ apt-get clean && rm -rf /var/lib/apt/lists/* @@ -9,3 +9,8 @@ RUN apt-get update && apt-get install -y \ WORKDIR /workspace COPY py/ /workspace/py/ RUN pip install -r /workspace/py/requirements.txt + +RUN chsh -s /bin/zsh vscode + +# Run zsh as the main process in interactive mode +CMD ["sleep", "infinity"] diff --git a/.devcontainer/README.md b/.devcontainer/README.md index e69de29..4a2ad34 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -0,0 +1,21 @@ +# Corpora DevContainer + +This DevContainer setup provides a ready-to-use development environment with Docker Compose, Python 3.12, PostgreSQL, and zsh. + +## Features +- **Python 3.12** with dependencies installed from `requirements.txt` +- **PostgreSQL** service with environment variables for connection configuration +- **Zsh** shell with custom history and useful aliases +- **VS Code Customizations** for Python linting, formatting, and Docker integration + +## Usage +1. **Open in VS Code:** Open this folder in VS Code, ensuring Docker is running. +2. **Build & Connect:** The DevContainer will automatically build and connect to VS Code. +3. **Run Commands:** Post-create setup (`setup.sh`) installs Zsh customizations. + +## Ports +- **App:** 8000 +- **Database:** 5432 + +## Notes +- zsh customizations and Git configuration are persisted across sessions. diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index 2b31404..178003b 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -10,15 +10,12 @@ services: environment: DATABASE_URL: "postgres://postgres:postgres@db:5432/postgres" PYTHONPATH: "/workspace/py/packages" - # Set CI to true in the environment or default to false - CI: ${CI:-false} depends_on: - db ports: - "8000:8000" - # command: sleep infinity - # shell: /bin/zsh - entrypoint: "./.devcontainer/entrypoint.sh" + # runs CMD from Dockerfile right now + # entrypoint: "./.devcontainer/entrypoint.sh" db: image: postgres:17 diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index cfbae76..8480cf6 100755 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -1,4 +1,3 @@ #!/bin/bash -git config --global --add safe.directory /workspace -sleep infinity +# sleep infinity diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 51cf5b7..15d416d 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,6 +1,8 @@ #!/bin/bash -echo "starting zsh..." +# random stuff ... hrm ... +# echo "starting zsh..." echo 'autoload -Uz add-zsh-hook; append_history() { fc -W }; add-zsh-hook precmd append_history; export HISTFILE=/home/vscode/.corpora.zsh_history/.zsh_history' >> ~/.zshrc alias tree="tree -I '.venv|node_modules|__pycache__|.git|.pytest_cache' -a" +# git config --global --add safe.directory /workspace zsh diff --git a/.github/README.md b/.github/README.md deleted file mode 100644 index 3ee2f7b..0000000 --- a/.github/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# GitHub Configuration - -GitHub-specific configurations and resources for the repository. - -- [**workflows/**](workflows/README.md): GitHub Actions workflows. diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..ff39668 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @skyl diff --git a/README.md b/README.md index 9512468..9148a3f 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ A corpus of tools to enhance and evolve arbitrary corpora. - [**py/**](py/README.md): Python codebase. - [**md/**](md/README.md): Documentation and setup instructions. - [**.devcontainer/**](.devcontainer/README.md): Development container configuration. -- [**.github/**](.github/README.md): GitHub-specific workflows and configurations. +- [**.github/**](.github/workflows/README.md): GitHub-specific workflows. diff --git a/TODO.md b/TODO.md index a4e0e15..8bb5da7 100644 --- a/TODO.md +++ b/TODO.md @@ -1,13 +1,12 @@ # TODO -- add pr-agent? -- .devcontainer/README.md +- Model Files / Splits - how to interface as customer? Internal should be same? + - CLI, API, is there a way to talk to DB directly? LFG # Next -- main branch protection -- Model Files / Splits - how to interface as customer? Internal should be same? - consider ruff +- pr-agent only on comments? - SaaS versus internal, dogfood # Done @@ -21,3 +20,7 @@ - Same devcontainer works for both? no, maybe later, still early - choose python linting tool (black) - testproj README, all READMEs at all levels +- add pr-agent? +- .devcontainer/README.md +- main branch protection +