locallycompact / inigo

Inigo: A Package Manager for Idris2

Home Page:https://inigo.pm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build

Inigo

Inigo is a package manager for Idris2 to help use and share Idris code.

Note: this project is in an alpha test state. Expect breaking changes at this point for the foreseeable future. Feel free to test and experiment and suggest changes.

Installation

First, you'll need to install inigo. Note: we currently only support Idris2's built in code-gens on the client, but we plan to add support for external code-gens soon.

We don't currently have any releases, but we may add them soon! Until then, follow the "Bootstrapping" instuctions bellow.

Bootstrapping

Dependencies

Building and installing

You can run the bootstrap Makefile command on Linux-type environments to bootstrap Inigo. Since Inigo depends on packages in Inigo, you'll need to bootstrap to get the components you need.

git clone https://github.com/idris-community/inigo.git
git submodule update --init idrall
cd inigo && make bootstrap

If all goes well, you'll want to make inigo available in your path, e.g. via:

cp build/exec/inigo /usr/local/bin
chmod +x /usr/local/bin/inigo

or simply:

make install

You can specify the install location by setting INSTALL_DIR in config.mk or on the command line

make install INSTALL_DIR="/usr/local/bin/"

Create an app

Let's create a new app and use Inigo to manage our packages:

mkdir MyApp && cd MyApp
inigo init MyNamespace MyApp

You can read more about namespaces under the publishing a package section below.

This will create a skeleton app with an Inigo.toml. This configuration file will allow you to specify dependencies and automatically generates your Idris ipkg file for you.

Note: it is also possible to use an Inigo.dhall file, see the docs for more details.

You can build and run your app by calling:

inigo build
inigo exec

or test your app:

inigo fetch-deps prod --dev # pull dependencies
inigo build-deps
inigo test

You can specify the dependencies for your app in Inigo.toml:

...
[deps]
Base.Color="~0.0.1"
Base.Fmt="~0.0.1"

This allows us to use the Color and Fmt libraries. Then install the libaries and build the dependencies with:

inigo fetch-deps prod
inigo build-deps

Finally, you can use this in your app:

MyApp.idr

module MyApp

import Color
import Fmt

main : IO ()
main =
  putStrLn (fmt "Hello %s!" (decorate (Text Blue) "world"))

You can run this with:

inigo build && inigo exec

Publishing a Package

To publish a package, you'll need to first register an account with Inigo to claim a namespace. A namespace is a name that will prefix your packages in the registry (i.e. to differentiate different packages with identical names).

inigo register

Follow the instructions, and then, you can login to your namespace:

inigo login

Finally, you can now publish your app:

inigo push ./Inigo.toml

Questions

Feel free to ask questions on GitHub issues.

Contributing

Please feel free to open issues on GitHub or create pull requests. A key focus of this project will be to expand support for ChezScheme and other code-gens, as well as better support for Windows and other operating systems. Additionally, we would like to refactor much of the code to make better use of dependent types.

About

Inigo: A Package Manager for Idris2

https://inigo.pm

License:MIT License


Languages

Language:Idris 94.8%Language:HCL 1.4%Language:Makefile 1.3%Language:CSS 1.1%Language:JavaScript 0.6%Language:Dhall 0.5%Language:HTML 0.3%