Release: safenetChat - python console app running on safe

here we go with the ‘release’ of crappychat reloaded :smiley:

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 :grin:

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 … :man_shrugging: 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) :smiley:

remember to whitelist your IP - then you can just:

safenetChat

and you should see the shiny new example app:

  • hitting enter without message refreshes

  • exit ends the chat

  • [hitting enter] after input sends the message

reason you don't even need to start the browser or authenticate anything

(as you can see in the code: https://github.com/rid-dim/pySafe/blob/dev/crappyChat_reloaded_commandLine.ipynb it just uses a hard coded granted authentication and a hard coded mutable where every entry is one message :smiley: )

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 :slight_smile: ]

ps: i completely forgot to mention the chats mutable data: safe://f017016209759859bf90755eb2d8a246b7c022a71520116d57efd659f1c649fb8a598f05e:777 - remember to turn on the experimental features to look at it

41 Likes

Works great and Less filling!

4 Likes

and just to state the obvious :smiley: 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 :slight_smile:

[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 …]

2 Likes

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…’.

1 Like

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 … :thinking:

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

2 Likes

Well done @riddim!! I haven’t tried it myself yet but decided to watch your conversations at least :smiley:

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

9 Likes

Exactly =D it’s a brand new account but once the put limit is reached the chat will be useless :grin:
It’s a throwaway-chat :face_with_monocle: :hugs:

(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 :slight_smile: ]

8 Likes

my alert on “crappychat” just bleeped !

Trying right now, I want to be part of the History too

2 Likes

That works very nicely here ( linux fedora 28 , python 3.6.8 )

I just had to use :

pip3 install safenet --user

so that it complies with my messy python installation.

Congrats and thank you for making this, it is really cool to see some live action on the network :+1:

6 Likes

Not working for me yet unf. (Ubuntu 18.10)

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)” :grimacing:

Given the first install may have worked, where should I look for the safenetChat command?

3 Likes

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

1 Like

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
2 Likes

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

No worries, I found it in .local/bin/safenetChat and have now chatted! :smile:

Awesome stuff @riddim and @dask!

I’ve manually added .local/bin to by PATH in .profile

5 Likes

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
1 Like

Hmm then your python version is not 3.6 or above - the f strings are a relatively new feature but very very handy :face_with_monocle:

1 Like

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 )

big thumbs up for @riddim and @dask

4 Likes

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.

5 Likes