MOPS - on-chain package manager for Motoko!

Introducing MOPS - a package manager for Motoko with on-chain package registry.

MOPS was created as a simple and convenient alternative to the Vessel. With MOPS it is easier to manage dependencies and it has a simpler config.

You can easily install packages with just one command mops i <package_name>.

Recently, MOPS also supports installing packages from GitHub and vessel configuration (thanks to @tomijaga)
mops i https://github.com/dfinity/motoko-base

On https://mops.one you can discover published packages.

See How to publish package.
See How to install package.

Try it out. Publish your Motoko packages to MOPS!

33 Likes

I’ll be putting a few of my Motoko libraries on MOPS. Vessel works but my biggest concern right now is package discovery. It’s really hard to figure out what exists without asking around.

5 Likes

We might need to compile a list of all the libraries that are out there. I actually do really enjoy vessel. Would be even fine if it is a simple command line that searches vessel libs and returns their urls / github repos and such.

Since Vessel works with package sets I think the obvious place to look is in the package set itself.

From looking at the commit history it seems that there haven’t been many contributions, but the good news is that anyone can contribute.

Ya, ive seen the vessel github packages but there has to be better accessibility or only a few packages will end up in that list and its tedious to view.

I havent heard anyone talk about working on vessel, has anyone talked about it future development?

I think the future of Vessel is being considered. Maybe @kpeacock or @rvanasa can share more.

There’s also this: GitHub - motoko-unofficial/awesome-motoko: A curated list of Motoko code and resources. but it hasn’t been updated a lot recently.

1 Like

I am personally highly supportive of this community-driven, on-chain package manager.

From my end, I’ll make sure that it’s possible to use MOPS in the Motoko VS Code extension and perhaps additional developer tools over time.

9 Likes

As of version 0.6.2, the Motoko VS Code extension now includes basic support for MOPS packages!

I also opened some PRs to increase the visibility of MOPS in the IC ecosystem:

Cheers!

13 Likes

@rvanasa cool, thanks a lot!

(Thanks to @cryptoschindler for the suggestion)

@ZenVoich would you be up for a presentation of MOPS during the next Motoko Bootcamp (16-22 January 2023); I would like to have this tool presented to the next cohort of Motoko dev.

4 Likes

Are there instructions on how to use it from VS Code?

1 Like

These instructions should work. The extension will automatically detect the mops.toml file and update the type checker accordingly.

I also looked into packaging MOPS directly in the extension (and including a user interface to set up a project, install dependencies, etc). This will eventually be possible after refactoring ic-mops to work as a TypeScript library.

3 Likes

Yes. That would be great.

1 Like

How can I enable Mops to install packages from vessel.dhall?

1 Like

When you run mops init first time, mops will migrate packages from vessel.dhall to mops.toml. Then you need to run mops install to install them.

3 Likes

Overview of updates 31.01.2023

Update your cli tool to get new features:

npm i ic-mops -g

Domain mops.one

Now you can access http://mops.one without redirect. Also there is no more /#/ in the url:

Before https://j4mwm-bqaaa-aaaam-qajbq-cai.ic0.app/#/package/base

Now https://mops.one/base

Search from cli

Use mops search <search_text> to search for packages directly from the CLI.

Install specific package version

Use mops add <pkg>@<ver> to install specific package version:
For example:

mops add base@0.7.6

Local dependencies support

You can link local deps by providing relative or absolute path to the package directory:

For example mops.toml:

lib = "../shared/lib"

Motoko code:

import Lib "mo:lib";

Path will be resolved to ../shared/lib/src.
You can’t publish a package with local dependencies.

Cache

Now, when installing any package, mops will cache it on disk, so next time it will be installed faster from the disk cache!

New packages published on mops

:package:icrc1 is a full implementation of the ICRC-1 fungible token standard
:package:time-consts is a library with time constants to deal with nanoseconds
:package:ledger-types is a library with interface to interact with ICP ledger canister.
:package:candid_stringify is a library to convert any Candid data to a string
:package:cbor is a library that is written in Motoko that enables the encoding and decoding of CBOR between bytes and a CBOR variant type
:package:candid is a library that enables encoding/decoding of bytes to candid values.
:package:serde is serialization and deserialization library for Motoko.
:package:itertools is a library with utility functions and data types for creating efficient iterators in Motoko.
:package:xtended-numbers is a library that extends on the Motoko base library for numbers. Maily focuses on encoding of numbers and 16/32 bit precision floats.

11 Likes

New features in Mops

Dev dependencies

Dev dependencies are not installed when someone installs your package.
Useful when you use some packages for testing only.

Example:

mops add test --dev

or in mops.toml

[dev-dependencies]
test = "1.0.0"

New command "mops test"

Mops can run tests now.
More information Motoko unit testing with Mops

New command "mops template"

You can set up a GitHub workflow to run Motoko tests with just one command!

image

Syntax highlighting

mops.one now has syntax highlighting on the package page!

Package download trend

image

Package Version History

Click on a version to view information about a specific version.

Package Dependencies

Package Dependents

New packages published on mops

  • fuzz - Motoko fuzzing library
  • maf - Motoko async data deliveries
  • test - Motoko testing library to run tests with mops
  • sha3 - Motoko Sha3/Keccak library
  • xml - A library for encoding and decoding XML
  • bitbuffer - A buffer for bit level and byte level manipulation
  • buffer-deque - A Buffer with the functionality of a Deque for efficient insertion and deletion at both ends.
  • ic-certification - Certification and Canister Signatures
  • map - Stable hash maps for Motoko
  • merkle-patricia-trie - A Merkle Patricia Trie implementation following the Ethereum specification
8 Likes

Does mops install do a replicated query or a normal query to download the code?

1 Like

normal non-replicated query