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

Even more spring cleaning #125

Merged
merged 5 commits into from
Sep 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,27 @@ jobs:
needs: lint
strategy:
fail-fast: true
max-parallel: 1
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
environment:
- development
- staging
include:
- environment: development
url: TESTING_DEV_API_URL
token: TESTING_DEV_TOKEN
org_id: TESTING_DEV_ORG_ID
- environment: staging
url: TESTING_STAGING_API_URL
token: TESTING_STAGING_TOKEN
org_id: TESTING_STAGING_ORG_ID
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install uv
uses: astral-sh/setup-uv@v2
- run: uv run pytest
- name: Test against development
run: uv run pytest
env:
AXIOM_URL: ${{ secrets[matrix.url] }}
AXIOM_TOKEN: ${{ secrets[matrix.token] }}
AXIOM_ORG_ID: ${{ secrets[matrix.org_id] }}
AXIOM_URL: ${{ secrets.TESTING_DEV_API_URL }}
AXIOM_TOKEN: ${{ secrets.TESTING_DEV_TOKEN }}
AXIOM_ORG_ID: ${{ secrets.TESTING_DEV_ORG_ID }}
- name: Test against staging
run: uv run pytest
env:
AXIOM_URL: ${{ secrets.TESTING_STAGING_API_URL }}
AXIOM_TOKEN: ${{ secrets.TESTING_STAGING_TOKEN }}
AXIOM_ORG_ID: ${{ secrets.TESTING_STAGING_ORG_ID }}

publish:
name: Publish on PyPi
Expand Down
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: ruff-check
name: ruff check --fix
entry: uv run ruff check --fix
language: system
types: [python]
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types: [python]
2 changes: 0 additions & 2 deletions .pylintrc

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ For a full example, see [`examples/logger.py`](examples/logger.py).
This project uses [uv](https://docs.astral.sh/uv) for dependency management
and packaging, so make sure that this is installed.

To lint and format files before commit, run `uvx pre-commit install`.

## License

Distributed under MIT License (`The MIT License`).
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ dev-dependencies = [
"responses>=0.25.3",
"rfc3339>=6.2",
"iso8601>=1.0.2",
"pre-commit>=3.5.0",
]
8 changes: 0 additions & 8 deletions shell.nix

This file was deleted.

5 changes: 4 additions & 1 deletion tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def setUpClass(cls):
cls.client.datasets.create(req)

def test_happy_path_crud(self):
"""Test the happy path of creating, reading, updating, and deleting an annotation."""
"""
Test the happy path of creating, reading, updating, and deleting an
annotation.
"""
# Create annotation
req = AnnotationCreateRequest(
datasets=[self.dataset_name],
Expand Down
3 changes: 2 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def test_step001_ingest(self):
opts = IngestOptions(
"_time",
"2/Jan/2006:15:04:05 +0000",
# CSV_delimiter obviously not valid for JSON, but perfectly fine to test for its presence in this test.
# CSV_delimiter obviously not valid for JSON, but perfectly fine to
# test for its presence in this test.
";",
)
res = self.client.ingest(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def test_step999_delete(self):
f"expected test dataset (%{self.dataset_name}) to be deleted",
)
except HTTPError as err:
# the get method returns 404 error if dataset doesn't exist, so that means
# that our tests passed, otherwise, it should fail.
# the get method returns 404 error if dataset doesn't exist, so
# that means that our tests passed, otherwise, it should fail.
if err.response.status_code != 404:
self.fail(err)

Expand Down