Compare commits

..

1 Commits

Author SHA1 Message Date
Tyler Goodlet c9e9a3949f 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-08 10:09:52 -04:00
2 changed files with 8 additions and 36 deletions

View File

@ -2,14 +2,17 @@ import time
import trio import trio
import pytest import pytest
import tractor import tractor
from tractor.ipc import ( from tractor.ipc._ringbuf import (
open_ringbuf, open_ringbuf,
RBToken, RBToken,
RingBuffSender, RingBuffSender,
RingBuffReceiver 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! # in case you don't want to melt your cores, uncomment dis!
pytestmark = pytest.mark.skip pytestmark = pytest.mark.skip

View File

@ -13,43 +13,12 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# import platform
# from ._transport import ( '''
# MsgTransportKey as MsgTransportKey, A modular IPC layer supporting the power of cross-process SC!
# 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 ( from ._chan import (
_connect_chan as _connect_chan, _connect_chan as _connect_chan,
Channel as Channel 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
# )