Skip to main content

objects

Project description

NAME

OBJX - objects

INSTALL

$ pipx install objx

SYNOPSIS

objx <cmd> [key=val]
objx <cmd> [key==val]
objx [-a] [-c] [-d] [-v]

DESCRIPTION

OBJX has all the python3 code to program a unix cli program, such as
disk perisistence for configuration files, event handler to
handle the client/server connection, code to introspect modules
for commands, deferred exception handling to not crash on an
error, a parser to parse commandline options and values, etc.

OBJX provides an objx namespace that allows for easy json save//load
to/from disk of objects. It provides an "clean namespace" Object class
that only has dunder methods, so the namespace is not cluttered with
method names. This makes storing and reading to/from json possible.

OBJX provides a demo bot, it can connect to IRC, fetch and display RSS
feeds, take todo notes, keep a shopping list and log text. You can also
copy/paste the service file and run it under systemd for 24/7 presence
in a IRC channel.

OBJX is Public Domain.

USAGE

without any argument the program does nothing

$ objx
$

see list of commands

$ objx cmd
cmd,err,mod,req,thr,ver

list of modules

$ objx mod
cmd,err,fnd,irc,log,mod,req,rss,tdo,thr

use mod=<name1,name2> to load additional modules

$ objx cfg mod=irc

start a console

$ objx -c mod=irc,rss
>

use -v for verbose

$ objx -cv mod=irc
OBJX started CV started Sat Dec 2 17:53:24 2023
>

start daemon

$ objd
$

CONFIGURATION

irc

$ objx cfg server=<server>
$ objx cfg channel=<channel>
$ objx cfg nick=<nick>

sasl

$ objx pwd <nsvnick> <nspass>
$ objx cfg password=<frompwd>

rss

$ objx rss <url>
$ objx dpl <url> <item1,item2>
$ objx rem <url>
$ objx nme <url> <name>

COMMANDS

cmd - commands
cfg - irc configuration
dlt - remove a user
dpl - sets display items
fnd - find objects
log - log some text
met - add a user
mre - displays cached output
pwd - sasl nickserv name/pass
rem - removes a rss feed
req - reconsider
rss - add a feed
thr - show the running threads

SYSTEMD

save the following it in /etc/systems/system/objx.service and replace “<user>” with the user running pipx

[Unit]
Description=objects daemon
Requires=network-online.target
After=network-online.target

[Service]
Type=simple
User=<user>
Group=<user>
WorkingDirectory=/home/<user>/.objx
ExecStart=/home/<user>/.local/pipx/venvs/objx/bin/objd
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

then run this

$ mkdir ~/.objx
$ sudo systemctl enable objx --now

default channel/server is #objx on localhost

CODE

>>> from objx import Object, read, write
>>> o = Object()
>>> o.a = "b"
>>> write(o, "test")
>>> oo = Object()
>>> read(oo, "test")
>>> oo
{"a": "b"}

FILES

~/.objx
~/.local/bin/objx
~/.local/bin/objd
~/.local/pipx/venvs/objx/

AUTHOR

Bart Thate <objx@proton.me>

COPYRIGHT

OBJX is Public Domain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

objx-32.tar.gz (22.4 kB view details)

Uploaded Source

File details

Details for the file objx-32.tar.gz.

File metadata

  • Download URL: objx-32.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for objx-32.tar.gz
Algorithm Hash digest
SHA256 781a2e37cc814881105e06684ff88e13bdf488c288d22db9de7e08fb8ac11c3e
MD5 994d97e89af25b60bdea827a81ca3351
BLAKE2b-256 3365cd02f2ae8155ee85aa7120f6b0b98c1ca970922fe0d11606cc9b7a1ba414

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page