Skip to content

Development Guide

Yiyin Zhou edited this page May 30, 2023 · 3 revisions

Simultaneous Development of NeuroMynerva and other dependent packages.

Before we demonstrate how to have simultaneous development of NeuroMynerva with dependent packages, you need to follow the instructions here to first install the development version of NeuroMynerva.

We'll use the neu3d dependency as an example. Suppose you have a folder called FBL with all the FlyBrainLab packages included within as follows:

FBL
├── FBLClient
├── neu3d         # develop this one
├── Neuroballad
└── NeuroMynerva  # also develop this one

We have 2 objectives here:

  1. To make sure that Neuromynerva uses the local copy of neu3d
  2. To make sure that any changes in neu3d is reflected within the compiled neu3d.min.js
  3. To make sure that the updated neu3d.min.js is reflected in the built NeuroMynerva.

To do this we need to do the following steps:

  1. Navigate to neu3d folder and jlpm link the local copy of the neu3d package:
$ cd neu3d
$ jlpm link 
yarn link v1.21.1
success Registered "neu3d".
info You can now run `yarn link "neu3d"` in the projects where you want to use this package and it will be used instead.
Done in 0.03s.
  1. Navigate to NeuroMynerva folder and use the linked neu3d package:
$ cd ../NeuroMynerva
$ jlpm link "neu3d"
yarn link v1.21.1
success Using linked package for "neu3d".
Done in 0.39s.
  1. Watch and rebuild for changes on both sides:
$ jlpm run watch   # in Neuromynerva

# in a separate terminal
$ cd neu3d
$ npm run watch

Afterwards, any changes to neu3d package should trigger first a rebuilding of the neu3d:

asset neu3d.min.js 3.47 MiB [emitted] (name: main)
cached modules 3.15 MiB [cached] 40 modules
runtime modules 1.25 KiB 6 modules
./src/neu3d.js 62.7 KiB [built] [code generated]
webpack 5.72.0 compiled successfully in 145 ms

Followed by an update on the NeuroMynerva side:

Watch Compilation starting…

Removed old assets:  [ 'remoteEntry.db52a83904db47132e98.js' ]

Watch Compilation finished

assets by status 6.68 MiB [cached] 12 assets
assets by status 3.5 MiB [emitted]
  asset neu3d_lib_neu3d_min_js.1d8fbaf709110ad3e228.js 3.47 MiB [emitted] [immutable] 1 related asset
  asset remoteEntry.c2815236baea3ae7af0f.js 36.1 KiB [emitted] [immutable] (name: @flybrainlab/neuromynerva) 1 related asset
cached modules 6.03 MiB (javascript) 336 bytes (share-init) 882 bytes (consume-shared) [cached] 737 modules
runtime modules 26.2 KiB 13 modules
../neu3d/lib/neu3d.min.js 3.47 MiB [built] [code generated]
webpack 5.55.1 compiled successfully in 375 ms

You will need to refresh the browser to see the updated change.

Release Guide

Neuromynerva is considered a prebuilt extension by JLab and can be released on both PyPI and NPM.

The preferred installation/upgrade is via PyPI (pip install neuromynerva --upgrade) so we mainly focus on PyPI installation for JLab 3.x+.

Perform the following steps: 0. Bump Version: - Since the only place where the version is specified is in package.json under version, just change this value.

  1. Create distribution: make dist
    • This will clean up the repository for any python dummy files before creating a pip wheel and a tar-ball in dist/
  2. Test local installation: pip install dist/neuromynerva-x.x.xx-py3-none-any.whl or pip install dist/neuromynerva-x.x.xx.tar.gz
    • Sanity check to make sure that the changes are reflected and the package still works
  3. [Optional] Upload to TestPyPI: twine upload -r testpypi dist/*
    • TestPyPI is like PyPI except for testing publishing
  4. [Optional] Test installation from TestPyPI: pip install -i https://test.pypi.org/simple/ neuromynerva
    • This just installs from test.pypi, everything else is the same as pip install neuromynerva
  5. Upload to PyPI: twine upload dist/*
  6. Upload to NPM: npm upload --access public
  7. Tag the git commit and push to master: git tag vx.x.xx && git push --tags
  8. Create a release on GitHub with the latest version tag.
    • Include CHANGELOG in the release

Some checks during the process:

  • Did I bump the package version?
  • Did the version of the installed packages match what I expect?
  • Did the desired features show up in the test installation?
  • Did I publish to both PyPI and NPM?
  • Did I create a new tagged release on GitHub
  • Did I include a CHANGELOG with the release?

Clone this wiki locally