diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f99e672..4bfb2f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 .. \ No newline at end of file + cd .. + - name: Enforce module boundaries/dependencies + run: + source .venv/bin/activate + tach check \ No newline at end of file diff --git a/chatpdb/chat/llm/package.yml b/chatpdb/chat/llm/package.yml new file mode 100644 index 0000000..346b246 --- /dev/null +++ b/chatpdb/chat/llm/package.yml @@ -0,0 +1,2 @@ +tags: ["llm"] +strict: true \ No newline at end of file diff --git a/chatpdb/chat/package.yml b/chatpdb/chat/package.yml new file mode 100644 index 0000000..89cfeea --- /dev/null +++ b/chatpdb/chat/package.yml @@ -0,0 +1,2 @@ +tags: ['chatpdb.chat'] +strict: true \ No newline at end of file diff --git a/chatpdb/chat/prompts/package.yml b/chatpdb/chat/prompts/package.yml new file mode 100644 index 0000000..4c1d515 --- /dev/null +++ b/chatpdb/chat/prompts/package.yml @@ -0,0 +1,2 @@ +tags: ["prompts"] +strict: true \ No newline at end of file diff --git a/chatpdb/debugger/__init__.py b/chatpdb/debugger/__init__.py new file mode 100644 index 0000000..d0fb72a --- /dev/null +++ b/chatpdb/debugger/__init__.py @@ -0,0 +1,4 @@ +# Generated by tach on 2024-05-02 15:38:25 +from .main import ChatPdb, TerminalChatPdb + +__all__ = ["ChatPdb", "TerminalChatPdb"] diff --git a/chatpdb/debugger.py b/chatpdb/debugger/main.py similarity index 100% rename from chatpdb/debugger.py rename to chatpdb/debugger/main.py diff --git a/chatpdb/debugger/package.yml b/chatpdb/debugger/package.yml new file mode 100644 index 0000000..499b5da --- /dev/null +++ b/chatpdb/debugger/package.yml @@ -0,0 +1,2 @@ +tags: ["debugger"] +strict: true \ No newline at end of file diff --git a/chatpdb/frame/__init__.py b/chatpdb/frame/__init__.py new file mode 100644 index 0000000..faa072b --- /dev/null +++ b/chatpdb/frame/__init__.py @@ -0,0 +1,5 @@ +# Generated by tach on 2024-05-02 15:38:25 +from .main import FrameData + + +__all__ = ["FrameData"] diff --git a/chatpdb/frame.py b/chatpdb/frame/main.py similarity index 100% rename from chatpdb/frame.py rename to chatpdb/frame/main.py diff --git a/chatpdb/frame/package.yml b/chatpdb/frame/package.yml new file mode 100644 index 0000000..7efdd20 --- /dev/null +++ b/chatpdb/frame/package.yml @@ -0,0 +1,2 @@ +tags: ["frame"] +strict: true \ No newline at end of file diff --git a/chatpdb/package.yml b/chatpdb/package.yml new file mode 100644 index 0000000..ddec30d --- /dev/null +++ b/chatpdb/package.yml @@ -0,0 +1 @@ +tags: ['chatpdb'] \ No newline at end of file diff --git a/chatpdb/parsing/package.yml b/chatpdb/parsing/package.yml new file mode 100644 index 0000000..bb45028 --- /dev/null +++ b/chatpdb/parsing/package.yml @@ -0,0 +1,2 @@ +tags: ['chatpdb.parsing'] +strict: true \ No newline at end of file diff --git a/chatpdb/stdout/__init__.py b/chatpdb/stdout/__init__.py new file mode 100644 index 0000000..2b4f641 --- /dev/null +++ b/chatpdb/stdout/__init__.py @@ -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"] diff --git a/chatpdb/stdout.py b/chatpdb/stdout/main.py similarity index 100% rename from chatpdb/stdout.py rename to chatpdb/stdout/main.py diff --git a/chatpdb/stdout/package.yml b/chatpdb/stdout/package.yml new file mode 100644 index 0000000..2cbbdca --- /dev/null +++ b/chatpdb/stdout/package.yml @@ -0,0 +1,2 @@ +tags: ["stdout"] +strict: true \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..3127653 --- /dev/null +++ b/dev-requirements.txt @@ -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 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 71cd2a1..2867b17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tach.yml b/tach.yml new file mode 100644 index 0000000..30010d7 --- /dev/null +++ b/tach.yml @@ -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 diff --git a/tests/test_debugger.py b/tests/test_debugger.py index a2311d4..1256ec9 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -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): diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 7f70db8..db8b151 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -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