Path/Project/Package/Session/History manager
MatVE is a tool that manages your matlab environment on a by-project basis. This means only including files, variables, and packages that are relevant to your projects.
MatVE is designed to be useable within minutes; 90% of its use is centered around only a few easy to remember commands, but it is also designed to be feature rich and very customizable if you so choose.
Configuration is centered around project directories. During installation, you are prompted for root projects directory where your various projects are kept. Any directory the root projects directory is considered its own project.
Post installation, use is straightforward:
> mve [command] [arguments]
Switching projects:
> mve cd [project name]
Leave out the project name, and MVE will spit out a list of available projects to choose from. This follows a consistent principle with MVE – if you don’t remember a command or argument, just ommit it and mve will describe your options
>> mve
mve
MatVirtualEnv command prompt interface
(See VE for developer integragtion [>> help VE])
Usage:
mve [command] [arguments]
Main commands:
mve help - see full list of commands
mve help [cmd] - get help for a command
mve cd - change to a project via prompt
mve cd [prj] - change project to project given name
mve ls [arg] - list details about a project, depndencies, env. variables, or MVE
mve pwd - list current project
mve reload - reload current project
mve config [type] - configure projects and MVE
mve new [prj] - create and switch to new project
> mve config
Valid arguments:
root Configure root. These options affect all projects, but overriden by etc
etc Configure project as end user. This is the highest level of configuration.
pkg Configure project as developer. These are overridden by all other options.
hook Configure project hook. This is a startup file for individual projects.
self Configure VE
In matlab run the following with brackets filled in:
cd [where you want MVE installed]
!git clone [email protected]:portalgun/MatVirtualEnv.git
cd MatVirtualEnv
install([prjDir],[mvOption])
Here, [prjDir] and [bLink] are optional. [prjDir] specifies an existing project directory you might have and [mvOption] specifies whether or not you want that directory copied (0)(default), moved (1), linked (2). Linking your project directory keeps the directory in the same place without making a copy, but if you move it somehwere else manually, it will not longer work in MVE.
If you don’t specify a [prjDir], the first step post-installation will be to create a new project.
mve new [prj] % create and switch to new project
Note that installation inserts a line within your startup.m file. On MATLAB startup, MVE will run and by default you will automatically continue in the last project you were working in.
> mve config [type] % Open configuration of a specific type for editing
%% Config Types and args:
source/src [name] % source configuration for invidiual package (current if name is ommitted)
% these are configurations that are *not* specific to any end user.
user [name] % User configuration for invidiual package (current if name is ommitted)
% these are configurations that *are* specific to you as the end user.
root % User configuration that are persistent across all projects
% these are configurations that *are* specific to you as the end user.
mve % User configuration for MVE itself
% these are configurations that *are* specific to you as the end user of MVE.
hook [name] % Hook configuration for individual project (current if name is ommitted)
The “source” configuration is meant to follow your project/package if you decide to publish your project online. The source configuration is a plain-text file that resides within the projects root directory as ‘pkg.cfg’ ([MVEROOT]/prj/[package]/pkg.cfg or [MVEROOT]/lib/[package]/pkg.cfg). The purpose of this configuration is to:
- list of dependencies (two main types)
- declare required environment variables and optionally their defaults.
Here is an example source configuration
l MatBaseTools site=github.com/portalgun/MatBaseTools version=0.1 MyMatSql p ImageAnalysis MyToolbox env schema_fname=mysql/imap.schema gen bin smp
Anything that is nested under l or p is treated as a dependency. There are two main configuration types
- l - library dependency. These are dependencies are meant to be static.
- p - private/parallel/sub-project dependencies. These are other projects that are meant to be developed in parallel.
Depnecencies are loaded according to the order in which they are listed.
If you are using somebody elses’ work, that you arn’t going to change yourself (other than configurat), you would list it as a library dependency. In the ‘MatBaseTools’ example, a url and version are provided. If I don’t have this package already installed, MVE will fetch it and set it up for me. Anything that is nested under l or p is treated as a dependency.
If you don’t have any l-type dependencies, ommit it entirely.
If you are using somebody elses’ work, that you arn’t going to change yourself (other than configurat), you would list it as a library dependency. In the ‘MatBaseTools’ example above, a url and version are provided. If I don’t have this package already installed, MVE will fetch it and set it up for me.
If you don’t have any p-type dependencies, ommit the seciton entirely.
Environment variables are like global variables specific to an individual project, specific to the environment of the end user. For example if I had a project that needed to know where your data was stored, an environment variable would be good for this condition. Declaring an environment variable is essentially listing what variables are required for the end-user to provide.
Environment variables are specific to individual dependencies. If two projects use the same names for required environment variables, there will be no conflict. MVE sorts this all out under the hood.
If you don’t have any environmnet dependencies, ommit the section entirely.
Environment variables can be assigned in any of the thre levels of confguration (src, usr, root). Their priority is as follows:
- usr
- root
- src
When MVE looks for the value of an environment variable, it starts at usr and falls back to root, then src default (if it exists). You will be warned as an end user in the final condition, and error if it can’t find an a definition at all.
The user configuration is a plaintext file that resides outside of the project directory ([MVEROOT]/etc/[project].cfg User configuration configures a package project for your own use. It where a user assigns environment variables in accordance with your machine/needs as an end user (see src above). If you an environment variable needs to be assigned as an end user, you will be notified when switching to a project that contains the dependency.
Root configuration is a plaintext file that resides outside of the project directory ([MVEROOT]/etc/root.cfg This is the same as user configuration, but across all projects.
MVE configuration is a plaintext file that resides outside of the project directory ([MVEROOT]/etc/ve.cfg
MatVE provides a very large suite of features. Everything below is disabled by default as to not overwhelm new users.
Session management
- By-project command history
- Auto-saving/reloading workspaces
Hierarchical configuration
- By-project environment variable management
- Hostname/Os specific configuration
Auto project organization
- Better defaults for when creating/saving data, figures, binaries.
- Support for logging
- Function aliasing
Advanced path configuration
- Ordering
- Java
- include/exclude
Project setup
- Run custom code (hooks) for specific projects when switching or reloading
- MAKE files
External Editor support
- Auto-generate GTAGS (GNU Global)
- Emacs projectile support
Features being developed
- Project testing suite
- Toolboxtoolbox package compatibility