An open API service indexing awesome lists of open source software.

https://github.com/librariesio/conda-parser

Parse a Conda environment.yml file by POSTing it to this api.
https://github.com/librariesio/conda-parser

Last synced: 8 months ago
JSON representation

Parse a Conda environment.yml file by POSTing it to this api.

Awesome Lists containing this project

README

          

# Conda parser

A tiny python web service for parsing dependency information from `environment.yml` files for [Libraries.io](https://libraries.io).

## Parsing

We use Conda.models.MatchSpec to do version matching, as such, environment.yml dependencies should match one of the following formats in order to parse properly.

* `numpy`
* `numpy 1.8.*`
* `numpy 1.8*`
* `numpy 1.8.1`
* `numpy >=1.8`
* `numpy ==1.8.1`
* `numpy 1.8|1.8*`
* `numpy >=1.8,<2`
* `numpy >=1.8,<2|1.9`
* `numpy 1.8.1 py27_0`
* `numpy=1.8.1=py27_0`

## Building and running options.

### Docker

You can use Docker to run conda-parser

First, install Docker. If you run macOS or Windows, Docker for Mac/Windows makes this really easy. (If you have Windows Home Edition, you'll need to download and run Docker Toolbox.)

Then, run:

$ docker pull librariesio/conda-parser
$ docker run -it -e PORT=5000 -p 5000:5000 librariesio/conda-parser

conda-parser will be running on http://localhost:5000.

To build the docker image locally:

$ docker build -t librariesio/conda-parser .

Note: The Dockerfile has `./gunicorn_start.sh` as it's CMD so this can be overridden with `/bin/bash` if you'd like to poke around:

$ docker run -it librariesio/conda-parser /bin/bash

### Docker Compose

Docker Compose makes this a lot easier, but there's one minor setup if using Docker for MacOS.
You must add the directory your cloned this to in the Docker Desktop -> Preferences -> File Sharing -> [+] and Add the directory.

Then you can run

$ docker-compose build
$ docker-compose up

The server will be running, and any time you want to make a change to the code, you can just quit the `docker-compose up` process and re-run it. The new code will be reloaded. Because the `Dockerfile` and `gunicorn_start.sh` run Gunicorn, it won't auto reload when files are changed.

## Consuming the API

You can test that it works by running one of these curl commands:

```console
$ curl -X POST -F "file=@environment.yml" http://localhost:5000/parse # Post multipart

$ curl -X POST -F "file=