[PEAK] Keyword "as" in RuleDispatch

PJ Eby pje at telecommunity.com
Wed Oct 7 12:26:16 EDT 2015


peak.util.Graph is actually a dead import, so that's trivial to fix.
However, peak.web, peak.security.rules, and peak.binding all make
fairly deep uses of RuleDispatch and rely on its ability to work with
PyProtocols, not to mention its internals (like dispatching
strategies).  It should be possible to make PEAK-Rules support
PyProtocols in a relatively straightforward manner, but it's not clear
to me where that code would live, unless it's within PEAK itself.
Even then, replacements for the internals usage would need to be
found, and I'm afraid of breaking things in the event there is anybody
else using any of it.

I think it's probably going to not happen; these days I work with
CoffeeScript and Node more than I do Python.  (Heck, I work more with
freakin' PHP these days than I do Python!)  Fixing the Twisted support
for signals is something I can probably carve out some time to do, and
the binding.Obtain issue.  But just taking the time to remind myself
of how all the 10-year-old stuff in PyProtocols and RuleDispatch works
would be a pretty big project.


On Wed, Oct 7, 2015 at 4:26 AM, Alexey Smishlayev <alexey at xtech2.lv> wrote:
> I see that RuleDispatch ("import dispatch") is used in
> peak.binding.attributes and peak.util.Graph. What activities would be
> necessary to port this code to PEAK-Rules and therefore replace the
> RuleDispatch dependency in the main package?
> I am considering making this contribution.
>
>
> Regards,
> Alexey
>
>
> On 06/10/15 18:57, PJ Eby wrote:
>>
>> Yes, you do need to install it.  Make sure you install
>> 0.5a1.dev-r2717, as that is the version with 2.7 support.  PEAK itself
>> has not been ported to using PEAK-Rules yet, and it's rather unlikely
>> it will ever be.  (You are free to continue using RuleDispatch, of
>> course; the current version does in fact have 2.7 support.  I forgot
>> that we put that in already.)
>>
>> On Tue, Oct 6, 2015 at 8:34 AM, Alexey Smishlayev <alexey at xtech2.lv>
>> wrote:
>>>
>>> Thank you for the suggestion!
>>>
>>> What would be the correct way to install PEAK + PEAK-Rules?
>>> I did:
>>> $ sudo pip install
>>> http://peak.telecommunity.com/snapshots/PEAK-Rules-0.5a1.dev-r2713.tar.gz
>>> [...]
>>> $ sudo pip install
>>> http://peak.telecommunity.com/snapshots/PEAK-0.5a4.dev-r2486.tar.gz
>>> Downloading/unpacking
>>> http://peak.telecommunity.com/snapshots/PEAK-0.5a4.dev-r2486.tar.gz
>>>    Downloading PEAK-0.5a4.dev-r2486.tar.gz (1.0MB): 1.0MB downloaded
>>>    Running setup.py (path:/tmp/pip-pEff4R-build/setup.py) egg_info for
>>> package from
>>> http://peak.telecommunity.com/snapshots/PEAK-0.5a4.dev-r2486.tar.gz
>>>
>>> Downloading/unpacking RuleDispatch>=0.5a0dev-r2287 (from
>>> PEAK==0.5a4.dev-r2486)
>>>    Could not find any downloads that satisfy the requirement
>>> RuleDispatch>=0.5a0dev-r2287 (from PEAK==0.5a4.dev-r2486)
>>> Cleaning up...
>>> No distributions at all found for RuleDispatch>=0.5a0dev-r2287 (from
>>> PEAK==0.5a4.dev-r2486)
>>>
>>>
>>> Do I still have to install RuleDispatch, even if I don't use it?
>>>
>>>
>>> Best regards,
>>> Alexey
>>>
>>>
>>>
>>> On 2015.10.03. 02:13, PJ Eby wrote:
>>>>
>>>> Ruledispatch had support dropped many years ago; PEAK-Rules has a
>>>> RuleDispatch emulation API that addresses the 'as' issue.  See
>>>>
>>>>
>>>> http://peak.telecommunity.com/DevCenter/PEAK-Rules#porting-code-from-ruledispatch
>>>> for details.
>>>>
>>>> On Fri, Oct 2, 2015 at 3:34 AM, Alexey Smishlayev <alexey at xtech2.lv>
>>>> wrote:
>>>>>
>>>>> Hello!
>>>>>
>>>>> In the RuleDispatch package (I use most recent dev snapshot
>>>>>
>>>>>
>>>>> http://peak.telecommunity.com/snapshots/RuleDispatch-0.5a1.dev-r2717.tar.gz,
>>>>> file src/dispatch/__init__.py, line 22) a global name "as" is set,
>>>>> which
>>>>> is
>>>>> a reserved keyword in Python 2.7. That makes the package unusable, so I
>>>>> have
>>>>> to patch it locally every time I do an install.
>>>>>
>>>>> Is that an expected behavior or maybe there are other ways to deals
>>>>> with
>>>>> the
>>>>> problem?
>>>>>
>>>>>
>>>>> Best regards,
>>>>> Alexey Smishlayev
>>>>> _______________________________________________
>>>>> PEAK mailing list
>>>>> PEAK at eby-sarna.com
>>>>> http://www.eby-sarna.com/mailman/listinfo/peak
>>>
>>>
>


More information about the PEAK mailing list