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
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git
.gitignore
.github
tests
docs
examples
dist
build
*.egg-info
__pycache__
*.pyc
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @buralux
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
pull_request:
push:
branches:
- main
- cursor/**

permissions:
contents: read

jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]

env:
DSM_MEMORY_DIR: ${{ runner.temp }}/memory

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev,web]"

- name: Run tests
run: python -m unittest discover -s tests -q

- name: Build package
run: python -m build

- name: Upload dist artifacts
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
48 changes: 48 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
env:
DSM_MEMORY_DIR: ${{ runner.temp }}/memory

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Ensure tag commit is on main
run: |
git fetch origin main --depth=1
git merge-base --is-ancestor "$GITHUB_SHA" origin/main

- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Build distributions
run: python -m build

- name: Check distributions
run: twine check dist/*

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project follows [Semantic Versioning](https://semver.org/).

## [0.4.0] - 2026-02-25

### Added

- Packaging with `pyproject.toml`.
- Console scripts: `daryl-memory` and `dsm-webui`.
- CI workflow (`.github/workflows/ci.yml`) with tests + build.
- Release workflow (`.github/workflows/release-pypi.yml`) for PyPI.
- Deployment assets: `Dockerfile`, `docker-compose.yml`, `.dockerignore`.
- Contribution and security docs: `CONTRIBUTING.md`, `SECURITY.md`.
- Developer tooling: `Makefile`, `.pre-commit-config.yaml`.

### Changed

- Runtime logs are quiet by default, with `--verbose` in CLI.
- Warnings/errors redirected to stderr.
- Runtime portability improvements around `DSM_MEMORY_DIR`.
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to DSM

Merci de contribuer au projet DSM.

## Pré-requis

- Python 3.10+
- `pip` récent
- `git`

## Setup local

```bash
git clone https://github.com/buralux/dsm.git
cd dsm
python3 -m pip install -e ".[dev,web]"
pre-commit install
```

## Workflow de contribution

1. Crée une branche depuis `main`.
2. Fais des commits petits et descriptifs.
3. Lance les vérifications locales:

```bash
make test
make build
make precommit
```

4. Ouvre une Pull Request avec:
- contexte,
- changements,
- impacts éventuels,
- stratégie de test.

## Standards attendus

- Code lisible et cohérent avec le style existant.
- Pas de secrets, clés API ou credentials dans le repo.
- Toute évolution significative doit être couverte par des tests.
- Mettre à jour la documentation si le comportement change.

## Versioning / release

- Le projet suit SemVer.
- Les entrées de version doivent être ajoutées dans `CHANGELOG.md`.
- La publication PyPI est déclenchée par tag `v*` via GitHub Actions.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1

WORKDIR /app

RUN adduser --disabled-password --gecos "" appuser

COPY pyproject.toml README.md LICENSE /app/
COPY src /app/src

RUN python -m pip install --upgrade pip && \
python -m pip install --no-cache-dir ".[web]"

ENV DSM_MEMORY_DIR=/data/memory \
DSM_WEB_HOST=0.0.0.0 \
DSM_WEB_PORT=8000

RUN mkdir -p /data/memory && chown -R appuser:appuser /app /data
USER appuser

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/stats', timeout=3)" || exit 1

CMD ["dsm-webui"]
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include README.md
include LICENSE
include CHANGELOG.md
recursive-include src/webui/templates *.html
recursive-include src/webui/static *.js *.css
recursive-include docs *.md
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PYTHON ?= python3
PIP ?= $(PYTHON) -m pip

.PHONY: install install-web install-dev test build clean run-cli run-web precommit docker-build docker-up docker-down

install:
$(PIP) install -e .

install-web:
$(PIP) install -e ".[web]"

install-dev:
$(PIP) install -e ".[dev,web]"

test:
$(PYTHON) -m unittest discover -s tests -q

build:
$(PIP) install --quiet build
$(PYTHON) -m build

precommit:
pre-commit run --all-files

run-cli:
$(PYTHON) -m cli.daryl_memory_cli status

run-web:
$(PYTHON) -m webui.app

docker-build:
docker build -t dsm:latest .

docker-up:
docker compose up --build

docker-down:
docker compose down

clean:
rm -rf build dist .pytest_cache *.egg-info
Loading