Skip to content

Commit

Permalink
Refactor project with builds and scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
  • Loading branch information
Swiddis committed Apr 4, 2023
1 parent b921d94 commit a7fa6f8
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 4 deletions.
49 changes: 49 additions & 0 deletions scripts/integrations-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Integrations CLI

## Description

This is a CLI tool for creating, validating, and maintaining OpenSearch Dashboard Integrations.
The tool has three main functions:

- `create` a new integration with a specified configuration.
- `check` an integration for validity
- `package` an integration to be upload to an OpenSearch Integrations instance

## Installation

The project is managed with [Poetry](https://python-poetry.org/).
After installing Poetry, install dependencies:

```sh
$ poetry install
Installing dependencies from lock file
```

## Usage

The CLI can be run with:

```sh
$ poetry run cli
Usage: cli.cmd [OPTIONS] COMMAND [ARGS]...
```

If you don't want to prefix everything

## Development

For development, there are a few scripts to help:

```sh
$ poetry run test
...
OK

$ poetry run format
...
All done!
```

## License

This project, like the rest of the OpenSearch projects, is licensed under the Apache 2.0 License.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from returns.result import Result
from termcolor import colored

import helpers
import integrations_cli.helpers as helpers


@click.group()
Expand Down
5 changes: 5 additions & 0 deletions scripts/integrations-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ description = "CLI for managing OpenSearch Integrations"
authors = ["Simeon Widdis <sawiddis@amazon.com>"]
license = "Apache-2.0"

[tool.poetry.scripts]
cli = "integrations_cli.main:integrations_cli"
test = "scripts:test"
format = "scripts:format"

[tool.isort]
profile = "black"

Expand Down
17 changes: 17 additions & 0 deletions scripts/integrations-cli/scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import subprocess


def test():
"""
Run all unittests. Equivalent to:
`poetry run python -u -m unittest discover`
"""
subprocess.run(["python", "-u", "-m", "unittest", "discover"])


def format():
"""
Reformat all code. Equivalent to:
`poetry run black .`
"""
subprocess.run(["black", "."])
6 changes: 3 additions & 3 deletions scripts/integrations-cli/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import jsonschema
from returns.pipeline import is_successful

import helpers.constants as constants
import helpers.validate as validate
from helpers.catalog import _load_catalog_file
import integrations_cli.helpers.constants as constants
import integrations_cli.helpers.validate as validate
from integrations_cli.helpers.catalog import _load_catalog_file


class TestSchemas(unittest.TestCase):
Expand Down

0 comments on commit a7fa6f8

Please sign in to comment.