verifaied 0.1.0.dev23__tar.gz → 0.1.0.dev25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/PKG-INFO +7 -4
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/README.md +6 -3
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/pyproject.toml +1 -1
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/config.py +7 -5
- verifaied-0.1.0.dev25/tests/test_config.py +73 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/.gitignore +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/__init__.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/__main__.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/cli.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/client.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/src/verifaied/uploader.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/tests/__init__.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/tests/test_cli.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/tests/test_client.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/tests/test_uploader.py +0 -0
- {verifaied-0.1.0.dev23 → verifaied-0.1.0.dev25}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: verifaied
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev25
|
|
4
4
|
Summary: Upload local pytest coverage to verifAIed for instant feedback
|
|
5
5
|
Project-URL: Homepage, https://pypi.org/project/verifaied/
|
|
6
6
|
Author: Kyle Richards
|
|
@@ -29,12 +29,15 @@ pipx install verifaied
|
|
|
29
29
|
|
|
30
30
|
## Configure
|
|
31
31
|
|
|
32
|
-
Set the API token (mint one from the verifAIed app)
|
|
33
|
-
|
|
32
|
+
Set the API token (mint one from the verifAIed app). The CLI ships
|
|
33
|
+
pointing at the hosted verifAIed API (`https://api.verifaied.app`) by
|
|
34
|
+
default; point it elsewhere via `VERIFAIED_API_URL` if you're running
|
|
35
|
+
the backend locally or self-hosting:
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
38
|
export VERIFAIED_API_TOKEN=vr_live_...
|
|
37
|
-
|
|
39
|
+
# Only set this if you're not using the hosted API:
|
|
40
|
+
export VERIFAIED_API_URL=http://localhost:8000 # local dev
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
## Use
|
|
@@ -11,12 +11,15 @@ pipx install verifaied
|
|
|
11
11
|
|
|
12
12
|
## Configure
|
|
13
13
|
|
|
14
|
-
Set the API token (mint one from the verifAIed app)
|
|
15
|
-
|
|
14
|
+
Set the API token (mint one from the verifAIed app). The CLI ships
|
|
15
|
+
pointing at the hosted verifAIed API (`https://api.verifaied.app`) by
|
|
16
|
+
default; point it elsewhere via `VERIFAIED_API_URL` if you're running
|
|
17
|
+
the backend locally or self-hosting:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
export VERIFAIED_API_TOKEN=vr_live_...
|
|
19
|
-
|
|
21
|
+
# Only set this if you're not using the hosted API:
|
|
22
|
+
export VERIFAIED_API_URL=http://localhost:8000 # local dev
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Use
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"""Env-var defaults for the CLI.
|
|
2
2
|
|
|
3
3
|
Kept thin on purpose — every option is also a CLI flag, so this module
|
|
4
|
-
exists only to centralize the env-var *names* and the
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
exists only to centralize the env-var *names* and the default backend
|
|
5
|
+
URL. The default points at the hosted verifAIed API so
|
|
6
|
+
``pip install verifaied && verifaied upload`` works with no extra
|
|
7
|
+
configuration; local dev sets ``VERIFAIED_API_URL=http://localhost:8000``
|
|
8
|
+
in `.env`. No filesystem config files (yet); we follow the 12-factor
|
|
9
|
+
convention so the CLI behaves the same in shell, pre-commit hooks, and CI.
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
12
|
from __future__ import annotations
|
|
@@ -14,7 +16,7 @@ import os
|
|
|
14
16
|
ENV_API_URL = "VERIFAIED_API_URL"
|
|
15
17
|
ENV_API_TOKEN = "VERIFAIED_API_TOKEN"
|
|
16
18
|
|
|
17
|
-
DEFAULT_API_URL = "
|
|
19
|
+
DEFAULT_API_URL = "https://api.verifaied.app"
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
def resolved_api_url(override: str | None) -> str:
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Tests for the resolve-with-env-fallback helpers in ``verifaied.config``.
|
|
2
|
+
|
|
3
|
+
Covers:
|
|
4
|
+
- The prod default URL used when nothing else is set.
|
|
5
|
+
- The precedence chain (explicit override > env var > default).
|
|
6
|
+
- The token resolver (env var vs override, no default).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
13
|
+
from verifaied.config import (
|
|
14
|
+
DEFAULT_API_URL,
|
|
15
|
+
ENV_API_TOKEN,
|
|
16
|
+
ENV_API_URL,
|
|
17
|
+
resolved_api_token,
|
|
18
|
+
resolved_api_url,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_default_api_url_points_at_prod():
|
|
23
|
+
# Guards against an accidental revert to localhost — the CLI is a public
|
|
24
|
+
# PyPI package and its default must reach the hosted API.
|
|
25
|
+
assert DEFAULT_API_URL == "https://api.verifaied.app"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_resolved_api_url_returns_default_when_no_override_and_no_env(monkeypatch):
|
|
29
|
+
monkeypatch.delenv(ENV_API_URL, raising=False)
|
|
30
|
+
assert resolved_api_url(None) == "https://api.verifaied.app"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_resolved_api_url_uses_env_when_set(monkeypatch):
|
|
34
|
+
monkeypatch.setenv(ENV_API_URL, "http://localhost:8000")
|
|
35
|
+
assert resolved_api_url(None) == "http://localhost:8000"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_resolved_api_url_override_beats_env(monkeypatch):
|
|
39
|
+
monkeypatch.setenv(ENV_API_URL, "http://from-env")
|
|
40
|
+
assert resolved_api_url("http://from-override") == "http://from-override"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_resolved_api_url_override_beats_missing_env(monkeypatch):
|
|
44
|
+
monkeypatch.delenv(ENV_API_URL, raising=False)
|
|
45
|
+
assert resolved_api_url("http://from-override") == "http://from-override"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_resolved_api_token_returns_env_value(monkeypatch):
|
|
49
|
+
monkeypatch.setenv(ENV_API_TOKEN, "vr_live_from_env")
|
|
50
|
+
assert resolved_api_token(None) == "vr_live_from_env"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_resolved_api_token_returns_none_when_missing(monkeypatch):
|
|
54
|
+
monkeypatch.delenv(ENV_API_TOKEN, raising=False)
|
|
55
|
+
assert resolved_api_token(None) is None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_resolved_api_token_override_beats_env(monkeypatch):
|
|
59
|
+
monkeypatch.setenv(ENV_API_TOKEN, "vr_live_from_env")
|
|
60
|
+
assert resolved_api_token("vr_live_from_override") == "vr_live_from_override"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@pytest.mark.parametrize("override", ["", " ", "\t"])
|
|
64
|
+
def test_resolved_api_url_treats_empty_override_as_falsy(monkeypatch, override):
|
|
65
|
+
# `--api-url ""` on the command line shouldn't override the env / default:
|
|
66
|
+
# the falsy check `override or ...` skips it in favour of the next source.
|
|
67
|
+
monkeypatch.setenv(ENV_API_URL, "http://from-env")
|
|
68
|
+
# Whitespace-only strings are still truthy for `or`, so the env only wins
|
|
69
|
+
# for the literal empty string. Assert both behaviours explicitly.
|
|
70
|
+
if override == "":
|
|
71
|
+
assert resolved_api_url(override) == "http://from-env"
|
|
72
|
+
else:
|
|
73
|
+
assert resolved_api_url(override) == override
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|