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

Standardize library path #1182

Open
maxux opened this issue Sep 15, 2020 · 1 comment
Open

Standardize library path #1182

maxux opened this issue Sep 15, 2020 · 1 comment

Comments

@maxux
Copy link
Contributor

maxux commented Sep 15, 2020

Configuration files are stored at ~/.config/jumpscale which is good standard.
But then you have ~/sandbox which is completely wrong.

Jumpscale library code, etc. should be installed at ~/.local/lib (and ~/.local/bin for binaries, if any).
This would completely standardize files path and looks more like real unix package :)

@xmonader
Copy link
Collaborator

xmonader commented Sep 16, 2020

I agree with that for sure, let's try to follow https://www.freedesktop.org/software/systemd/man/file-hierarchy.html as much as we can.

Here's the current implementation of j.dirs

class Dirs:

    HOMEDIR = os.path.expanduser("~")  # TODO: check homedir defined in sal.fs
    BASEDIR = os.path.join(HOMEDIR, "sandbox")
    BINDIR = os.path.join(BASEDIR, "bin")
    CFGDIR = os.path.join(BASEDIR, "cfg")  # TODO: check conflict with core.config_root..
    CODEDIR = os.path.join(BASEDIR, "code")
    VARDIR = os.path.join(BASEDIR, "var")
    LOGDIR = os.path.join(VARDIR, "log")
    JSCFGDIR = os.path.join(HOMEDIR, ".config/jumpscale")
    TEMPLATEDIR = os.path.join(VARDIR, "templates")
    TMPDIR = "/tmp/jumpscale"

I think when revisiting we need to consider the following

  • we don't need TEMPLATEDIR anymore I think
  • better we introduce CACHEDIR (for downloads we do instead of ~/sandbox/var/downloaded_packages/) or should be ~/.jumpscale/var/downloaded_packages
  • ~/.local/lib/jumpscale ideally would have been used if we have some vendor data (right now that's completely managed by virtualenv, and when installing using pip it will use the /usr/lib or ~/.local/lib to install the deps
  • CODEDIR by convention is ~/sandbox/code which we depend on in the git sal for cloning repos and that we can't have an a hidden directory, so we either introduce ~/code or ~/sandbox/code to the user filesystem, but if we are to introduce directories, then maybe ~/sandbox would serve us better as we can use it for transient configs, logs, .. etc as well
  • apps configurations (e.g nginx, redis, .. etc) I think they should go under some directory maybe ~/.config/jumpscale/etc, but here it raises a problem what if we want to discard that dir for wrong configurations or regenerate everytime e.g in case of something dynamic like nginx? this directory ~/.config/jumpscale is backed up by convention and if something wrong you won't be able to have a successful restore
  • Some apps e.g zoom, komodo, thunderbird some their config/logs in $HOME/.$appname, so maybe ~/.jumpscale/{etc,cfg,var,logs,cache} can be used for logs or then maybe it's okay to have sandbox dir~/sandbox/{etc,cfg,var,logs,cache}, and transient configs, logs and caching?
➜  ~ ls ~/.zoom 
data  im  logs  reports  screenCapture  shareItems
➜  ~ ls .thunderbird 
'Crash Reports'   i676rnyr.default  'Pending Pings'   profiles.ini
➜  ~ ls ~/.kiki 
kikicfg.py
➜  ~ ls ~/.komodoide 
12.0
➜  ~ ls ~/.komodoide/12.0/
autosave            codeintel3.log  history.sqlite.bak    prefs.xmlc    samples          tools
breakpoints.pickle  colors.less     interfaceChrome.less  pystderr.log  schemes          userChrome.less
classic.less        doc-state.xmlc  mutex.lock            pystdout.log  startup-env.tmp  view-state.xmlc
codeintel3.db       history.sqlite  prefs.xml             running.lock  toolbox.sqlite   XRE

if we are going to create ~/.jumpscale directory, wouldn't that be confused with configs of ~/.config/jumpscale or we merge both in ~/.jumpscale. What do you think @maxux?

@rkhamis rkhamis added this to the next milestone Dec 24, 2020
@xmonader xmonader modified the milestones: next, later Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants