MOPS - on-chain package manager for Motoko!

Currently, there is no such feature, but would be nice to have. I will think about it!

Another question about dependencies. When I write in mops.toml for example

base = "0.9.7"

and run mops i then that will download exactly that version (0.9.7) even if I already have a newer version (say 0.9.8) installed.

Now I am wondering what happens if I have a project that depends on two packages, A and B, both of which in turn depend on base but on different versions. Say A depends on 0.9.7 and B on 0.9.8. When I build this project then both base versions get installed and used. Does that increase the binary size because two copies of the same library get compiled into the wasm?

No, there can be only one package resolved to specific name. So base will be resolved to 0.9.7, you can run mops sources and see which package will actually be used in the build.

both will be downloaded but only one of them will be used. Probably I will move downloading and resolution out of local .mops cache dir to global cache dir, so .mops folder will remain simple.

That’s strange. I made a tool two months ago that imports files based on their content hashes and it reduced the compiled binary with 20-30kb


:snail::rocket: Reducing load time

Thanks to certification v2 and more aggresive caching, now loads much faster.

:new: Package changelog

On package “Versions” tab now you can see what changed in each package version including:

  1. Release notes from
  2. Dependencies changes
  3. Tests changes

Dependency and test changes computed automatically.
Release notes parsed on mops publish from file from packge version paragraph

For example

# Motoko compiler changelog

## 0.10.0 (2023-09-11)

* Added a new stable `Region` type of dynamically allocated, independently growable and
    isolated regions of IC stable memory (#580). See documentation.

* Exposed conversions between adjacent fixed-width types (#585).

## 0.9.8 (2023-08-11)

* motoko (`moc`)

  * Added numerical type conversions between adjacent fixed-width types (#4139).

  * Administrative: legacy-named release artefacts are no longer created (#4111).

When publishing package version 0.10.0, mops will:

  1. parse
  2. find header with our package version → ## 0.10.0 (2023-09-11)
  3. publish whole paragraph:
* Added a new stable `Region` type of dynamically allocated, independently growable and
    isolated regions of IC stable memory (#580). See documentation.

* Exposed conversions between adjacent fixed-width types (#585).

How it looks like:

:new: Integration with VSCode Motoko extension

Added new command “Motoko: Import Mops Package…”.

  1. Hit Ctrl+Shift+P then type mops to find the command

  2. Select “Import Mops Package…”

  1. Search for Motoko package

  1. Select package and press Enter

The package will be installed and saved to the mops.toml file, then the package import line will be added to the currently open *.mo file.


Looks like README header links are not working properly (redirect to the Github not found page)

Also, is there a way to fetch release notes from Github in addition to parsing CHANGELOG?

1 Like

Thanks for the report, will be fixing that

I think it’s feasible, I’ll add it to the backlog :+1:

1 Like
  • Fixed anchor links
  • Replaced the markdown library with a faster one, opening 4s → 0.3s
  • On package publish, if there are no file, mops will fetch release notes from GitHub releases (mops cli 0.28.0)
1 Like

That was quick! Thanks.

So this will only affect new publications, existing versions won’t receive release notes, will they?

Yes, new publications only, also you need to update mops cli to version 0.28.0

:new: Package badges

Now you can add mops badges to your package!

  1. Click on the “Badges” button on the right panel of your package page

  1. Copy the badge code in markdown format and add it to your file

  1. Success!


Hello @ZenVoich, I’m trying to publish the IC WebSocket Motoko CDK on mops from a GitHub action for the first time, but I’m getting a weird error:

Uploading files [:         ]
Error: Unauthorized

You can see the detailed logs at: Release ic-websocket-cdk-mo · omnia-network/ic-websocket-cdk-mo@504f223 · GitHub.

What am I missing?

1 Like

Hi @ilbert

I suspect that in GitHub action mops import-identity does not complete because it asks for a password to encrypt identity.

I just added --no-encrypt flag to mops import-identity command. Please try this:

mops import-identity --no-encrypt -- "$(dfx identity export ...
1 Like

:tada: It works perfectly, see:

@ZenVoich thanks a lot!

1 Like

@ZenVoich I’m now getting an error when I try to run mops publish (including docs generation) in the same GitHub Action:

 dfx identity use action
  mops import-identity --no-encrypt -- "$(dfx identity export action)"
  mops publish
  echo "version=$(cat mops.toml | grep "version =" | cut -d\" -f2)" >> "$GITHUB_OUTPUT"
  shell: /usr/bin/bash -e {0}
Using identity: "action".
Publishing ic-websocket-cdk@0.2.0
Generating documentation...
      throw er; // Unhandled 'error' event

Error: spawn /home/runner/.cache/dfinity/versions/0.14.1/mo-doc ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:284:19)
    at onErrorNT (node:internal/child_process:477:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:290:12)
    at onErrorNT (node:internal/child_process:477:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /home/runner/.cache/dfinity/versions/0.14.1/mo-doc',
  path: '/home/runner/.cache/dfinity/versions/0.14.1/mo-doc',
  spawnargs: [

Node.js v18.18.2
Error: Process completed with exit code 1.

Run that failed: Release ic-websocket-cdk-mo · omnia-network/ic-websocket-cdk-mo@fe6520e · GitHub.

If I run the command with --no-docs, it works.

Locally, it works with docs included.

Not sure why mo-doc from dfx is not there.
You can add this line before publish:

      - name: install moc
        run: npx mocv use latest

This will install the latest moc and mo-doc so mops can use them.

1 Like

I installed mocv in the same script of mops:

But I keep getting the error, and I think that’s because the script is looking for mo-docs at /home/runner/.cache/dfinity/versions/0.14.1/mo-doc path:

Error: spawn /home/runner/.cache/dfinity/versions/0.14.1/mo-doc ENOENT

You also need to run mocv use latest to take effect

npm i mocv -g
mocv use latest


npx mocv use latest
1 Like

It worked now! Thanks a lot again :wink:

1 Like

HatTip to @ZenVoich who has provided amazing support for MOPS!