Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Latest commit

 

History

History
108 lines (69 loc) · 4.7 KB

DEVELOPMENT.md

File metadata and controls

108 lines (69 loc) · 4.7 KB

Development

Architecture Overview

Zeno's frontend is a Svelte app (frontend/) which is compiled to JS modules and other static assets such as HTML and CSS files (zeno/frontend/).

Zeno's backend is a Python FastAPI server (zeno/server.py and zeno/runner.py) which can be run from the command line program or from computational notebooks. The FastAPI server hosts the compiled frontend files and the backend API the frontend interfaces with.

For the frontend we used the compiled OpenAPI interface instead of raw fetch requests to interact with the backend. The API can be generated using the npm run generate-api command, which creates the frontend/src/zenoservice folder (must be run while server is running). All the TypeScript classes used in the frontend come from the compiled OpenAPI spec, giving us a single source of truth for classes from Python.

Zeno is packaged as a PyPI package zenoml that contains the Python backend files and the compiled frontend.

Development Installation

After cloning the repository:

We suggest you install the following VSCode extensions:

You should now be able to run poetry run zeno

Windows OS Note

  • If make command is not working, install gnuwin32 following the instructions to make it works.
  • If encountering ModuleNotFoundError: No module named “cifar_model”, add zeno/examples/cifar/tests path to .venv/Lib/site-packages/zenoml.pth file.

MacOS Note

If you are using MacBook Pro/Macbook Air with M1 chip and are experiencing error logs while running the backend server, there are different possible solutions. For example:

If you see this error message:

objc[29381]: +[NSMutableString initialize] may have been in progress in another thread when fork() was called.

, please set an environment variable to disable fork safety as follows:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

If python crashes, and you get this error message:

crashed on child side of fork pre-exec

, please set an environment variable to disable fork safety as follows:

export no_proxy=*

Examples

The various standard examples for Zeno are in the examples GitHub repo.

First, clone that repository into this one: git clone https://github.com/zeno-ml/examples

Then, to set up the CIFAR example:

  • source ./.venv/bin/activate (Windows OS command: .\.venv\Scripts\activate)
  • cd examples/cifar
  • mkdir data; cd data; git clone https://github.com/YoongiKim/CIFAR-10-images
  • pip install Pillow torch torchvision
  • poetry run zeno ./examples/cifar/config.toml
    • For debugging, you can use the "Run and Debug" sidebar in VSCode (a play button with a bug icon), and run the zenocifar configuration.

In a different terminal window, run the following command to serve the frontend code:

  • cd frontend; npm run dev

You should now be able to see a live version of zeno on localhost:8000 in your browser.

Contributing

Pull requests are welcome for any bug fixes or features. The Zeno project includes a Makefile which runs various linting and typechecks. Run make to ensure your code passes the requirements, as it is the same command used in the GitHub Action to test PRs.

Please ensure make passes before submitting a pull request.

For commit messages and pull request titles, use the Conventional Commits Standards.

Making a release

  • Run poetry version patch to update version number in pyproject.toml

Then either run make publish or the following steps:

  • Run git commit -am "chore: bump version to $(poetry version -s)" to commit the version bump and add a tag with git tag "v$(poetry version -s)".
  • Run make build to build the frontend and backend w/ Poetry.
  • Test the library by installing it locally with pip install dist/zenoml-$(poetry version -s).tar.gz.
  • Run poetry publish to publish the package to PyPI.
  • Push the commits and tags with git push && git push --tags.
  • Create a release on GitHub for the new version tag.