Compare commits

..

1 Commits

Author SHA1 Message Date
Tyler Goodlet 800c99ac41 Move concrete `Address`es to each tpt module
That is moving from `._addr`,
- `TCPAddress` to `.ipc._tcp`
- `UDSAddress` to `.ipc._uds`

Obviously this requires adjusting a buncha stuff in `._addr` to avoid
import cycles (the original reason the module was not also included in
the new `.ipc` subpkg) including,

- avoiding "unnecessary" imports of `[Unwrapped]Address` in various modules.
  * since `Address` is a protocol and the main point is that it **does
    not need to be inherited** per
    (https://typing.python.org/en/latest/spec/protocol.html#terminology)
    thus I removed the need for it in both transport submods.
  * and `UnwrappedAddress` is a type alias for tuples.. so we don't
    really always need to be importing it since it also kinda obfuscates
    what the underlying pairs are.
- not exporting everything in submods at the `.ipc` top level and
  importing from specific submods by default.
- only importing various types under a `if typing.TYPE_CHECKING:` guard
  as needed.
2025-04-07 18:07:58 -04:00
2 changed files with 36 additions and 8 deletions

View File

@ -2,17 +2,14 @@ import time
import trio
import pytest
import tractor
from tractor.ipc._ringbuf import (
from tractor.ipc import (
open_ringbuf,
RBToken,
RingBuffSender,
RingBuffReceiver
)
from tractor._testing.samples import (
generate_sample_messages,
)
from tractor._testing.samples import generate_sample_messages
# in case you don't want to melt your cores, uncomment dis!
pytestmark = pytest.mark.skip

View File

@ -13,12 +13,43 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# import platform
'''
A modular IPC layer supporting the power of cross-process SC!
# from ._transport import (
# MsgTransportKey as MsgTransportKey,
# MsgType as MsgType,
# MsgTransport as MsgTransport,
# MsgpackTransport as MsgpackTransport
# )
# from ._tcp import MsgpackTCPStream as MsgpackTCPStream
# from ._uds import MsgpackUDSStream as MsgpackUDSStream
# from ._types import (
# transport_from_addr as transport_from_addr,
# transport_from_stream as transport_from_stream,
# )
'''
from ._chan import (
_connect_chan as _connect_chan,
Channel as Channel
)
# if platform.system() == 'Linux':
# from ._linux import (
# EFD_SEMAPHORE as EFD_SEMAPHORE,
# EFD_CLOEXEC as EFD_CLOEXEC,
# EFD_NONBLOCK as EFD_NONBLOCK,
# open_eventfd as open_eventfd,
# write_eventfd as write_eventfd,
# read_eventfd as read_eventfd,
# close_eventfd as close_eventfd,
# EventFD as EventFD,
# )
# from ._ringbuf import (
# RBToken as RBToken,
# RingBuffSender as RingBuffSender,
# RingBuffReceiver as RingBuffReceiver,
# open_ringbuf as open_ringbuf
# )