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
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
workflow_dispatch:

jobs:
# Build Python package
build:
uses: ewoks-kit/.github/.github/workflows/python-build.yml@main

# Run tests
tests:
needs: build
uses: ewoks-kit/.github/.github/workflows/python-tests.yml@main


# Publish package to TestPyPI
publish-testpypi:
needs: tests
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

# Publish package to PyPI
publish-pypi:
needs: tests
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: pypa/gh-action-pypi-publish@release/v1

# Tag
tag-release:
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: ewoks-kit/.github/.github/actions/tag-release@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
workflow_call:

jobs:
# Build Python package
build:
uses: ewoks-kit/.github/.github/workflows/python-build.yml@main

# Run tests
tests:
needs: build
uses: ewoks-kit/.github/.github/workflows/python-tests.yml@main
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
enable-coverage: ${{ matrix.enable-coverage }}
jupyter-platform-dirs: "1"
codecov-flags: "unit"
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.9"
enable-coverage: "false"
# https://github.com/networkx/networkx/issues/7372
extra-pytest-warnings: "-W ignore::RuntimeWarning:networkx.utils.backends"

- os: ubuntu-latest
python-version: "3.12"
enable-coverage: "true"
extra-pytest-warnings: ""


- os: windows-latest
python-version: "3.12"
enable-coverage: "false"
extra-pytest-warnings: ""

# Run linter / checks
checks:
uses: ewoks-kit/.github/.github/workflows/python-check.yml@main
with:
enable-isort: "false"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!.readthedocs.yaml
!.flake8
!.flake8_nb
!.github

# Byte / compiled / optimized
*.py[cod]
Expand Down
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 adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- CLI entry point `ewoksdraw` that generates an SVG file from a single output path argument.
- Automatic mock workflow generation with a background and randomly positioned task blocks.
- SVG task rendering with:
- task title text
- task box and title separator line
- input/output labels
- circular anchor links for IO ports
- Adaptive task layout logic that scales/truncates text and adjusts font sizes to keep content within box width constraints.
- SVG canvas export helpers:
- pretty-printed SVG file output
- in-memory XML representation
- dictionary representation via `xmltodict`
- Basic CLI smoke test ensuring `ewoksdraw` writes an SVG output file.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a href="https://gitlab.esrf.fr/dau/ci/pyci/-/blob/main/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>
<a href="https://github.com/ewoks-kit/.github/blob/main/shared/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ewoksdraw

[![Pipeline](https://github.com/ewoks-kit/ewoksdraw/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/ewoks-kit/ewoksdraw/actions/workflows/test.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![License](https://img.shields.io/github/license/ewoks-kit/ewoksdraw)](https://github.com/ewoks-kit/ewoksdraw/blob/main/LICENSE.md)
[![Coverage](https://codecov.io/gh/ewoks-kit/ewoksdraw/branch/main/graph/badge.svg)](https://codecov.io/gh/ewoks-kit/ewoksdraw)

A project to generate SVG mock-ups out of Ewoks workflows.

## Quick start
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ test = [
]
dev = [
"pytest >=7",
"ruff",
"ruff",
"black",
"mypy",
]
doc = [
Expand Down Expand Up @@ -76,7 +77,4 @@ ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "setuptools.*"
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = "--cov=ewoksdraw --cov-report=term"
ignore_missing_imports = true
4 changes: 1 addition & 3 deletions src/ewoksdraw/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

from faker import Faker

from .svg import SvgBackground
from .svg import SvgCanvas
from .svg import SvgTask
from .svg import SvgBackground, SvgCanvas, SvgTask


def generate_random_names() -> list:
Expand Down
7 changes: 2 additions & 5 deletions src/ewoksdraw/svg/svg_canvas.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from pathlib import Path
from typing import Iterator
from typing import List
from typing import Union
from typing import Iterator, List, Union
from xml.dom import minidom
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import tostring
from xml.etree.ElementTree import Element, tostring

import xmltodict

Expand Down
3 changes: 1 addition & 2 deletions src/ewoksdraw/svg/svg_element.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path
from typing import Literal
from typing import Optional
from typing import Literal, Optional
from xml.etree.ElementTree import Element


Expand Down
3 changes: 1 addition & 2 deletions src/ewoksdraw/svg/svg_group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import re
from typing import Iterable
from typing import Union
from typing import Iterable, Union
from xml.etree.ElementTree import Element

from .svg_element import SvgElement
Expand Down
3 changes: 1 addition & 2 deletions src/ewoksdraw/svg/svg_task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..config.constants import IO_INTER_IO_MARGIN
from ..config.constants import IO_TOP_MARGIN
from ..config.constants import IO_INTER_IO_MARGIN, IO_TOP_MARGIN
from .svg_group import SvgGroup
from .svg_task_box import SvgTaskBox
from .svg_task_io import SvgTaskIOGroup
Expand Down
3 changes: 1 addition & 2 deletions src/ewoksdraw/svg/svg_task_box.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..config.constants import BOX_MAX_WIDTH
from ..config.constants import BOX_MIN_WIDTH
from ..config.constants import BOX_MAX_WIDTH, BOX_MIN_WIDTH
from .svg_element import SvgElement


Expand Down
10 changes: 6 additions & 4 deletions src/ewoksdraw/svg/svg_task_io.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from typing import Literal

from ..config.constants import ANCHOR_LINKS_RADIUS
from ..config.constants import IO_ANCHOR_TEXT_MARGIN
from ..config.constants import IO_MIN_FONT_SIZE
from ..config.constants import IO_TARGET_FONT_SIZE
from ..config.constants import (
ANCHOR_LINKS_RADIUS,
IO_ANCHOR_TEXT_MARGIN,
IO_MIN_FONT_SIZE,
IO_TARGET_FONT_SIZE,
)
from .svg_group import SvgGroup
from .svg_task_anchor_link import SvgTaskAnchorLink
from .svg_text import SvgText
Expand Down
10 changes: 6 additions & 4 deletions src/ewoksdraw/svg/svg_task_title.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from typing import Optional

from ..config.constants import TITLE_HORIZONTAL_MARGIN
from ..config.constants import TITLE_MIN_FONT_SIZE
from ..config.constants import TITLE_TARGET_FONT_SIZE
from ..config.constants import TITLE_VERTICAL_MARGIN
from ..config.constants import (
TITLE_HORIZONTAL_MARGIN,
TITLE_MIN_FONT_SIZE,
TITLE_TARGET_FONT_SIZE,
TITLE_VERTICAL_MARGIN,
)
from .svg_text import SvgText


Expand Down
File renamed without changes.