here we go with the ‘release’ of crappychat reloaded
to be honest it’s more the release of the first version of a python library for SAFE but since it’s a super simple example app it’s the release of it too
installation instructions:
[i assume you have a computer with python(>=3.6) installed]
pip install safenet
if that fails (seems to only work on linux atm - sorry)
(it might be you don’t have a properly installed python environment and need to ‘sudo apt install python-pip3’ or use ‘pip3 install safenet’ if you’re running linux (and reboot/logout after freshly installing pip) - and on windows … sorry i don’t do windows …)
as @draw found out it might be necessary to install other dependencies as well:
this will install pySafe which automatically exposes crappyChat with its new Name safenetChat (to look a bit more serious and for easier discovery with autocompletion since it starts with safe)
remember to whitelist your IP - then you can just:
i hope there are people out there in the mood to try it and since pySafe is still in a very early stage it’s not capable of doing super impressive and a lot of stuff but it’s a start =)
feel free to just join @dask and me and just add improvements
just open pull requests to either dasks or my repository
(we’ll move pySafe to a more official repo as soon as the package is more mature and comes with a full feature-set of functions)
[maybe it’s worth mentioning that the package is programmed in a way that the switch from mutable to appendable data shouldn’t come with large changes for us - so all work invested by us and others for creating more high level functions will be very valuable and help us to have a powerful library soon ]
ps: i completely forgot to mention the chats mutable data: safe://f017016209759859bf90755eb2d8a246b7c022a71520116d57efd659f1c649fb8a598f05e:777 - remember to turn on the experimental features to look at it
and just to state the obvious from this release i guess everyone knowing python can expand the library; no need to know any details on the C-API anymore and how to deal with callbacks and c data types - it’s just objects in python and you need to chain them in a reasonable way to create an app
[yes there are some c types still used in the api - but just objects that get returned and are dropped into the functions again - no data manipulation or creation or so …]
Cool!
On Linux Mint 19.1 it works, after first installing python3-pip, python3-setuptools and python3-wheel. I did get a segmentation fault with ‘pip3 install safenet’, but that was at ‘Cleaning up…’.
hmmmmmm - okay - i use anaconda environments and there the whole python2/3-thing is not an issue because you specify it on creating the environment…
cool you found out what you needed to get it running!!!
@dask might have an idea where that segmentation fault might come from … he has more experience with building packages than me …
Ps: and just like the chat an alternative authenticator with json rpc server can easily be exposed once the library is further developed - or a command line authenticator process (similar to the auth_cli) or a full launcher offering a simple rest api for all the yet unsupported languages… Just to mention possibilities for future development
Edit: I’d suggest, if I may, you remove the hardcoded credentials, use the safe_auth webservice to authorise it, and add Insert permission to the MD for ANYONE
Exactly =D it’s a brand new account but once the put limit is reached the chat will be useless
It’s a throwaway-chat
(sorry I would have answered through safe but don’t have a computer with me atm…)
Making another example where everyone can answer from their own puts is a nice idea too!
[we have a easy strategy for using the standard authenticator (creating a local server and returning the answer from a second script) so using the CLI webservice is a nice additional option but not something the python lib will depend on ]
I have both python 2.7 and 3.6 installed and so did:
pip3 install safenet --user
That seems ok except for about ten messages spread through the Collecting/Downloading output, saying Cache entry deserialization failed, entry ignored
On completion typing safenetChat gives ‘command not found’.
I tried again with:
pip3 install safenet # Without --user
This proceeded fast (using the cached packages), didn’t give the deserialization errors, but after “Successfully installed…” I got “Segmentation fault (core dumped)”
Given the first install may have worked, where should I look for the safenetChat command?
you could try : ~/.local/bin/safenetChat
it could be that the installation put it here instead of somewhere where you have PATH defined.
That was the case for me anyways
Sorry no PC here sadly… For salvorin the solution was a simple reboot (since he didn’t have pip3 installed in advance and somehow it didn’t reload the path file or so…)
Hmhmm but the segmentation fault then seems to be more common than hoped…
Or maybe just relogin, so that it becomes part of the path.
I had the same issue and I see that this dir was only created when I did the ‘pip3 install safenet’ and I see in ~/.profile (which is sourced when you login):
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Hmm - and @happybeing if you know where your python installation resides you should be able to just do ‘python3 /pathToPythonPackages/safenet/crappychat_reloaded_commanLine.py’ since it’s just a regular python script and with installed safenet package it should run as expected
I also got the segv when installing, but apart from that I get the following type of errors, it seems it doesn’t like the f prefix in each of the logger.debug(f'...') statements
$ ~/.local/bin/safenetChat
Traceback (most recent call last):
File "/home/bochaco/.local/bin/safenetChat", line 7, in <module>
from safenet import crappyChat_reloaded_commandLine
File "/home/bochaco/.local/lib/python3.5/site-packages/safenet/__init__.py", line 19, in <module>
from safenet.log_util import setup_logger, log
File "/home/bochaco/.local/lib/python3.5/site-packages/safenet/log_util.py", line 121
logger.debug(f'logger initialized. File: {enable_file}, Stream: {enable_stream}')
^
SyntaxError: invalid syntax
having fun with the pySafe examples , I managed to create a mutable and put funny stuff in it :
safe://f017016203be7d9d1706b2565849fd68d0e126225fe078504b9c69812180aa456570fad4c:6666 ( needs experimental turned on )
Glad to see people having fun with it. If f strings are causing too many issues, then we could consider changing them, but they really are very handy. I think we also use some yield from statements.
I’ll look into the segfaults. Can think of a few things, especially because the headers were updated, so maybe the compiled lib is a step out of date for windows.
Otherwise, a few improvements that will really help usability are on the way.