Skip to content

Commit

Permalink
Add command line usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Oct 6, 2023
1 parent 14fe37c commit b7e6ca6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,32 @@ For example,

Additionally for packages not in a major repository, _i.e._ those in `other.json`, a `url` field is added to uniquely identify the package and give its source.
The other schema is described in [`schema_other.json`](schema_other.json).

### Usage

The package lists are simply text files conforming to the JSON schemas.
You can build queries by parsing these files in a local copy of the repository or from GitHub.

#### Command line

Using [`httpie`](https://httpie.io/) and [`jq`](https://jqlang.github.io/jq/).
For example, to get a list of PyPI packages currently allowed by The Alan Turing Institute:

```console
$ https https://raw.githubusercontent.com/uk-tre/packages/main/alan_turing_institute/pypi.json | jq '.[] | select(.revoke_date == null) | .package_name'
"pandas"
...
```

With a local copy of the repository using `cat` and `jq`.
For example, to get a list of PyPI packages currently allowed any organisation:

```console
$ cat **/pypi.json | jq -s 'add | map(select(.revoke_date == null)) | [.[].package_name] | unique | .[]'
"arviz"
"cycler"
"matplotlib"
"numpy"
"pandas"
"pymc3"
```

0 comments on commit b7e6ca6

Please sign in to comment.