Skip to content

Commit

Permalink
chore(core): some cleanup (and messing about) before the real fun sta…
Browse files Browse the repository at this point in the history
…rts (#3)

* some cleanup before the real fun starts

* add dev container readme

* ..

* still futzing

* add CODEOWNERS

* ..

* update TODO
  • Loading branch information
skyl authored Oct 27, 2024
1 parent cde92f2 commit 3386f09
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand All @@ -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"]
21 changes: 21 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 2 additions & 5 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

git config --global --add safe.directory /workspace
sleep infinity
# sleep infinity
4 changes: 3 additions & 1 deletion .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions .github/README.md

This file was deleted.

1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @skyl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 7 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 3386f09

Please sign in to comment.