https://github.com/agda/agda-pkg

apkg - package manager for Agda

https://github.com/agda/agda-pkg

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: acs.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.6%) to scientific vocabulary

Keywords

agda lightweight-dependency-management package-manager

Keywords from Contributors

graph-theory
Last synced: 5 months ago · JSON representation

Repository

apkg - package manager for Agda

Basic Info
Statistics
  • Stars: 38
  • Watchers: 5
  • Forks: 8
  • Open Issues: 4
  • Releases: 0
Topics
agda lightweight-dependency-management package-manager
Created over 7 years ago · Last pushed over 4 years ago
Metadata Files
Readme License

README.md

pypi versions Build Status downloads

Agda-pkg is a simple tool to manage Agda libraries with extra features like installing libraries from different kind of sources.

This tool does not modify Agda at all, it just manages systematically the directory .agda with .agda/defaults and .agda/libraries files used by Agda to locate the available libraries. For more information about how Agda package system works, please read the official documentation here.

Quick Start

The most common usages of agda-pkg are the following:

  • To install Agda-pkg just run the following command:

bash $ pip3 install agda-pkg

  • To install your library, go to the root directory of your source code and run:

bash $ apkg install --editable .

bash $ apkg init $ apkg install standard-library $ apkg install plfa@dev-20.07

  • To install a Github repository with a specific version release:

bash $ apkg install --github agda/agda-stdlib --version v1.3

  • To install a library from a Github repository with a specific branch with a specific library name:

bash $ apkg install --github plfa/plfa.github.io --branch dev --name plfa

Indexed libraries

Library name | Latest version | URL -----|-----|----- agda-base | v0.2 | https://github.com/pcapriotti/agda-base.git agda-categories | v0.1.3.1 | https://github.com/agda/agda-categories.git agda-metis | v0.2.1 | https://github.com/jonaprieto/agda-metis.git agda-prelude | df679cf | https://github.com/UlfNorell/agda-prelude.git agda-prop | v0.1.2 | https://github.com/jonaprieto/agda-prop.git agda-real | e1558b62 | https://gitlab.com/pbruin/agda-real.git agda-ring-solver | d1ed21c | https://github.com/oisdk/agda-ring-solver.git agdarsec | v0.3.0 | https://github.com/gallais/agdarsec.git alga-theory | 0fdb96c | https://github.com/algebraic-graphs/agda.git ataca | a9a7c06 | https://github.com/jespercockx/ataca.git cat | v1.6.0 | https://github.com/fredefox/cat.git cubical | v0.2 | https://github.com/agda/cubical.git FiniteSets | c8c2600 | https://github.com/L-TChen/FiniteSets.git fotc | apia-1.0.2 | https://github.com/asr/fotc.git generic | f448ab3 | https://github.com/effectfully/Generic.git hott-core | 1037d82 | https://github.com/HoTT/HoTT-Agda.git hott-theorems | 1037d82 | https://github.com/HoTT/HoTT-Agda.git HoTT-UF-Agda | 9d0f38e | https://github.com/martinescardo/HoTT-UF-Agda-Lecture-Notes.git ial | v1.5.0 | https://github.com/cedille/ial.git lightweight-prelude | b2d440a | https://github.com/L-TChen/agda-lightweight-prelude.git MtacAR | 5417230 | https://github.com/L-TChen/MtacAR.git plfa | dev-20.07 | https://github.com/plfa/plfa.github.io.git routing-library | thesis | https://github.com/MatthewDaggitt/agda-routing.git standard-library | v1.4-rc1 | https://github.com/agda/agda-stdlib.git

Usage manual

Initialisation of the package index

The easiest way to install libraries is by using the package index. agda-pkg uses a local database to maintain a register of all libraries available in your system. To initialize the index and the database please run the following command:

bash $ apkg init Indexing libraries from https://github.com/agda/package-index.git

Note. To use a different location for your agda files defaults and libraries, you can set up the environment variable AGDA_DIR before run apkg as follows:

bash $ export AGDA_DIR=$HOME/.agda

Other way is to create a directory .agda in your directory and run agda-pkg from that directory. agda-pkg will prioritize the .agda directory in the current directory.

Help command

Check all the options of a command or subcommand by using the flag --help.

bash $ apkg --help $ apkg install --help

Upgrade the package index

Recall updating the index every once in a while using upgrade.

bash $ apkg upgrade Updating Agda-Pkg from https://github.com/agda/package-index.git

If you want to index your library go to the package index and make PR.

Environmental variables

If there is an issue with your installation or you suspect something is going wrong. You might want to see the environmental variables used by apkg.

bash $ apkg environment

List all the packages available

To see all the packages available run the following command:

bash $ apkg list

The list command option comes with the flag --full to display more details.

Installation of packages

Install a library is now easy. We have multiple ways to install a package.

$ apkg install standard-library

bash $ apkg install .

or even much simpler:

bash $ apkg install

Installing a library creates a copy for agda in the directory assigned by agda-pkg. If you want your current directory to be taken into account for any changes use the --editable option. as shown below.

bash $ apkg install --editable .

  • from a github repository

bash $ apkg install --github agda/agda-stdlib --version v1.1

  • from a git repository

bash $ apkg install http://github.com/jonaprieto/agda-prop.git

To specify the version of a library, we use the flag --version

bash $ apkg install standard-library --version v1.0

Or simpler by using @ or == as it follows.

bash $ apkg install standard-library@v1.0 $ apkg install standard-library==v1.0

Multiple packages at once

To install multiple libraries at once, we have two options:

  1. Using the inline method

bash $ apkg install standard-library agda-base

Use @ or == if you need a specific version, see above examples.

  1. Using a requirement file:

Generate a requirement file using apkg freeze:

bash $ apkg freeze > requirements.txt $ cat requirements.txt standard-library==v1.1

Now, use the flag -r to install all the listed libraries in this file:

bash $ apkg install -r requirements.txt

Check all the options of this command with the help information:

bash $ apkg install --help

Uninstalling a package

Uninstalling a package will remove the library from the visible libraries for Agda.

  • using the name of the library

bash $ apkg uninstall standard-library

  • infering the library name from the current directory

bash $ apkg uninstall .

And if we want to remove the library completely (the sources and everything), we use the flag --remove-cache.

bash $ apkg uninstall standard-library --remove-cache

Update a package to latest version

We can get the latest version of a package from the versions registered in the package-index.

  • Update all the installed libraries:

bash $ apkg update

  • Update a specific list of libraries. If some library is not installed, this command will installed the latest version of it.

bash $ apkg update standard-library agdarsec

See packages installed

bash $ apkg freeze standard-library==v1.1

This command is useful to keep in a file the versions used for your project to install them later.

bash $ apkg freeze > requirements.txt

To install from this requirement file run this command.

bash $ apkg install < requirements.txt

Approximate search of packages

We make a search (approximate) by using keywords and title of the packages from the index. To perform such a search, see the following example:

bash $ apkg search metis 1 result in 0.0012656739999998834seg cubical url: https://github.com/agda/cubical.git installed: False

Get all the information of a package

bash $ apkg info cubical

Creating a library for Agda-Pkg

In this section, we describe how to build a library.

To build a project using agda-pkg, we just run the following command:

bash $ apkg create

Some questions are going to be prompted in order to create the necessary files for Agda and for Agda-Pkg.

The output is a folder like the following showed below.

Directory structure of an agda library

A common Agda library has the following structure:

``` $ tree -L 1 mylibrary/ mylibrary/ ├── LICENSE ├── README.md ├── mylibrary.agda-lib ├── mylibrary.agda-pkg ├── src └── test

2 directories, 3 files ```

.agda-lib library file

yaml $ cat mylibrary.agda-lib name: mylibrary -- Comment depend: LIB1 LIB2 LIB3 LIB4 include: PATH1 PATH2 PATH3

.agda-pkg library file

This file only works for agda-pkg. The idea of this file is to provide more information about the package, pretty similar to the cabal files in Haskell. This file has priority over its version .agda-lib.

```yaml $ cat mylibrary.agda-pkg name: mylibrary version: v0.0.1 author: - AuthorName1 - AuthorName2 category: cat1, cat2, cat3 homepage: http://github.com/user/mylibrary license: MIT license-file: LICENSE.md source-repository: http://github.com/user/mylibrary.git tested-with: 2.6.0 description: Put here a description.

include: - PATH1 - PATH2 - PATH3 depend: - LIB1 - LIB2 - LIB3 - LIB4 ```

Using with Nix or NixOS

A nix-shell environment that loads agda-pkg as well as agda and agda-mode for Emacs is available. To use this, apkg can put the necessary files in your project folder by running one of the following commands:

bash $ curl -L https://gist.github.com/jonaprieto/53e55263405ee48a831d700f27843931/download | tar -xvz --strip-components=1

or if you already have installed agda-pkg:

bash $ apkg nixos

Then, you will have the following files:

bash ./hello-world.agda ./agda_requirements.txt ./shell.nix ./deps.nix ./emacs.nix

From where you can run the nix shell.

bash $ nix-shell

To launch Emacs with agda-mode enabled, run mymacs in the newly launched shell; mymacs will also load your ~/.emacs file if it exists. If you are using Spacemacs, you will need to edit shell.nix to use ~/.spacemacs instead.

The files provided by the commands above are also available in this repository (apkg/support/nix) and in a third-party example repository to give an idea of exactly which files need to be copied to your project.

Example:

agda $ cat hello-world.agda module hello-world where open import IO main = run (putStrLn "Hello, World!")

Run mymacs hello-world.agda then type C-c C-x C-c in emacs to compile the loaded hello world file.

Configuration

Edit any of the nix expressions as needed. In particular:

  1. To add Agda dependencies via agda-pkg, edit agda_requirements.txt
  2. To add more 4Haskell or other system dependencies or other target-language dependencies, edit deps.nix.
  3. To add or alter the editor used, change the myEmacs references in shell.nix or add similar derivations.
  4. Optionally, create .emacs_user_config in the repository root directory and add any additional config, such as (setq agda2-backend "GHC") to use GHC by default when compiling Agda files from emacs.

About

This is a proof of concept of an Agda Package Manager. Contributions are always welcomed.

Owner

  • Name: Agda Github Community
  • Login: agda
  • Kind: organization

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 169
  • Total Committers: 9
  • Avg Commits per committer: 18.778
  • Development Distribution Score (DDS): 0.207
Top Committers
Name Email Commits
Jonathan Prieto-Cubides j****3@u****o 134
Jonathan Prieto-Cubides j****s@u****o 20
apkgbot a****t@g****m 9
Will Badart w****l@w****m 1
Mort Yao m****o@g****m 1
Brandon Elam Barker b****r@g****m 1
dependabot[bot] 4****]@u****m 1
Jonathan Prieto-Cubides p****a@g****m 1
merua 4****a@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 39
  • Total pull requests: 10
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 9
  • Total pull request authors: 7
  • Average comments per issue: 1.08
  • Average comments per pull request: 0.9
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • apkgbot (16)
  • jonaprieto (13)
  • bbarker (2)
  • wenkokke (2)
  • alexarice (2)
  • cspollard (1)
  • Ailrun (1)
  • michel1948 (1)
  • soimort (1)
Pull Request Authors
  • bbarker (2)
  • jonaprieto (2)
  • dependabot[bot] (2)
  • wbadart (1)
  • soimort (1)
  • apkgbot (1)
  • merua (1)
Top Labels
Issue Labels
command-option (15) enhancement (12) agda-maintenance (7) file-management (5) bug (3) package-index (2) git-management (2) help wanted (1)
Pull Request Labels
dependencies (2) git-management (1) command-option (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 514 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 47
  • Total maintainers: 1
pypi.org: agda-pkg

A package manager for Agda

  • Versions: 47
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 514 Last month
Rankings
Dependent packages count: 10.0%
Stargazers count: 11.0%
Forks count: 11.9%
Average: 14.6%
Downloads: 18.3%
Dependent repos count: 21.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

apkg/support/nixos/agda_requirements.txt pypi
  • standard-library ==v1.2
requirements.txt pypi
  • GitPython ==3.1.1
  • PyYAML ==5.3.1
  • click ==7.1.1
  • click-log ==0.3.2
  • distlib ==0.3.0
  • humanize ==0.5.1
  • natsort ==7.0.1
  • ponywhoosh ==1.7.8
  • requests ==2.23.0
setup.py pypi
  • Jinja2 *
  • PyYAML >=5.1.1
  • click *
  • click-log *
  • distlib *
  • gitpython *
  • humanize *
  • natsort *
  • pony *
  • ponywhoosh *
  • requests *
  • whoosh *