Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 3.8 KB

README.md

File metadata and controls

68 lines (47 loc) · 3.8 KB

IsoPkg

Environment-isolated package manager

No more package version conflicts. Easily upgrade packages to the newest version. Scripts keep working after package upgrading

Manage packages by creating their own isolated project environment for every directly installed package. The directly installed packages will never conflict with each other. If updating a package, it can always be upgraded to the newest version. Even the same package with different versions can be installed together. Scripts can easily specify dependent packages and never need to worry about the package upgrading.

Showcase:

If ]add [email protected] [email protected] in Julia v1.4, then it will return ERROR: Unsatisfiable requirements detected for package StatsBase [2913bbd2] because of the version restrictions of package dependencies (see 1, 2).

With IsoPkg, simplely using IsoPkg; IsoPkg.add("[email protected]"); IsoPkg.add("[email protected]"), then both packages can be used together: @iso using UnicodePlots "1.2.0"; @iso using StatsBase "0.33.0" (Notice: this will bypass the version compatibility check). Foremore, the script loading UnicodePlots or StatsBase as this form will always work without worrying about the package upgrading.

Implementation detail:

This package simply creates the env_isolated_packages folder in ~/.julia. Then creates a folder for grouping the packages. The folder name is called package group. The default group name is the current Julia version. Using IsoPkg.switch_group(group_name) to select the group name. Installing package will create an isolated environment in the folder with the activated group name. Before operating or loading a package, the corresponding environment will be activated automatically. The whole process is quite lightweight. You can even manually manage the folders in ~/.julia/env_isolated_packages to manage the installed packages, such as deleting a group folder to remove the package group.

Installation

]add IsoPkg

Usage

  • install a package: IsoPkg.add(pkg_name)
  • install a package and pin to the specified version: IsoPkg.add(pkg_name@version)
  • remove a package: IsoPkg.rm(pkg_name)
  • update a package: IsoPkg.update(pkg_name)
  • update all installed packages: IsoPkg.update()
  • show package status: IsoPkg.status(pkg_name)
  • show status of all installed packages: IsoPkg.status()
  • operate in a package environment: @iso pkg_name statement
  • using/import package: @iso using/import pkg_name
  • using/import package with the specified version: @iso using/import pkg_name version
  • pin the package version: IsoPkg.pin(pkg_name)
  • free the package version: IsoPkg.free(pkg_name)
  • switch package group: IsoPkg.swith_group(group_name)
  • list package group: IsoPkg.list_group()

Examples

using IsoPkg

IsoPkg.add("Glob") #Install Glob
IsoPkg.add("[email protected]") #Install Glob v1.2.0 and pin the version

#Notice: If the following `using` statements are in the same session, only the first one does the real loading.
@iso using Glob #Load Glob
@iso using Glob "1.2.0" #Load Glob v1.2.0

using Pkg; @iso "Glob1" pkg"add [email protected]" #Add Glob v1.3.0 as name Glob1
@iso "Glob1" using Glob #Load Glob v1.3.0

IsoPkg.pin("Glob") #Pin Glob version (will automatically change its name to match the version)
IsoPkg.free("[email protected]") #Free Glob v1.2.0 version (will automatically remove the version in its name)

IsoPkg.status() #Show status of all packages
IsoPkg.update() #Update all packages

IsoPkg.rm("Glob1") #Remove Glob v1.3.0
IsoPkg.rm("Glob") #Remove Glob
IsoPkg.rm("Glob") #Because there is only one version left, the version number can be omitted