Skip to content

Commit

Permalink
Proof of concept (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel authored Feb 12, 2023
1 parent 022bcb2 commit da7f6ea
Show file tree
Hide file tree
Showing 33 changed files with 2,873 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
open-pull-requests-limit: 1
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--- Provide a general summary of your changes here. -->

Tasks
-----

- [ ] Updated changelog.
- [ ] Updated documentation.
23 changes: 23 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: publish-docs

on:
push:
branches:
- main

jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3.3.0
- name: Set up Python 3.x
uses: actions/setup-python@v4.5.0
with:
python-version: "3.x"
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
- name: Install Package
run: poetry install
- name: Build and deploy docs
run: poetry run mkdocs gh-deploy --clean --strict --verbose --force
23 changes: 23 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: publish-package

on:
release:
types: [published]

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3.3.0
- name: Set up Python 3.x
uses: actions/setup-python@v4.5.0
with:
python-version: "3.x"
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
- name: Build the package
run: poetry build -vvv
- name: Publish to PyPI
run: poetry publish --username __token__ --password ${{ secrets.pypi_token }}
working-directory: ${{ github.workspace }}
52 changes: 52 additions & 0 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: quality-check

on:
push:
branches:
- main
pull_request:

jobs:
test-code:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11"]
defaults:
run:
shell: bash
runs-on: ${{ matrix.platform }}
timeout-minutes: 15
env:
PLATFORM: ${{ matrix.platform }}
PYTHON_VERSION: ${{ matrix.python-version }}
PYTHONUTF8: 1 # https://peps.python.org/pep-0540/
COLORTERM: truecolor
PIP_DISABLE_PIP_VERSION_CHECK: 1
steps:
- name: Check out repository
uses: actions/checkout@v3.3.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
- name: Install Package
run: poetry install
- name: Run pre-commit checks
run: poetry run pre-commit run --all-files --show-diff-on-failure --color=always
- name: Make sure we can build the package
run: poetry build -vvv
- name: Test types
run: poetry run mypy
- name: Test code
run: poetry run pytest -v --cov --cov-report=xml --durations=20
- name: Test docs
run: poetry run mkdocs build --clean --strict --verbose
- name: Upload coverage
uses: codecov/codecov-action@v3.1.1
with:
env_vars: PLATFORM,PYTHON_VERSION
fail_ci_if_error: false
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-toml
- id: check-json
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
- id: trailing-whitespace
exclude_types: [svg]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: python-use-type-annotations
- id: python-check-blanket-type-ignore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
hooks:
- id: check-github-workflows
- id: check-github-actions
- id: check-dependabot
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.3
hooks:
- id: pycln
args: [--config=pyproject.toml]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# synth
# Synthesize

[![PyPI](https://img.shields.io/pypi/v/synthesize)](https://pypi.org/project/synthesize)
[![PyPI - License](https://img.shields.io/pypi/l/synthesize)](https://pypi.org/project/synthesize)
[![Docs](https://img.shields.io/badge/docs-exist-brightgreen)](https://www.synth.how)

[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/JoshKarpel/synthesize/main.svg)](https://results.pre-commit.ci/latest/github/JoshKarpel/synthesize/main)
[![codecov](https://codecov.io/gh/JoshKarpel/synthesize/branch/main/graph/badge.svg?token=2sjP4V0AfY)](https://codecov.io/gh/JoshKarpel/synthesize)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![GitHub issues](https://img.shields.io/github/issues/JoshKarpel/synthesize)](https://github.com/JoshKarpel/synthesize/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/JoshKarpel/synthesize)](https://github.com/JoshKarpel/synthesize/pulls)
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.synth.how
Binary file added docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions docs/assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
:root {
--class-color: #00b8d4;
--class-header-color: #00b8d41a;
--function-color: #448aff;
--function-header-color: #448aff1a;
}

article > .doc {
border-style: solid;
border-width: 0.05rem;
border-radius: 0.2rem;
padding: 0.6rem 0.6rem;
box-shadow: var(--md-shadow-z1);
}

article > .doc + .doc {
margin-top: 1rem;
}

h3.doc {
margin: -0.6rem;
padding: 0.6rem;
}

article > .doc.doc-class {
border-color: var(--class-color);
}

.doc-class > h3.doc {
background-color: var(--class-header-color);
}

article > .doc.doc-function {
border-color: var(--function-color);
}

.doc-function > h3.doc {
background-color: var(--function-header-color);
}

/* Indentation. */
div.doc-contents:not(.first) {
padding-left: 25px;
border-left: .05rem solid var(--md-typeset-table-color);
}

/* Mark external links as such. */
a.autorefs-external::after {
/* https://primer.style/octicons/arrow-up-right-24 */
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgb(0, 0, 0)" d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
content: ' ';

display: inline-block;
position: relative;
top: 0.1em;
margin-left: 0.2em;
margin-right: 0.1em;

height: 1em;
width: 1em;
border-radius: 100%;
background-color: var(--md-typeset-a-color);
}
a.autorefs-external:hover::after {
background-color: var(--md-accent-fg-color);
}
10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## `0.0.2`

Released `2023-02-12`

### Added

- [#1](https://github.com/JoshKarpel/synthesize/pull/1) Core graph-of-targets data model and executor, with support for `once`, `restart`, and `watch` lifecycles.
- [#1](https://github.com/JoshKarpel/synthesize/pull/1) Support for YAML configuration files.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Synthesize
29 changes: 29 additions & 0 deletions examples/dag.synth
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
1:
sleep 2
echo 1

2:
sleep 2
echo 2

3:
sleep 2
echo 3

4:
@after 1 2

sleep 2
echo 4

5:
@after 2 3

sleep 2
echo 5

6:
@after 4 5

sleep 2
echo 6
34 changes: 34 additions & 0 deletions examples/dag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
targets:
- id: 1
commands: |
sleep 2
echo 1
- id: 2
commands: |
sleep 2
echo 2
- id: 3
commands: |
sleep 2
echo 3
- id: 4
commands: |
sleep 2
echo 4
after:
- 1
- 2
- id: 5
commands: |
sleep 2
echo 5
after:
- 2
- 3
- id: 6
commands: |
sleep 2
echo 6
after:
- 4
- 5
Loading

0 comments on commit da7f6ea

Please sign in to comment.