Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meta.query.representation and remove /optimade in base URLs #201

Merged
merged 6 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/deps_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ jobs:
.github/workflows/wait_for_it.sh localhost:3213 -t 120
sleep 15

- name: Test server with OPTIONAL base URLs
- name: Test server, including OPTIONAL base URLs
uses: ./
with:
port: 3213
path: /optimade
path: /
all versioned paths: yes

- name: Start Docker image - index server
Expand All @@ -118,11 +118,11 @@ jobs:
.github/workflows/wait_for_it.sh localhost:3214 -t 120
sleep 15

- name: Test index server with OPTIONAL base URLs
- name: Test index server, including OPTIONAL base URLs
uses: ./
with:
port: 3214
path: /optimade
path: /
all versioned paths: yes
index: yes

Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/validator_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: ./
with:
port: 3213
path: /optimade/v0
path: /v0

validator_index:
runs-on: ubuntu-latest
Expand All @@ -44,7 +44,7 @@ jobs:
uses: ./
with:
port: 3214
path: /optimade/v0
path: /v0
index: yes

all_versioned_paths:
Expand All @@ -64,5 +64,12 @@ jobs:
uses: ./
with:
port: 3213
path: /optimade
path: /
all versioned paths: yes

- name: Run action (setting path to empty string)
uses: ./
with:
port: 3213
path: ""
all versioned paths: yes
10 changes: 6 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Installing the index meta-database
# Installing OPTiMaDe Python tools

## The index meta-database

This package may be used to setup and run an [OPTiMaDe index meta-database](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#index-meta-database).
Install the package via `pip install optimade[server]` and change the file [`server.cfg`](server.cfg) found in the root of the package.
Expand All @@ -9,7 +11,7 @@ The paths must be relative from your current working directory, where your `serv
The index meta-database is set up to populate a `mongomock` in-memory database with resources from a static `json` file containing the `child` resources you, as a database provider, want to serve under this index meta-database.

Running the index meta-database is then as simple as writing `./run.sh index` in a terminal from the root of this package.
You can find it at the base URL: [`http://localhost:5001/optimade`](http://localhost:5001/optimade).
You can find it at the base URL: <http://localhost:5001/v0.10.1>.

_Note_: `server.cfg` is loaded from the current working directory, from where you run `run.sh`.
E.g., if you have installed `optimade` on a Linux machine at `/home/USERNAME/optimade/optimade-python-tools` and you run the following:
Expand All @@ -20,7 +22,7 @@ E.g., if you have installed `optimade` on a Linux machine at `/home/USERNAME/opt

Then you need `server.cfg` to be located in your home folder containing either relative paths from its current location or absolute paths.

# Full development installation
## Full development installation

The dependencies of this package can be found in `setup.py` with their latest supported versions.
By default, a minimal set of requirements are installed to work with the filter language and the `pydantic` models.
Expand Down Expand Up @@ -73,4 +75,4 @@ Running the following:
uvicorn optimade.server.main_index:app --reload --port 5001
```

will run the index meta-database server at <http://localhost:5001/optimade>.
will run the index meta-database server at <http://localhost:5001/v0.10.1>.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Latest release | Build status | Activity |
|:--------------:|:------------:|:--------:|
| [![PyPI Version](https://img.shields.io/pypi/v/optimade?logo=pypi)](https://pypi.org/project/optimade/)<br>[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/optimade?logo=python)](https://pypi.org/project/optimade/)<br>[![OPTiMaDe](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/master/.ci/optimade-version.json&logo=json)](https://github.com/Materials-Consortia/OPTiMaDe/) | [![Build Status](https://img.shields.io/github/workflow/status/Materials-Consortia/optimade-python-tools/Testing,%20linting,%20and%20OpenAPI%20validation?logo=github)](https://github.com/Materials-Consortia/optimade-python-tools/actions?query=branch%3Amaster+)<br>[![codecov](https://codecov.io/gh/Materials-Consortia/optimade-python-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/Materials-Consortia/optimade-python-tools)<br>[![Heroku](https://heroku-badge.herokuapp.com/?app=optimade&root=optimade/v0/info)](https://optimade.herokuapp.com/optimade/v0/info) | [![Commit Activity](https://img.shields.io/github/commit-activity/m/Materials-Consortia/optimade-python-tools?logo=github)](https://github.com/Materials-Consortia/optimade-python-tools/pulse) |
| [![PyPI Version](https://img.shields.io/pypi/v/optimade?logo=pypi)](https://pypi.org/project/optimade/)<br>[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/optimade?logo=python)](https://pypi.org/project/optimade/)<br>[![OPTiMaDe](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/master/.ci/optimade-version.json&logo=json)](https://github.com/Materials-Consortia/OPTiMaDe/) | [![Build Status](https://img.shields.io/github/workflow/status/Materials-Consortia/optimade-python-tools/Testing,%20linting,%20and%20OpenAPI%20validation?logo=github)](https://github.com/Materials-Consortia/optimade-python-tools/actions?query=branch%3Amaster+)<br>[![codecov](https://codecov.io/gh/Materials-Consortia/optimade-python-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/Materials-Consortia/optimade-python-tools)<br>[![Heroku](https://heroku-badge.herokuapp.com/?app=optimade&root=v0/info)](https://optimade.herokuapp.com/v0/info) | [![Commit Activity](https://img.shields.io/github/commit-activity/m/Materials-Consortia/optimade-python-tools?logo=github)](https://github.com/Materials-Consortia/optimade-python-tools/pulse) |

The aim of OPTiMaDe is to develop a common API, compliant with the [JSON API 1.0](http://jsonapi.org/format/1.0/) specification.
This is to enable interoperability among databases that contain calculated properties of existing and hypothetical materials.
Expand Down Expand Up @@ -30,14 +30,14 @@ This action runs `optimade_validator` from this repository on a running server.

### Example usage

To run `optimade_validator` for an index meta-database at `http://gh_actions_host:5001/optimade/v0` do the following:
To run `optimade_validator` for an index meta-database at `http://gh_actions_host:5001/v0` do the following:
Within the same job, first, start a server, e.g., using the `docker-compose.yml` setup from this repository, and then add the step

```yml
uses: Materials-Consortia/optimade-python-tools@master
with:
port: 5001
path: /optimade/v0
path: /v0
index: yes
```

Expand Down Expand Up @@ -77,8 +77,8 @@ with:
#### `path`

**Optional** Path for the OPTiMaDe (versioned) base URL - MUST start with `/`
_Note_: If `all versioned paths` is `true`, this MUST be un-versioned, e.g., `/optimade`, otherwise it MUST be versioned, e.g., the default value.
**Default**: `/optimade/v0`
_Note_: If `all versioned paths` is `true`, this MUST be un-versioned, e.g., `/optimade` or `/`, otherwise it MUST be versioned, e.g., the default value.
**Default**: `/v0`

#### `all versioned paths`

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
path:
description: Path of the OPTiMaDe (versioned) base URL - MUST start with '/'
required: false
default: /optimade/v0
default: /v0
all versioned paths:
description: >
Whether to test all possible versioned base URLs:
Expand Down
24 changes: 12 additions & 12 deletions openapi/index_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"version": "0.10.1"
},
"paths": {
"/optimade/v0/info": {
"/v0/info": {
"get": {
"tags": [
"Info"
],
"summary": "Get Info",
"operationId": "get_info_optimade_v0_info_get",
"operationId": "get_info_v0_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Get Info Optimade V0 Info Get",
"title": "Response Get Info V0 Info Get",
"anyOf": [
{
"$ref": "#/components/schemas/IndexInfoResponse"
Expand All @@ -35,13 +35,13 @@
}
}
},
"/optimade/v0/links": {
"/v0/links": {
"get": {
"tags": [
"Links"
],
"summary": "Get Links",
"operationId": "get_links_optimade_v0_links_get",
"operationId": "get_links_v0_links_get",
"parameters": [
{
"description": "A filter string, in the format described in section [API Filtering Format Specification](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#api-filtering-format-specification) of the [OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst).",
Expand All @@ -56,38 +56,38 @@
"in": "query"
},
{
"description": "The output format requested (see section [Response Format](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#response-format) in the spec). Defaults to the format string 'json', which specifies the standard output format described in this specification.\n**Example**: http://example.com/optimade/v0.9/structures?response_format=xml",
"description": "The output format requested (see section [Response Format](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#response-format) in the spec). Defaults to the format string 'json', which specifies the standard output format described in this specification.\n**Example**: http://example.com/v1/structures?response_format=xml",
"required": false,
"schema": {
"title": "Response Format",
"type": "string",
"description": "The output format requested (see section [Response Format](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#response-format) in the spec). Defaults to the format string 'json', which specifies the standard output format described in this specification.\n**Example**: http://example.com/optimade/v0.9/structures?response_format=xml",
"description": "The output format requested (see section [Response Format](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst#response-format) in the spec). Defaults to the format string 'json', which specifies the standard output format described in this specification.\n**Example**: http://example.com/v1/structures?response_format=xml",
"default": "json"
},
"name": "response_format",
"in": "query"
},
{
"description": "An email address of the user making the request. The email SHOULD be that of a person and not an automatic system.\n**Example**: http://example.com/optimade/v0.9/structures?email_address=user@example.com",
"description": "An email address of the user making the request. The email SHOULD be that of a person and not an automatic system.\n**Example**: http://example.com/v1/structures?email_address=user@example.com",
"required": false,
"schema": {
"title": "Email Address",
"type": "string",
"description": "An email address of the user making the request. The email SHOULD be that of a person and not an automatic system.\n**Example**: http://example.com/optimade/v0.9/structures?email_address=user@example.com",
"description": "An email address of the user making the request. The email SHOULD be that of a person and not an automatic system.\n**Example**: http://example.com/v1/structures?email_address=user@example.com",
"format": "email",
"default": ""
},
"name": "email_address",
"in": "query"
},
{
"description": "A comma-delimited set of fields to be provided in the output. If provided, these fields MUST be returned along with the REQUIRED fields. Other OPTIONAL fields MUST NOT be returned when this parameter is present.\n**Example**: http://example.com/optimade/v0.9/structures?response_fields=last_modified,nsites",
"description": "A comma-delimited set of fields to be provided in the output. If provided, these fields MUST be returned along with the REQUIRED fields. Other OPTIONAL fields MUST NOT be returned when this parameter is present.\n**Example**: http://example.com/v1/structures?response_fields=last_modified,nsites",
"required": false,
"schema": {
"title": "Response Fields",
"pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?",
"type": "string",
"description": "A comma-delimited set of fields to be provided in the output. If provided, these fields MUST be returned along with the REQUIRED fields. Other OPTIONAL fields MUST NOT be returned when this parameter is present.\n**Example**: http://example.com/optimade/v0.9/structures?response_fields=last_modified,nsites",
"description": "A comma-delimited set of fields to be provided in the output. If provided, these fields MUST be returned along with the REQUIRED fields. Other OPTIONAL fields MUST NOT be returned when this parameter is present.\n**Example**: http://example.com/v1/structures?response_fields=last_modified,nsites",
"default": ""
},
"name": "response_fields",
Expand Down Expand Up @@ -203,7 +203,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Links Optimade V0 Links Get",
"title": "Response Get Links V0 Links Get",
"anyOf": [
{
"$ref": "#/components/schemas/LinksResponse"
Expand Down