Package: emi
Eons Modular InterfaceUse the Eons Modular Interface (EMI) to configure systems.EMI is a state manager that uses theEons python libraryby executing arbitrary actions which are provided by the repository (per Eons).The default repository ishttps://infrastructure.tech.This meansemi install a_packagewill execute the "install" action and provide it with the arguments "a_package".Basically, we're iterating on the tried-and-true universal install script:Installationpip install emiUsageEmi is a state manager; it establishes reproducibility. This means that if emi reports that 2 systems are identical (and has not been subverted), those 2 systems will behave the same.Use emi to change the state of a system. This change will be recorded for later comparison. This is similar to your bash history: you'll be able to look through what you did and replicate that work later on or on another machine.Emi should behave as a typical package manager: you caninstall,updateandremovepackages. Plus, a whole lot more ;)Emi uses the current user's home directory to store configuration and data relating to operations (e.g. what packages at what versions have been installed where).Because emi is built on Eons, the actions you request do not have to be installed prior: anything not found in your home directory will be automatically downloaded for you.VerbiageEmi makes use of 2 metaphors: commerce for actions and library science for data.MerxActions intended for use with emi will be labeled as "Merx". This derives from latin: "emi Merx" is roughly "I bought the goods", Merx being goods or wares. In this case any "goods" available for "purchase" may be "bought" (e.g. downloaded; there is no exchange of currency in emi, only information) by emi.A Merx may be invoked through itsTransaction()method, which is called by itsFunction()(perEons.Functor; meaningMerx()callsMerx.Transaction()).Transaction()is what you'll want to override when creating your own Merx.NOTE: you'll also want to override theMerx.Rollback()method for when things go wrong.TomesPackages intended for use in Merx are called "Tomes", i.e. semantically heavy symbols. "heavy" here alludes to the fact that Tomes and what they act upon may contain multiple libraries. However, each Tome, be it a library itself, a set of binaries, or even just a simple environment variable, is still referenced by emi as a single symbol (i.e. name).A Tome on the default repository will typically be a zip containing directories like "bin", "inc", "lib", etc. It is up to the package maintainer to adhere to these standards or to be consistent in their own (e.g. for use with their own Merx). Each maintainer is likewise responsible for ensuring their Tome's cross-platform viability and documentation.To restate the above,emi install a_package, when using the default install script and repo through Eons, will generate 2 requests:merx_installwill be downloaded and placed in~/.eons/merx/install.py.tome_a_packagewill be downloaded to~/.eons/tmp/a_package/and used as an arg in theinstall.pyMerx.Transaction().EBBSis used to build Tomes; EMI is used to install them. Actions intended for use in ebbs are called "Builders"; actions intended for use in EMI are called Merx.Merx, as a noun, rather than the typical verb (the same as "installation" vs "install", "removal" vs "remove", etc.) can be rationalized as a requested change. For example, the emi analogy follows that a merchant would "sell you a change" in your system, provided that you give them the knowledge of how to do that (i.e. the Tomes). This is like asking a contractor to build a new room onto yourhouse, only the contractor would need to know the blueprint for the room ahead of time and have all the materials accessible.Argumentsemi merx1/merx2 tome1 tome2 tome3 --extra argsEmi allows for args to be used in multiple ways. You can supply as many Tomes as you would like (including none); you can also supply extra arguments as provided by Eons (e.g.--extra-arg value).Everything beyond the Merx (first arg), which is not preceded by '--', is made available to the Merx as a Tome. However, once '--' is found, all remaining arguments are interpreted as key-value pairs that are available in theexecutor.extraArgsand thus can beFetch()ed. This behavior is identical to EBBS and other Eons implementations except that the Merx and Tomes come before any extra arguments.It is up to the Merx to decide what to do with the Tomes it is given. Usually, multiple args past the 2nd (and before extra args) equate to multiple packages to install, remove, etc. but that is only convention and in now way required. A Merx could interpret a series of Tomes as a series of actions to execute in sequence or anything else it would like.It is always preferred to have many different, interacting Merx than to have a single Merx with many options (i.e. modules are preferred over monoliths). For example,apt install -yin proper emi style would be rewritten asapt auto-installor, even betterapt auto/install. Eons makes it possible to execute Functors in sequence. Emi uses this system to evaluate a series of Merx that you can specify by separating each with a '/'. Emi only takes a single "merx" argument, but you can use that to execute as many Merx as you'd like. For example, we could haveemi install ...,emi auto/install ..., or evenemi selective/auto/install .... This relies on the Eons sequence mechanics to enableautoto change the behavior ofinstall,selectiveto change the behavior of bothautoandinstall, etc. You can pass both members (variables) and methods (functions) this way; thus, your Merx can be as modular as your heart desires! Of course, you can also choose to use extra arguments to augment your Merx;emi install ... --auto trueis just as valid.The only difference betweenauto/installandinstall ... --auto true(besides the latter being longer to type) is extensibility. When usinginstall ... --auto true, theautokeyword should exist as anoptionalKWArgin some base class ofinstall, and your other Merx should inherit from that base class as well. Using a common base class helps create consistency. On the other hand,auto/installusesthe Eons Implicit Inheritance systemto endowinstallwith functionality fromauto. This means that, if you design your classes to properly use Implicit Inheritance, you don't have to create consistency by managing inheritance (or multiple inheritance) yourself, nor would you have to refactor your code to add features from a third party Merx. Instead, you'd just have to start typing that third party Merx before yours and off you'd go! Ultimately, Implicit Inheritance is Ra tool to make your life and the life of your users easier. If you find this system to be confusing or cumbersome, just add____KWArgsto your Merx and have your users supply additional cli arguments.DirectoriesEmi will attempt to use the best directory for the current user by first testing access to common system directories (i.e. check for admin privileges). If a Tome can be written to a system directory for use by all users, it will be. Otherwise, the Tome will be written to~/.eons/. This behavior can be overwritten by specifying..._pathin the config (see below), where...is whichever path you'd like to override (e.g.bin_path,inc_path,lib_path, etc.).All other data, including the config file and database are stored in~/.eons/.WINDOWS USERS: You must set all..._pathsin your config.json or rely only on local user installations (i.e. in the~/.Eons/folder). Automatic support for system path discovery on Windows may be added in a future release.MerxAll Merx are placed in~/.eons/merx. These are saved indefinitely.
You can also create your own Merx in that directory, and they will be automatically usable by emi. The~/.Eons/merxdirectory is theeons.Executor.repo.store, i.e. where the self-registering functors for emi (the Merx) are kept.TomesTomes are downloaded to~/.eons/tmp. Currently, these are saved indefinitely but that will be changed in a future release. The idea is that a Merx should move the contents of the Tome to the appropriate location in the filesystem and record that location in the database (see below).ConfigurationEmi uses the default config file~/.eons/config.json. While this can be overridden, it is much preferred to leave it as is.This configuration file is used for alleons.Executor.Fetch()calls, which means any Merx thatFetch()s a value can find it in this config.DatabaseEmi uses aSQLitedatabase to keep track of all Merx transaction and the locations of all Tomes.This database is stored in~/.eons/catalog.db.All columns which can have multiple entries will be semicolon delimited.TomesA record of all Tomes is kept in thetomestable:NameData TypeNot NULLidINTEGERtruenameVARCHARfalseversionVARCHARfalseinstalled_atVARCHARfalseretrieved_fromVARCHARfalsefirst_retrieved_onFLOATfalselast_retrieved_onFLOATfalseadditional_notesVARCHARfalseTransactionsEverytime emi is invoked, it will record the Transaction it executes.
These data are stored in thetransactionstable:NameData TypeNot NULLidINTEGERtruewhenFLOATfalsemerxVARCHARfalsetomesVARCHARfalseresultINTEGERfalseRepositoryOnline repository settings can be specified with:--repo-store (default = ./eons/)
--repo-url (default = https://api.infrastructure.tech/v1/package)
--repo-username
--repo-passwordKeep in mind thatemi --repo-store ... merx1/merx2 tomeson the command line is equivalent to having"repo_store": "..."in the ~/.eons/config.json and callingemi merx1/merx2 tomes.
Please don't store your credentials in the config.NOTE: you do not need to supply any repo settings to download packages from the public repository.
For more info on the repo integration, seethe Eons library