Skip to content

Commit

Permalink
Merge pull request #358 from goodboy/switch_to_pdbp
Browse files Browse the repository at this point in the history
Switch to `pdbp` 馃弰馃徏
  • Loading branch information
goodboy committed May 15, 2023
2 parents 0f7db27 + 41aa91c commit e5ee2e3
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 101 deletions.
16 changes: 12 additions & 4 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
``tractor`` is a `structured concurrent`_, multi-processing_ runtime
built on trio_.

Fundamentally ``tractor`` gives you parallelism via ``trio``-"*actors*":
our nurseries_ let you spawn new Python processes which each run a ``trio``
Fundamentally, ``tractor`` gives you parallelism via
``trio``-"*actors*": independent Python processes (aka
non-shared-memory threads) which maintain structured
concurrency (SC) *end-to-end* inside a *supervision tree*.

Cross-process (and thus cross-host) SC is accomplished through the
combined use of our "actor nurseries_" and an "SC-transitive IPC
protocol" constructed on top of multiple Pythons each running a ``trio``
scheduled runtime - a call to ``trio.run()``.

We believe the system adheres to the `3 axioms`_ of an "`actor model`_"
Expand All @@ -23,7 +29,8 @@ Features
- **It's just** a ``trio`` API
- *Infinitely nesteable* process trees
- Builtin IPC streaming APIs with task fan-out broadcasting
- A (first ever?) "native" multi-core debugger UX for Python using `pdb++`_
- A "native" multi-core debugger REPL using `pdbp`_ (a fork & fix of
`pdb++`_ thanks to @mdmintz!)
- Support for a swappable, OS specific, process spawning layer
- A modular transport stack, allowing for custom serialization (eg. with
`msgspec`_), communications protocols, and environment specific IPC
Expand Down Expand Up @@ -149,7 +156,7 @@ it **is a bug**.

"Native" multi-process debugging
--------------------------------
Using the magic of `pdb++`_ and our internal IPC, we've
Using the magic of `pdbp`_ and our internal IPC, we've
been able to create a native feeling debugging experience for
any (sub-)process in your ``tractor`` tree.

Expand Down Expand Up @@ -597,6 +604,7 @@ channel`_!
.. _adherance to: https://www.youtube.com/watch?v=7erJ1DV_Tlo&t=1821s
.. _trio gitter channel: https://gitter.im/python-trio/general
.. _matrix channel: https://matrix.to/#/!tractor:matrix.org
.. _pdbp: https://github.com/mdmintz/pdbp
.. _pdb++: https://github.com/pdbpp/pdbpp
.. _guest mode: https://trio.readthedocs.io/en/stable/reference-lowlevel.html?highlight=guest%20mode#using-guest-mode-to-run-trio-on-top-of-other-event-loops
.. _messages: https://en.wikipedia.org/wiki/Message_passing
Expand Down
24 changes: 24 additions & 0 deletions examples/debugging/restore_builtin_breakpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import sys

import trio
import tractor


async def main() -> None:
async with tractor.open_nursery(debug_mode=True) as an:

assert os.environ['PYTHONBREAKPOINT'] == 'tractor._debug._set_trace'

# TODO: an assert that verifies the hook has indeed been, hooked
# XD
assert sys.breakpointhook is not tractor._debug._set_trace

breakpoint()

# TODO: an assert that verifies the hook is unhooked..
assert sys.breakpointhook
breakpoint()

if __name__ == '__main__':
trio.run(main)
15 changes: 15 additions & 0 deletions nooz/358.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Switch to using the fork & fix of `pdb++`, `pdbp`:
https://github.com/mdmintz/pdbp

Allows us to sidestep a variety of issues that aren't being maintained
in the upstream project thanks to the hard work of @mdmintz!

We also include some default settings adjustments as per recent
development on the fork:

- sticky mode is still turned on by default but now activates when
a using the `ll` repl command.
- turn off line truncation by default to avoid inter-line gaps when
resizing the terimnal during use.
- when using the backtrace cmd either by `w` or `bt`, the config
automatically switches to non-sticky mode.
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pytest
pytest-trio
pytest-timeout
pdbpp
pdbp
mypy
trio_typing
pexpect
Expand Down
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
setup(
name="tractor",
version='0.1.0a6dev0', # alpha zone
description='structured concurrrent "actors"',
description='structured concurrrent `trio`-"actors"',
long_description=readme,
license='AGPLv3',
author='Tyler Goodlet',
maintainer='Tyler Goodlet',
maintainer_email='jgbt@protonmail.com',
maintainer_email='goodboy_foss@protonmail.com',
url='https://github.com/goodboy/tractor',
platforms=['linux', 'windows'],
packages=[
Expand All @@ -52,16 +52,14 @@
# tooling
'tricycle',
'trio_typing',

# tooling
'colorlog',
'wrapt',

# serialization
# IPC serialization
'msgspec',

# debug mode REPL
'pdbpp',
'pdbp',

# pip ref docs on these specs:
# https://pip.pypa.io/en/stable/reference/requirement-specifiers/#examples
Expand All @@ -73,10 +71,9 @@
# https://github.com/pdbpp/fancycompleter/issues/37
'pyreadline3 ; platform_system == "Windows"',


],
tests_require=['pytest'],
python_requires=">=3.9",
python_requires=">=3.10",
keywords=[
'trio',
'async',
Expand Down

0 comments on commit e5ee2e3

Please sign in to comment.