Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tach #5

Merged
merged 15 commits into from
May 2, 2024
Merged
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
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
@@ -26,16 +26,25 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install ruff pytest pytest-mock coverage pyright
pip install .
pip install --upgrade pip
pip install uv
uv venv
source .venv/bin/activate
uv pip install -r dev-requirements.txt
uv pip install .
- name: Check ruff
run: |
source .venv/bin/activate
ruff check . --exclude tests
ruff format --check .
- name: Test with pytest and report coverage
run: |
source .venv/bin/activate
cd tests
coverage run --branch --source=../ -m pytest
coverage report
cd ..
cd ..
- name: Enforce module boundaries/dependencies
run:
source .venv/bin/activate
tach check
2 changes: 2 additions & 0 deletions chatpdb/chat/llm/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ["llm"]
strict: true
2 changes: 2 additions & 0 deletions chatpdb/chat/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ['chatpdb.chat']
strict: true
2 changes: 2 additions & 0 deletions chatpdb/chat/prompts/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ["prompts"]
strict: true
4 changes: 4 additions & 0 deletions chatpdb/debugger/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated by tach on 2024-05-02 15:38:25
from .main import ChatPdb, TerminalChatPdb

__all__ = ["ChatPdb", "TerminalChatPdb"]
File renamed without changes.
2 changes: 2 additions & 0 deletions chatpdb/debugger/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ["debugger"]
strict: true
5 changes: 5 additions & 0 deletions chatpdb/frame/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by tach on 2024-05-02 15:38:25
from .main import FrameData


__all__ = ["FrameData"]
File renamed without changes.
2 changes: 2 additions & 0 deletions chatpdb/frame/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ["frame"]
strict: true
1 change: 1 addition & 0 deletions chatpdb/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tags: ['chatpdb']
2 changes: 2 additions & 0 deletions chatpdb/parsing/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ['chatpdb.parsing']
strict: true
5 changes: 5 additions & 0 deletions chatpdb/stdout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by tach on 2024-05-02 15:38:25
from .main import sset_trace, spost_mortem, spm, slaunch_ipdb_on_exception


__all__ = ["sset_trace", "spost_mortem", "spm", "slaunch_ipdb_on_exception"]
File renamed without changes.
2 changes: 2 additions & 0 deletions chatpdb/stdout/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags: ["stdout"]
strict: true
6 changes: 6 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ruff==0.4.1
pytest==8.1.1
pytest-mock==3.14.0
tach==0.1.2
coverage==7.5.0
pyright==1.1.360
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
30 changes: 30 additions & 0 deletions tach.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
constraints:
chatpdb:
depends_on:
- debugger
- stdout
- chatpdb.parsing
- chatpdb.chat
chatpdb.chat:
depends_on:
- llm
- prompts
chatpdb.parsing:
depends_on:
- frame
- chatpdb.chat
- chatpdb
debugger:
depends_on:
- chatpdb.parsing
- chatpdb.chat
llm:
depends_on:
- prompts
stdout:
depends_on:
- chatpdb
exclude:
- tests
- docs
exclude_hidden_paths: true
4 changes: 2 additions & 2 deletions tests/test_debugger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from chatpdb.debugger import handle_chat_pdb
from tests.test_fixtures import mock_chat, mock_console, sample_frame
from chatpdb.debugger.main import handle_chat_pdb
from tests.test_fixtures import mock_chat, mock_console, sample_frame # noqa: F401


def test_handle_chat_pdb_with_valid_frame(mock_console, mock_chat, sample_frame):
6 changes: 3 additions & 3 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@

@pytest.fixture
def mock_console():
with patch("chatpdb.debugger.console") as mock:
with patch("chatpdb.debugger.main.console") as mock:
yield mock


@pytest.fixture
def mock_chat():
with patch("chatpdb.debugger.ask") as mock_ask, patch(
"chatpdb.debugger.explain"
with patch("chatpdb.debugger.main.ask") as mock_ask, patch(
"chatpdb.debugger.main.explain"
) as mock_explain:
yield mock_ask, mock_explain