Skip to content

Commit

Permalink
Merge pull request #90 from CLIMB-TRE/development
Browse files Browse the repository at this point in the history
Fixed breaking change from Typer, updated documentation site styles
  • Loading branch information
tombch authored Dec 9, 2024
2 parents 685ead5 + 0b5fbe0 commit 0f2fdc1
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:
- name: Install dependencies
run: |
pip install .
pip install mkdocs-material
pip install mkdocstrings[python]
pip install mkdocs-with-pdf
pip install mkdocs-material mkdocstrings-python mkdocs-with-pdf
- name: Deploy site
run: |
typer onyx.cli utils docs --output docs/cli/documentation.md
Expand Down
1 change: 1 addition & 0 deletions docs/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/cli/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[](){#cli-getting-started}
# Getting started

This guide walks through getting started with the Onyx-client CLI.
This guide walks through getting started with the Onyx-client command-line interface.

The guide assumes an environment where authentication credentials are pre-configured.

Expand Down Expand Up @@ -50,7 +51,7 @@ Filtering on the CLI uses a `field=value` syntax, where `field` is the name of a

Multiple filters can be provided, and only the records that satisfy *all* these filters will be returned.

### Lookups
### Advanced filtering using lookups

The data can be filtered in more complex ways using [lookups][lookups]. These use a `field.lookup=value` syntax (or alternatively, `field__lookup=value`), and different ones are available depending on a field's [data type][types] (e.g. [`text`][text], [`integer`][integer]). There are lookups for searching between a range of values on a field ([`range`][range]), whether a field's value is empty ([`isnull`][isnull]), whether a field case-insensitively contains some text ([`icontains`][icontains]), and [more][lookups].

Expand Down
Binary file added docs/img/cli-no-colours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/cli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ hide:

## Introduction

This site documents usage of [Onyx-client](https://github.com/CLIMB-TRE/onyx-client), a program designed for interacting with the [Onyx](https://github.com/CLIMB-TRE/onyx/) database.
This site documents [Onyx-client](https://github.com/CLIMB-TRE/onyx-client), a program that provides a command-line interface and Python API for interacting with the [Onyx](https://github.com/CLIMB-TRE/onyx/) database.

Onyx-client and Onyx are being developed as part of the [CLIMB-TRE](https://climb-tre.github.io/) project.
Onyx is being developed as part of the [CLIMB-TRE](https://climb-tre.github.io/) project.

![Onyx](img/onyx.png)
![Image of the Onyx command-line interface](img/cli.png)

## Installation

Expand Down Expand Up @@ -48,14 +48,16 @@ $ pip install .

## Accessibility

### Enable/disable colours
### Enable/disable colours in the command-line interface

Colours are enabled by default in the output of the Onyx-Client. To disable them, create an environment variable `ONYX_COLOURS` with the value `NONE`:
Colours are enabled by default in the output of the command-line interface. To disable them, create an environment variable `ONYX_COLOURS` with the value `NONE`:

```
$ export ONYX_COLOURS=NONE
```

![Image of the Onyx command-line interface without colours](img/cli-no-colours.png)

To re-enable colours, unset the environment variable:

```
Expand Down
8 changes: 4 additions & 4 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[data-md-color-scheme="slate"][data-md-color-primary="black"] {
--md-typeset-a-color: rgb(171, 71, 189);
/* or any other hex value */
--md-typeset-a-color: #d63384;
--md-accent-fg-color: #d63384;
}

[data-md-color-primary="black"] {
--md-typeset-a-color: rgb(171, 71, 189);
/* or any other hex value */
--md-typeset-a-color: #d63384;
--md-accent-fg-color: #d63384;
}
11 changes: 7 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ site_author: CLIMB-TRE

theme:
name: material
logo: assets/logo.svg
icon:
repo: fontawesome/brands/github
palette:
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: black
accent: purple
accent: custom
toggle:
icon: material/weather-sunny
name: Switch to dark mode
Expand All @@ -22,7 +23,7 @@ theme:
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: black
accent: purple
accent: custom
toggle:
icon: material/weather-night
name: Switch to light mode
Expand Down Expand Up @@ -56,6 +57,7 @@ plugins:
cover_subtitle: ""

markdown_extensions:
- attr_list
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
Expand All @@ -75,14 +77,15 @@ nav:
- Command-line interface:
- Getting started: cli/getting-started.md
- Documentation: cli/documentation.md
- Python API:
- Python API:
# - Getting started: api/getting-started.md
- Documentation:
- OnyxClient: api/documentation/client.md
- OnyxConfig: api/documentation/config.md
- OnyxEnv: api/documentation/env.md
- OnyxField: api/documentation/field.md
- Exceptions: api/documentation/exceptions.md
- Fields Reference:
- Types & Lookups:
- Types: fields/types.md
- Lookups: fields/lookups.md
- CLIMB-TRE: https://climb-tre.github.io
4 changes: 3 additions & 1 deletion onyx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def list_commands(self, ctx):


app = typer.Typer(
name="onyx",
help="API for pathogen metadata.",
cls=DefinedOrderGroup,
no_args_is_help=True,
pretty_exceptions_show_locals=False,
Expand Down Expand Up @@ -1484,7 +1486,7 @@ def version_callback(value: bool):
raise typer.Exit()


@app.callback(name="onyx", help=f"API for pathogen metadata.")
@app.callback()
def common(
context: typer.Context,
domain: Optional[str] = typer.Option(
Expand Down
2 changes: 1 addition & 1 deletion onyx/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.6.0"
__version__ = "4.6.1"

0 comments on commit 0f2fdc1

Please sign in to comment.