Skip to content

Commit cfc770d

Browse files
Merge pull request #118 from cortexapps/typer
Rewrite based on typer CLI library
2 parents 4fd358f + 3fbbc05 commit cfc770d

File tree

403 files changed

+10308
-6314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+10308
-6314
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# the repo. Unless a later match takes precedence,
66
# @global-owner1 and @global-owner2 will be requested for
77
# review when someone opens a pull request.
8-
* @jeff-schnitter @rich-jay
8+
* @jeff-schnitter

.github/workflows/test-pr.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ on:
1212
env:
1313
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
1414
CORTEX_API_KEY: ${{ secrets.CORTEX_API_KEY }}
15-
CORTEX_API_KEY_RICH_SANDBOX: ${{ secrets.CORTEX_API_KEY_RICH_SANDBOX }}
1615
CORTEX_API_KEY_VIEWER: ${{ secrets.CORTEX_API_KEY_VIEWER }}
1716
CORTEX_BASE_URL: ${{ vars.CORTEX_BASE_URL }}
18-
GH_PAT: ${{ secrets.GH_PAT }}
19-
GH_WEBHOOK_SECRET: ${{ secrets.GH_WEBHOOK_SECRET }}
20-
CORTEX_GH_WEBHOOK_URL: ${{ vars.CORTEX_GH_WEBHOOK_URL }}
2117

2218
jobs:
2319
test:
@@ -41,6 +37,7 @@ jobs:
4137

4238
- name: Install dependencies
4339
run: |
40+
sudo apt update && sudo apt install just
4441
python -m pip install --upgrade pip
4542
pip install poetry poetry-audit-plugin pytest-cov pytest pytest-xdist
4643
@@ -53,11 +50,6 @@ jobs:
5350
echo "[default]" > $HOME/.cortex/config
5451
echo "api_key = $CORTEX_API_KEY" >> $HOME/.cortex/config
5552
echo "base_url = $CORTEX_BASE_URL" >> $HOME/.cortex/config
56-
echo "[rich-sandbox]" >> $HOME/.cortex/config
57-
echo "api_key = $CORTEX_API_KEY_RICH_SANDBOX" >> $HOME/.cortex/config
58-
pwd
59-
ls -l $HOME/.cortex
60-
cat $HOME/.cortex/config
6153
shell: bash
6254

6355
- name: Install package
@@ -67,4 +59,4 @@ jobs:
6759
6860
- name: Test with pytest
6961
run: |
70-
make all-cli
62+
just test-all

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ coverage.json
1010
.github/workflows/test.yml
1111
.export
1212
report.html
13+
import.html
14+
report*.html
15+
.load-data-done
16+

HISTORY.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
Release History
22
===============
33

4+
1.0.0 (2025-06-13)
5+
------------------
6+
7+
**Improvements**
8+
- A complete re-write centered around the [typer library](https://typer.tiangolo.com/) and better code modularization
9+
- Added sub-commands:
10+
- api-keys
11+
- custom-metrics
12+
- initiatives
13+
- workflows
14+
- Removed sub-commands:
15+
- team hieararchies
16+
- added `--table` and `--csv` options to list commands
17+
18+
**Breaking Changes**
19+
- custom-events -i timestamp changed to -ts timestamp
20+
- plugins `get` command changed to `list`
21+
- plugins `get-by-tag` subcommand changed to `get`
22+
- `resource-definitions` command changed to `entity-types`
23+
424
0.27.0 (2025-01-04)
525
------------------
626

Justfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cortex_cli := 'poetry run cortex'
2+
pytest := 'PYTHONPATH=. poetry run pytest -rA'
3+
4+
export CORTEX_API_KEY := env('CORTEX_API_KEY')
5+
export CORTEX_BASE_URL := env('CORTEX_BASE_URL', "https://api.getcortexapp.com")
6+
export CORTEX_API_KEY_VIEWER := env('CORTEX_API_KEY_VIEWER')
7+
8+
help:
9+
@just -l
10+
11+
_setup:
12+
@if [ -f .coverage ]; then rm .coverage; fi
13+
14+
# Run all tests
15+
test-all: _setup test-parallel test-serial
16+
17+
# Run tests that can run in parallel
18+
test-parallel: test-import
19+
{{pytest}} -n auto -m "not setup and not serial" --html=report-parallel.html --self-contained-html --cov=cortexapps_cli --cov-append --cov-report term-missing tests
20+
21+
# Run all tests serially - helpful to see if any tests seem to be hanging
22+
_test-all-individual: test-import
23+
{{pytest}} --html=report-all-invidual.html --self-contained-html --cov=cortexapps_cli --cov-append --cov-report term-missing tests
24+
25+
# Run tests that have to run sequentially
26+
test-serial: test-import
27+
{{pytest}} -n auto -m "serial" --html=report-serial.html --self-contained-html --cov=cortexapps_cli --cov-append --cov-report term-missing tests
28+
29+
# Run import test, a pre-requisite for any tests that rely on test data.
30+
test-import:
31+
{{pytest}} tests/test_import.py --cov=cortexapps_cli --cov-report=
32+
33+
# Run a single test, ie: just test tests/test_catalog.py
34+
test testname:
35+
{{pytest}} {{testname}}

Makefile

Lines changed: 0 additions & 268 deletions
This file was deleted.

0 commit comments

Comments
 (0)