rkhamis / reparo Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
secrets mgmt solution #3
minimal or 0 autoloading #1
pip installable packages
core
data manipulation
sals:
servers/
TBD
tools/
clients:
What are the core functionalities provided by jumpscale?
We can use namespaces the way zope
does with zope.interface for example.
Now we can easily have jumpscale.sal
, jumpscale.clients
easily separated into there own pip packages like any normal python project. (bye bye installtools!)
One of two ways
1- remove __init__.py
2- add namespace declaration in __init__.py
__import__('pkg_resources').declare_namespace(__name__)
Example structure
.
├── projectclients
│ └── jumpscale
│ ├── clients
│ │ ├── github.py
│ │ ├── gogs.py
│ │ ├── __init__.py
│ ├── __init__.py
├── projectmain
│ └── jumpscale
│ ├── god.py
│ ├── __init__.py
├── projectsals
│ └── jumpscale
│ ├── __init__.py
│ └── sal
│ ├── fs.py
│ ├── __init__.py
└── projecttools
└── jumpscale
├── __init__.py
└── tools
├── __init__.py
└── sync.py
jumpscale by design wants the least amount of imports thats why all are registered under j
e.g for sal/__init__.py
import pkgutil
__all__ = []
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
__all__.append(module_name)
_module = loader.find_module(module_name).load_module(module_name)
globals()[module_name] = _module
CHECK: lazyloader/import hooks in stdpython
https://docs.python.org/3/library/importlib.html#importlib.util.LazyLoader
Solved by design using python modules
If we open god.py
import jumpscale.sal
import jumpscale.tools
import jumpscale.clients
j = jumpscale
we have handcrafted imports for sal, tools, clients so their subpackages can be autoloaded, but how should it work with packages like digitalme
Do we generate import jumpscale.digitalme
? is there a standard python way to do it? a reliable plugin system?
for instance there might be digitalme.tools
should it be under j.tools
directly or j.digitalme.tools
? I prefer the latter for clarity and conflict resolution too
~> export PYTHONPATH="projecttools:projectsals:projectclients:projectmain"
In [1]: import jumpscale.god
In [2]: jumpscale.sal.fs.copyfile('a', 'b')
copying file
In [3]: jumpscale.tools.sync.sync()
sync tool
In [4]: jumpscale.clients.github.get_githubclient?
Signature: jumpscale.clients.github.get_githubclient(username, password)
Docstring: <no docstring>
File: ~/wspace/jumpscale-skeleton/projectclients/jumpscale/clients/github.py
Type: function
In [5]: jumpscale.clients.github.get_githubclient('a', 'bb')
getting client with a bb
In [6]: jumpscale.clients.gogs.get_gogs('a', 'bbb') # uses jumpscale sal.fs in its code
sync tool
getting gogs client with a bbb
j
In [1]: from jumpscale.god import j
In [2]: j.sal.fs.removefile('a')
removing file
In [3]: j.clients.gogs.get_gogs('a', 'b')
sync tool
getting gogs client with a b
jumpscale is meant to be used by single
user to when it comes to using facilities that require credentials/secrets e.g github client requires a user and a token, mysql client requires a user and a password but anyhow these secrets shouldn't be exposed as plain text
requirements:
one of the pain points is the jumpscale dirs; with the proposed architecture most of them won't be needed at all
~/.config/jumpscale
~/.jumpscale
pathlib.Path.home()
"cross platform" or expanduser("~") on unix
for sandboxed systems: pip install X --user is enough to have contained packages relative to user
To be build a new Jumpscale framework that share the same features and ideas, we need to focus on the main core features of jumpscale and build the minimal working version with these feature.
The main components are:
things like jshell, synctool, etc can be managed using entrypoints console_script entry https://packaging.python.org/specifications/entry-points/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.