Skip to content

Commit

Permalink
Merge pull request #22 from timkpaine/tkp/tests
Browse files Browse the repository at this point in the history
rename to daggre
  • Loading branch information
timkpaine authored Apr 16, 2024
2 parents a7dc631 + 9febb76 commit 956dbd1
Show file tree
Hide file tree
Showing 45 changed files with 81 additions and 9,928 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ current_version = 0.1.0
commit = True
tag = False

[bumpversion:file:python/dagred3/__init__.py]
[bumpversion:file:python/daggre/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 the dagre-d3-lite authors
Copyright 2023 the daggre authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# dagre-d3-lite
A convenience layer on top of `dagre-d3` (`dagre-d3-es`), for use in [ipydagred3](https://github.com/timkpaine/ipydagred3). Built on [transports](https://github.com/timkpaine/transports).
# daggre
A convenience layer on top of `dagre-d3` (`dagre-d3-es`), for use in [ipydagred3](https://github.com/timkpaine/ipydaggre). Built on [transports](https://github.com/timkpaine/transports).

[![Build Status](https://github.com/timkpaine/dagre-d3-lite/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/timkpaine/dagre-d3-lite/actions?query=workflow%3A%22Build+Status%22)
[![codecov](https://codecov.io/gh/timkpaine/dagre-d3-lite/branch/main/graph/badge.svg?token=3N6NOPL4RE)](https://codecov.io/gh/timkpaine/dagre-d3-lite)
[![License](https://img.shields.io/github/license/timkpaine/dagre-d3-lite)](https://github.com/timkpaine/dagre-d3-lite)
[![PyPI](https://img.shields.io/pypi/v/dagred3.svg)](https://pypi.python.org/pypi/dagred3)
[![npm](https://img.shields.io/npm/v/dagre-d3-lite.svg)](https://www.npmjs.com/package/dagre-d3-lite)
[![Build Status](https://github.com/timkpaine/daggre/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/timkpaine/daggre/actions?query=workflow%3A%22Build+Status%22)
[![codecov](https://codecov.io/gh/timkpaine/daggre/branch/main/graph/badge.svg?token=3N6NOPL4RE)](https://codecov.io/gh/timkpaine/daggre)
[![License](https://img.shields.io/github/license/timkpaine/daggre)](https://github.com/timkpaine/daggre)
[![PyPI](https://img.shields.io/pypi/v/daggre.svg)](https://pypi.python.org/pypi/daggre)
[![npm](https://img.shields.io/npm/v/daggre.svg)](https://www.npmjs.com/package/daggre)
6 changes: 3 additions & 3 deletions examples/ipc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from fastapi import FastAPI, WebSocket

sys.path.append("../../python") # noqa
from dagred3 import Graph # noqa: E402
from dagred3 import (AioHttpWebSocketClient, JSONTransport,
StarletteWebSocketServer)
from daggre import Graph # noqa: E402
from daggre import (AioHttpWebSocketClient, JSONTransport,
StarletteWebSocketServer)


def run_server():
Expand Down
4 changes: 2 additions & 2 deletions examples/js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<script type="importmap">
{
"imports": {
"dagre-d3-lite": "../../js/dist/index.js"
"daggre": "../../js/dist/index.js"
}
}
</script>
<script type="module" src="index.js"></script>
</head>
<body><div class="dagred3"></div></body>
<body><div class="daggre"></div></body>
</html>
4 changes: 2 additions & 2 deletions examples/js/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Graph } from "dagre-d3-lite";
import { Graph } from "daggre";

const SCALE = 10;

document.addEventListener("DOMContentLoaded", () => {
const div = document.querySelector("div.dagred3");
const div = document.querySelector("div.daggre");
const graph = new Graph({ direction: "left-to-right" });

let begin = 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<script type="importmap">
{
"imports": {
"dagre-d3-lite": "../../js/dist/index.js"
"daggre": "../../js/dist/index.js"
}
}
</script>
<script type="module" src="index.js"></script>
</head>
<body><div class="dagred3"></div></body>
<body><div class="daggre"></div></body>
</html>
4 changes: 2 additions & 2 deletions examples/python/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Graph, WebSocketClient, JSONTransport } from "dagre-d3-lite";
import { Graph, WebSocketClient, JSONTransport } from "daggre";

document.addEventListener("DOMContentLoaded", async () => {
const jst = new JSONTransport();
Expand All @@ -8,7 +8,7 @@ document.addEventListener("DOMContentLoaded", async () => {
jst.hosts(Graph);
try {
const graph = await handler.initial();
const div = document.querySelector("div.dagred3");
const div = document.querySelector("div.daggre");
graph.render(div);
await handler.handle();
} catch {
Expand Down
4 changes: 2 additions & 2 deletions examples/python/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from fastapi.staticfiles import StaticFiles

sys.path.append("../../python") # noqa
from dagred3 import JSONTransport # noqa: E402
from dagred3 import Graph, StarletteWebSocketServer
from daggre import JSONTransport # noqa: E402
from daggre import Graph, StarletteWebSocketServer


def build_app():
Expand Down
6 changes: 3 additions & 3 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "dagre-d3-lite",
"name": "daggre",
"version": "0.1.0",
"description": "Convenience layer for dagre-d3",
"main": "dist/iexjs.js",
"repository": "git@github.com:timkpaine/dagre-d3-lite.git",
"repository": "git@github.com:timkpaine/daggre.git",
"author": "Tim Paine <t.paine154@gmail.com>",
"license": "Apache-2.0",
"type": "module",
Expand All @@ -16,7 +16,7 @@
],
"scripts": {
"build:esbuild": "esbuild src/index.js --bundle --format=esm --outdir=dist/",
"build:python": "esbuild src/index.js --bundle --format=esm --outdir=../python/dagred3/static/",
"build:python": "esbuild src/index.js --bundle --format=esm --outdir=../python/daggre/static/",
"build": "npm-run-all -p build:*",
"clean": "rimraf dist lib",
"fix": "yarn lint --fix",
Expand Down
2 changes: 1 addition & 1 deletion js/src/core/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class Graph extends Model {
// only run on first rendering
if (!this._rendered) {
// add class to `renderpoint`
renderpoint.classList.add("dagred3-container");
renderpoint.classList.add("daggre-container");

// create svg and g elements
this._graph_svg_inst = d3.select(renderpoint).append("svg");
Expand Down
38 changes: 19 additions & 19 deletions js/src/index.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
div.dagred3-container {
div.daggre-container {
/* min-height: 600px; */
/* min-width: 800px; */
/* resize: both; */
}
div.dagred3-container > svg {

div.daggre-container > svg {
height: 100%;
width: 100%;
}
.dagred3-container .node rect,
.dagred3-container .node circle,
.dagred3-container .node ellipse,
.dagred3-container .node polygon {

.daggre-container .node rect,
.daggre-container .node circle,
.daggre-container .node ellipse,
.daggre-container .node polygon {
stroke: #555;
fill: #fff;
}
.dagred3-container .edgePath path {

.daggre-container .edgePath path {
stroke: #555;
fill: transparent;
stroke-width: 1.5px;
}
.dagred3-container .edgeLabel foreignObject {

.daggre-container .edgeLabel foreignObject {
overflow: visible;
}
.dagred3-container .edgeLabel foreignObject u {

.daggre-container .edgeLabel foreignObject u {
text-decoration: none;
}
.dagred3-container .node text {

.daggre-container .node text {
pointer-events: none;
}
div.dagred3-tooltip {


div.daggre-tooltip {
background-color: rgba(255, 255, 255, .8);
border: 1px solid #555;
padding: 15px;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "dagre-d3-lite",
"repository": "git@github.com:timkpaine/dagre-d3-lite.git",
"name": "daggre",
"repository": "git@github.com:timkpaine/daggre.git",
"author": "Tim Paine <t.paine154@gmail.com>",
"license": "Apache-2.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion python/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 the dagre-d3-lite authors
Copyright 2023 the daggre authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ include README.md

include pyproject.toml

graft dagred3
graft dagred3/static
graft daggre
graft daggre/static

# get rid of test and lint artifacts
prune .pytest_cache
Expand Down
14 changes: 7 additions & 7 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ install: prebuild ## install to site-packages
# Testing #
###########
test: ## Clean and Make unit tests
python -m pytest -v dagred3/tests --junitxml=junit.xml --cov=dagred3 --cov-branch --cov-fail-under=75 --cov-report term-missing --cov-report xml
python -m pytest -v daggre/tests --junitxml=junit.xml --cov=daggre --cov-branch --cov-fail-under=75 --cov-report term-missing --cov-report xml

tests: test

###########
# Linting #
###########
lint: ## Black/flake8 python
python -m ruff check dagred3 setup.py
python -m ruff check daggre setup.py
python -m ruff check ../examples/*/*.py
python -m isort dagred3 setup.py --check
python -m isort daggre setup.py --check
python -m isort ../examples/*/*.py --check


fix: ## Black python
python -m ruff format dagred3 setup.py
python -m ruff format daggre setup.py
python -m ruff format ../examples/*/*.py
python -m isort dagred3 setup.py
python -m isort daggre setup.py
python -m isort ../examples/*/*.py

format: fix
Expand All @@ -53,7 +53,7 @@ check-manifest: prebuild ## run manifest checker for sdist
check-manifest -v

annotate: ## run mypy type annotation
mypy dagred3/
mypy daggre/

################
# Distribution #
Expand All @@ -72,7 +72,7 @@ clean: ## clean the repository
find . -name "*.pyc" | xargs rm -rf
find . -name ".ipynb_checkpoints" | xargs rm -rf
rm -rf .coverage coverage *.xml build dist *.egg-info lib node_modules .pytest_cache *.egg-info
rm -rf dagred3/labextension dagred3/nbextension/static/index*
rm -rf daggre/labextension daggre/nbextension/static/index*
git clean -fd

###########
Expand Down
14 changes: 7 additions & 7 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# dagre-d3-lite
A convenience layer on top of `dagre-d3` (`dagre-d3-es`), for use in [ipydagred3](https://github.com/timkpaine/ipydagred3). Built on [transports](https://github.com/timkpaine/transports).
# daggre
A convenience layer on top of `dagre-d3` (`dagre-d3-es`), for use in [ipydagred3](https://github.com/timkpaine/ipydaggre). Built on [transports](https://github.com/timkpaine/transports).

[![Build Status](https://github.com/timkpaine/dagre-d3-lite/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/timkpaine/dagre-d3-lite/actions?query=workflow%3A%22Build+Status%22)
[![codecov](https://codecov.io/gh/timkpaine/dagre-d3-lite/branch/main/graph/badge.svg?token=3N6NOPL4RE)](https://codecov.io/gh/timkpaine/dagre-d3-lite)
[![License](https://img.shields.io/github/license/timkpaine/dagre-d3-lite)](https://github.com/timkpaine/dagre-d3-lite)
[![PyPI](https://img.shields.io/pypi/v/dagred3.svg)](https://pypi.python.org/pypi/dagred3)
[![npm](https://img.shields.io/npm/v/dagre-d3-lite.svg)](https://www.npmjs.com/package/dagre-d3-lite)
[![Build Status](https://github.com/timkpaine/daggre/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/timkpaine/daggre/actions?query=workflow%3A%22Build+Status%22)
[![codecov](https://codecov.io/gh/timkpaine/daggre/branch/main/graph/badge.svg?token=3N6NOPL4RE)](https://codecov.io/gh/timkpaine/daggre)
[![License](https://img.shields.io/github/license/timkpaine/daggre)](https://github.com/timkpaine/daggre)
[![PyPI](https://img.shields.io/pypi/v/daggre.svg)](https://pypi.python.org/pypi/daggre)
[![npm](https://img.shields.io/npm/v/daggre.svg)](https://www.npmjs.com/package/daggre)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pytest import fixture

from dagred3 import Edge, Graph, Node
from daggre import Edge, Graph, Node


@fixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from unittest.mock import patch

from dagred3 import Graph, Node
from daggre import Graph, Node


class TestBasic:
Expand All @@ -11,7 +11,7 @@ def test_node_repr(self, a_node):
def test_node_serialization(self, a_node):
now = datetime.utcnow()

with patch("dagred3.transports.model.uuid4") as uuid4_mock, patch("dagred3.transports.model.datetime") as utcnow_mock:
with patch("daggre.transports.model.uuid4") as uuid4_mock, patch("daggre.transports.model.datetime") as utcnow_mock:
uuid4_mock.return_value = "blerg"
utcnow_mock.utcnow.return_value = now
print(now.isoformat())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dagred3 import Graph
from daggre import Graph


def test_graph_generator_helper():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
from typing import Dict, List

from dagred3.transports import BaseModel, Transport
from daggre.transports import BaseModel, Transport


class MyModel(BaseModel): ...
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 0 additions & 33 deletions python/dagred3/static/index.css

This file was deleted.

Loading

0 comments on commit 956dbd1

Please sign in to comment.