Git Product home page Git Product logo

matvirtualenv's Introduction

MatVE: Matlab Virtual Environment

Path/Project/Package/Session/History manager

Description

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.

Basic Usage

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

Installation

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.

Configuration

> 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)

src/source configuration

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:

  1. list of dependencies (two main types)
  2. 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

  1. l - library dependency. These are dependencies are meant to be static.
  2. 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.

(l)ibrary dependencies

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.

(p)arallel dependencies

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.

(env)ironment variables

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:

  1. usr
  2. root
  3. 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.

usr/user configuration

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

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

MVE configuration is a plaintext file that resides outside of the project directory ([MVEROOT]/etc/ve.cfg

Other features

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

matvirtualenv's People

Contributors

portalgun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.