-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,255 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Integration | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
integration: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 🐍 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
cache: "poetry" | ||
|
||
- name: Setup Scripts 🧩 | ||
run: | | ||
poetry install | ||
inv env.switch ci | ||
inv tool.install ci-int --yes | ||
- name: Lint 🪶 | ||
run: inv lint | ||
|
||
- name: Test 🧪 | ||
run: inv test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publication | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
publication: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Git ✨ | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
- name: Setup Python 🐍 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
cache: "poetry" | ||
|
||
- name: Setup Scripts 🧩 | ||
run: | | ||
poetry install | ||
inv env.switch ci | ||
inv tool.install ci-dep --yes | ||
- name: Build 🏗️ | ||
run: inv build | ||
|
||
- name: Publish 🚀 | ||
run: inv publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# dspy-inspector | ||
DSPy program inspector | ||
|
||
DSPy program/pipeline inspector widget for Jupyter/VSCode Notebook. | ||
|
||
TODO: Explain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO = "TODO" |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
[tool.poetry] | ||
name = "dspy-inspector" | ||
version = "0.1.0" | ||
description = "DSPy program/pipeline inspector widget for Jupyter/VSCode Notebook." | ||
authors = ["Alex Rodriguez <[email protected]>"] | ||
maintainers = ["Alex Rodriguez <[email protected]>"] | ||
license = "GPL-3.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/neoxelox/dspy-inspector" | ||
repository = "https://github.com/neoxelox/dspy-inspector" | ||
documentation = "https://github.com/neoxelox/dspy-inspector" | ||
keywords = [ | ||
"dspy", | ||
"inspector", | ||
"program", | ||
"pipeline", | ||
"plugin", | ||
"widget", | ||
"notebook", | ||
"jupyter", | ||
"vscode", | ||
"dspy-inspector", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
|
||
[tool.poetry.dev-dependencies] | ||
autoflake = { git = "https://github.com/neoxelox/autoflake.git" } | ||
black = "24.1.1" | ||
flake8 = "3.9.0" | ||
flake8-black = "0.2.3" | ||
flake8-colors = "0.1.9" | ||
flake8-isort = "4.1.1" | ||
flakehell = "0.9.0" | ||
isort = "5.13.2" | ||
mypy = "0.910" | ||
pylint = "2.10.2" | ||
pytest = "6.2.4" | ||
pytest-xdist = "2.3.0" | ||
superinvoke = "1.0.5" | ||
|
||
[tool.flakehell] | ||
# List of error codes: (flakehell code <code>) | ||
# - https://flake8.pycqa.org/en/latest/user/error-codes.html | ||
# - https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes | ||
format = "${cyan_underline}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} ${white}%(text)s${reset}" | ||
max_line_length = 120 | ||
show_source = true | ||
statistics = true | ||
count = true | ||
jobs = "auto" | ||
exclude = ["**/__pycache__/*", "**/__init__.py"] | ||
|
||
[tool.flakehell.plugins] | ||
"flake8-black" = ["+*"] | ||
"flake8-isort" = ["+*"] | ||
mccabe = ["+*"] | ||
pycodestyle = ["+*", "-W0621", "-E203", "-E1101", "-W503"] | ||
pyflakes = ["+*"] | ||
pylint = ["+*", "-W0621", "-E1101", "-W503"] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
py_version = "311" | ||
line_length = 120 | ||
multi_line_output = 3 | ||
known_first_party = ["dspy-inspector"] | ||
default_section = "THIRDPARTY" | ||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] | ||
extend_skip_glob = ["**/__pycache__/*", "**/__init__.py"] | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py311'] | ||
include = '.*\.py' | ||
extend-exclude = '(.*__init__\.py)' | ||
|
||
[tool.autoflake] | ||
recursive = true | ||
in_place = true | ||
remove_unused_variables = true | ||
remove_all_unused_imports = true | ||
exclude = ["**/__pycache__/*", "**/__init__.py"] | ||
|
||
[tool.mypy] | ||
python_version = "3.11" | ||
disallow_untyped_defs = true | ||
disallow_any_unimported = true | ||
no_implicit_optional = true | ||
check_untyped_defs = true | ||
warn_return_any = true | ||
warn_unused_ignores = true | ||
show_error_codes = true | ||
files = ['**/*.py'] | ||
exclude = '(.*__init__\.py)' | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import ssl | ||
|
||
import superinvoke | ||
from superinvoke.constants import Platforms | ||
|
||
from . import tasks | ||
from .envs import Envs | ||
from .tools import Tools | ||
|
||
# Temporal fix very annoying error: certificate verify failed: unable to get local issuer certificate | ||
ssl._create_default_https_context = ssl._create_unverified_context | ||
|
||
root = superinvoke.init(tools=Tools, envs=Envs) | ||
|
||
root.configure({ | ||
"run": { | ||
"pty": ( | ||
Platforms.CURRENT != Platforms.WINDOWS | ||
and Envs.Current != Envs.Ci | ||
), | ||
}, | ||
}) | ||
|
||
|
||
root.add_task(tasks.lint) | ||
root.add_task(tasks.format) | ||
root.add_task(tasks.test) | ||
root.add_task(tasks.build) | ||
root.add_task(tasks.publish) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import superinvoke | ||
|
||
from .tags import Tags | ||
|
||
|
||
class Envs(superinvoke.Envs): | ||
Default = lambda cls: cls.Dev | ||
|
||
Dev = superinvoke.Env( | ||
name="dev", | ||
tags=[*Tags.As("dev*")], | ||
) | ||
|
||
Ci = superinvoke.Env( | ||
name="ci", | ||
tags=[*Tags.As("ci*")], | ||
) | ||
|
||
Prod = superinvoke.Env( | ||
name="prod", | ||
tags=[*Tags.As("prod*")], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import superinvoke | ||
|
||
|
||
class Tags(superinvoke.Tags): | ||
DEV = "dev" | ||
CI_INT = "ci-int" | ||
CI_DEP = "ci-dep" | ||
PROD = "prod" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import os | ||
import re | ||
|
||
from superinvoke import console, rich, task | ||
|
||
from .envs import Envs | ||
from .tools import Tools | ||
|
||
|
||
@task( | ||
help={ | ||
"test": "[<FILE_PATH>]::[<TEST_NAME>]. If empty, it will run all tests.", | ||
}, | ||
) | ||
def test(context, test="./dspy_inspector/"): | ||
"""Run tests.""" | ||
|
||
context.run(f"{Tools.Poetry} run pytest -p no:warnings -n auto {test}") | ||
|
||
|
||
@task( | ||
help={ | ||
"file": "[<FILE_PATH>]. If empty, it will lint all files.", | ||
}, | ||
) | ||
def lint(context, file="./dspy_inspector/"): | ||
"""Run linter.""" | ||
|
||
context.run(f"{Tools.Poetry} run flakehell lint {file}") | ||
context.run(f"{Tools.Poetry} run mypy {file}") | ||
|
||
|
||
@task( | ||
help={ | ||
"file": "[<FILE_PATH>]. If empty, it will format all files.", | ||
}, | ||
) | ||
def format(context, file="./dspy_inspector/"): | ||
"""Run formatter.""" | ||
|
||
context.run(f"{Tools.Poetry} run autoflake {file}") | ||
context.run(f"{Tools.Poetry} run isort {file}") | ||
context.run(f"{Tools.Poetry} run black {file}") | ||
|
||
|
||
@task() | ||
def build(context): | ||
"""Build package.""" | ||
|
||
if Envs.Current != Envs.Ci: | ||
context.fail(f"build command only available in {Envs.Ci} environment!") | ||
|
||
context.run(f"{Tools.Poetry} build") | ||
|
||
|
||
@task() | ||
def publish(context): | ||
"""Publish package.""" | ||
|
||
if Envs.Current != Envs.Ci: | ||
context.fail(f"publish command only available in {Envs.Ci} environment!") | ||
|
||
version = context.tag() | ||
if not version: | ||
latest_version = context.tag(current=False) or "v0.0.0" | ||
major, minor, patch = tuple(map(str, (latest_version.split(".")))) | ||
version = f"{major}.{str(int(minor) + 1)}.{0}" | ||
context.info(f"Version tag not set, generating one from {latest_version}: {version}") | ||
context.run(f"{Tools.Git} tag {version}") | ||
context.run(f"{Tools.Git} push origin {version}") | ||
else: | ||
context.info(f"Version tag already set: {version}") | ||
|
||
context.info("Refreshing golang module registry cache") | ||
|
||
context.run(f"{Tools.Poetry} publish -r pypi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import superinvoke | ||
|
||
from .tags import Tags | ||
|
||
|
||
class Tools(superinvoke.Tools): | ||
Git = superinvoke.Tool( | ||
name="git", | ||
version=">=2.34.1", | ||
tags=[*Tags.As("*")], | ||
path="git", | ||
) | ||
|
||
Python = superinvoke.Tool( | ||
name="python", | ||
version=">=3.11", | ||
tags=[*Tags.As("*")], | ||
path="python", | ||
) | ||
|
||
Poetry = superinvoke.Tool( | ||
name="poetry", | ||
version=">=1.7.1", | ||
tags=[*Tags.As("*")], | ||
path="poetry", | ||
) |