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

fix Using RPyC and property decorator to set a value via a setter method on remote host #518

Closed
wants to merge 414 commits into from

Conversation

achrafka
Copy link

@achrafka achrafka commented Dec 4, 2022

this is a fix for the issue #504 now we can set attribute when adding a config "allow_setattr"

coldfix and others added 30 commits May 21, 2018 16:16
This release brings a few minor backward incompatibilities, so be sure to read
on before upgrading. However, fear not: the ones that are most likely relevant
to you have a relatively simple migration path.

Backward Incompatibilities
^^^^^^^^^^^^^^^^^^^^^^^^^^

* ``classic.teleport_function`` now executes the function in the connection's
  namespace by default. To get the old behaviour, use
  ``teleport_function(conn, func, conn.modules[func.__module__].__dict__)``
  instead.

* Changed signature of ``Service.on_connect`` and ``on_disconnect``, adding
  the connection as argument.

* Changed signature of ``Service.__init__``, removing the connection argument

* no longer store connection as ``self._conn``. (allows services that serve
  multiple clients using the same service object, see `tomerfiliba-org#198`_).

* ``SlaveService`` is now split into two asymetric classes: ``SlaveService``
  and ``MasterService``. The slave exposes functionality to the master but can
  not anymore access remote objects on the master (`tomerfiliba-org#232`_, `tomerfiliba-org#248`_).
  If you were previously using ``SlaveService``, you may experience problems
  when feeding the slave with netrefs to objects on the master. In this case, do
  any of the following:

  * use ``ClassicService`` (acts exactly like the old ``SlaveService``)
  * use ``SlaveService`` with a ``config`` that allows attribute access etc
  * use ``rpyc.utils.deliver`` to feed copies rather than netrefs to
    the slave

* ``RegistryServer.on_service_removed`` is once again called whenever a service
  instance is removed, making it symmetric to ``on_service_added`` (`tomerfiliba-org#238`_)
  This reverts PR `tomerfiliba-org#173`_ on issue `tomerfiliba-org#172`_.

* Removed module ``rpyc.experimental.splitbrain``. It's too confusing and
  undocumented for me and I won't be developing it, so better remove it
  altogether. (It's still available in the ``splitbrain`` branch)

* Removed module ``rpyc.experimental.retunnel``. Seemingly unused anywhere, no
  documentation, no clue what this is about.

* ``bin/rpyc_classic.py`` will bind to ``127.0.0.1`` instead of ``0.0.0.0`` by
  default

* ``SlaveService`` no longer serves exposed attributes (i.e., it now uses
  ``allow_exposed_attrs=False``)

* Exposed attributes no longer hide plain attributes if one otherwise has the
  required permissions to access the plain attribute. (`tomerfiliba-org#165`_)

.. _#165: tomerfiliba-org#165
.. _#172: tomerfiliba-org#172
.. _#173: tomerfiliba-org#173
.. _#198: tomerfiliba-org#198
.. _#232: tomerfiliba-org#232
.. _#238: tomerfiliba-org#238
.. _#248: tomerfiliba-org#248

What else is new
^^^^^^^^^^^^^^^^

* teleported functions will now be defined by default in the globals dict

* Can now explicitly specify globals for teleported functions

* Can now use streams as context manager

* keep a hard reference to connection in netrefs, may fix some ``EOFError``
  issues, in particular on Jython related (`tomerfiliba-org#237`_)

* handle synchronous and asynchronous requests uniformly

* fix deadlock with connections talking to each other multithreadedly (`tomerfiliba-org#270`_)

* handle timeouts cumulatively

* fix possible performance bug in ``Win32PipeStream.poll`` (oversleeping)

* use readthedocs theme for documentation (`tomerfiliba-org#269`_)

* actually time out sync requests (`tomerfiliba-org#264`_)

* clarify documentation concerning exceptions in ``Connection.ping`` (`tomerfiliba-org#265`_)

* fix ``__hash__`` for netrefs (`tomerfiliba-org#267`_, `tomerfiliba-org#268`_)

* rename ``async`` module to ``async_`` for py37 compatibility (`tomerfiliba-org#253`_)

* fix ``deliver()`` from IronPython to CPython2 (`tomerfiliba-org#251`_)

* fix brine string handling in py2 IronPython (`tomerfiliba-org#251`_)

* add gevent_ Server. For now, this requires using ``gevent.monkey.patch_all()``
  before importing for rpyc. Client connections can already be made without
  further changes to rpyc, just using gevent's monkey patching. (`tomerfiliba-org#146`_)

* add function ``rpyc.lib.spawn`` to spawn daemon threads

* fix several bugs in ``bin/rpycd.py`` that crashed this script on startup
  (`tomerfiliba-org#231`_)

* fix problem with MongoDB, or more generally any remote objects that have a
  *catch-all* ``__getattr__`` (`tomerfiliba-org#165`_)

* fix bug when copying remote numpy arrays (`tomerfiliba-org#236`_)

* added ``rpyc.utils.helpers.classpartial`` to bind arguments to services (`tomerfiliba-org#244`_)

* can now pass services optionally as instance or class (could only pass as
  class, `tomerfiliba-org#244`_)

* The service is now charged with setting up the connection, doing so in
  ``Service._connect``. This allows using custom protocols by e.g. subclassing
  ``Connection``.  More discussions and related features in `tomerfiliba-org#239`_-`tomerfiliba-org#247`_.

* service can now easily override protocol handlers, by updating
  ``conn._HANDLERS`` in ``_connect`` or ``on_connect``. For example:
  ``conn._HANDLERS[HANDLE_GETATTR] = self._handle_getattr``.

* most protocol handlers (``Connection._handle_XXX``) now directly get the
  object rather than its ID as first argument. This makes overriding
  individual handlers feel much more high-level. And by the way it turns out
  that this fixes two long-standing issues (`tomerfiliba-org#137`_, `tomerfiliba-org#153`_)

* fix bug with proxying context managers (`tomerfiliba-org#228`_)

* expose server classes from ``rpyc`` top level module

* fix logger issue on jython

.. _#137: tomerfiliba-org#137
.. _#146: tomerfiliba-org#146
.. _#153: tomerfiliba-org#153
.. _#165: tomerfiliba-org#165
.. _#228: tomerfiliba-org#228
.. _#231: tomerfiliba-org#231
.. _#236: tomerfiliba-org#236
.. _#237: tomerfiliba-org#237
.. _#239: tomerfiliba-org#239
.. _#244: tomerfiliba-org#244
.. _#247: tomerfiliba-org#247
.. _#251: tomerfiliba-org#251
.. _#253: tomerfiliba-org#253
.. _#264: tomerfiliba-org#264
.. _#265: tomerfiliba-org#265
.. _#267: tomerfiliba-org#267
.. _#268: tomerfiliba-org#268
.. _#269: tomerfiliba-org#269
.. _#270: tomerfiliba-org#270

.. _gevent: http://www.gevent.org/
This is now handled by `plumbum` (specifically `SshMachine.tunnel`). For
an example see zerodeploy documentation and module.

Closes tomerfiliba-org#274
- fix ValueError during install due to absolute PATH in SOURCES.txt (`tomerfiliba-org#276`_)

.. _#276: tomerfiliba-org#276
- fix default hostname for ipv6 in rpyc_classic.py (tomerfiliba-org#277)
- fix ThreadPoolServer not working (tomerfiliba-org#283)
Fix missing parameters / typos in documentation
This reverts commit bd8b560.

It turns out this commit breaks hashing netrefs for classes:

    >>> c = rpyc.classic.connect("localhost")

    >>> hash(c.modules.numpy.array([0]).__class__)
    ...
    TypeError: 'NoneType' object is not callable

    >>> hash(c.modules.numpy.array([0]).__class__.__mro__[1])
    TypeError: descriptor '__hash__' of 'object' object needs an argument
thomas-brandeho and others added 26 commits April 30, 2021 17:32
Prevent auto_register in Server from being wrongly set to False
…ension field; added note to say where documentation/examples could be found
…ce the change was not necessary; fixed style for docker-compose.yml
fix utils.authenticators import on platforms without ssl
Added command on Registry to list all known services
…pyc.list_services to be consistent with rpyc.discover
…consistent formatting string syntax for RPyC
…consistent formatting string syntax for RPyC -- ./tests
…consistent formatting string syntax for RPyC -- ./rpyc/core
…consistent formatting string syntax for RPyC -- ./rpyc/utils
… f-strings to improve readability and have consistent formatting string syntax for RPyC -- rpyc/lib/__init__.py
…already evaluate the expression to see if it is true
@achrafka achrafka closed this Dec 4, 2022
@achrafka achrafka deleted the fix_setattr branch December 4, 2022 18:25
@achrafka achrafka restored the fix_setattr branch December 4, 2022 18:25
@achrafka achrafka deleted the fix_setattr branch December 4, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet