Skip to content
Merged
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
7 changes: 5 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"pre-commit": {
enabled: true,
},
poetry: {
pep621: {
fileMatch: ["pyproject.toml"],
},
uv: {
fileMatch: ["pyproject.toml"],
},
pip_requirements: {
Expand All @@ -31,7 +34,7 @@
},
packageRules: [
{
matchManagers: ["poetry", "pip_requirements"],
matchManagers: ["pep621", "uv", "pip_requirements"],
matchPackagePatterns: ["^pytest"],
groupName: "pytest packages",
groupSlug: "pytest",
Expand Down
27 changes: 8 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2

- name: Configure Poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- name: Cache dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
with:
path: ./.venv
key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-py${{ matrix.python-version }}-
enable-cache: true

- name: Install package
run: poetry install --all-extras
run: uv sync --all-extras --group dev

- name: Lint
run: poetry run ruff check --output-format=github dyana
run: uv run ruff check --output-format=github dyana

- name: Type check
run: poetry run mypy --ignore-missing-imports --no-error-summary dyana
run: uv run mypy --ignore-missing-imports --no-error-summary dyana

- name: Test
run: poetry run pytest dyana
run: uv run pytest dyana
15 changes: 6 additions & 9 deletions .github/workflows/docs-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,16 @@ jobs:
- name: Configure Pages
uses: actions/configure-pages@v5

- name: Install Poetry
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2

- name: Configure Poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
with:
enable-cache: true

- name: Install docs dependencies
run: poetry install --with docs
run: uv sync --group docs

- name: Build docs
run: poetry run mkdocs build --strict
run: uv run mkdocs build --strict

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ jobs:
with:
python-version: "3.14"

- name: Install Poetry
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2

- name: Configure Poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
with:
enable-cache: true

- name: Install docs dependencies
run: poetry install --with docs
run: uv sync --group docs

- name: Build docs
run: poetry run mkdocs build --strict
run: uv run mkdocs build --strict
29 changes: 14 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,36 @@ jobs:
with:
python-version: "3.14"

- name: Install Poetry
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
with:
poetry-version: "1.8.4"

- name: Configure Poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
enable-cache: true

- name: Install package
run: poetry install --no-dev
run: uv sync

- name: Validate version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
POETRY_VERSION=$(poetry version -s)
PROJECT_VERSION=$(python - <<'PY'
import tomllib
with open("pyproject.toml", "rb") as f:
print(tomllib.load(f)["project"]["version"])
PY
)

if ! [[ $TAG_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid tag format: $TAG_VERSION. Must be vX.X.X"
exit 1
fi
if [ "$TAG_VERSION" != "$POETRY_VERSION" ]; then
echo "Tag ($TAG_VERSION) doesn't match pyproject.toml ($POETRY_VERSION)"

if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
echo "Tag ($TAG_VERSION) doesn't match pyproject.toml ($PROJECT_VERSION)"
exit 1
fi

- name: Build package
run: |
poetry build
run: uv build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
16 changes: 5 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
FROM python:3.14-bookworm AS builder

RUN pip install poetry==1.8.3

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
COPY --from=ghcr.io/astral-sh/uv:0.8.19 /uv /uvx /bin/

WORKDIR /app

COPY pyproject.toml poetry.lock README.md ./
COPY pyproject.toml uv.lock README.md ./

RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
RUN uv sync --locked --no-dev --no-install-project

FROM python:3.14-slim-bookworm AS runtime

# install requirements to use docker from within docker
RUN apt-get update && apt-get install -y libssl-dev curl ca-certificates
RUN curl -fsSL https://get.docker.com | sh


ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

WORKDIR /app
COPY dyana ./dyana

ENTRYPOINT ["python", "-m", "dyana"]
ENTRYPOINT ["python", "-m", "dyana"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ To uninstall, run:
pip uninstall dyana
```

## Development

Set up a local development environment with uv:

```bash
uv sync --all-extras --group dev --group docs
```

Run the main checks with:

```bash
uv run ruff check dyana
uv run mypy --ignore-missing-imports --no-error-summary dyana
uv run pytest dyana
```

## Usage

See our docs on dyana usage [here](https://docs.dreadnode.io/open-source/dyana/basic-usage)
Expand Down
Loading