codapact 0.7.0__tar.gz → 0.8.0__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.
- codapact-0.8.0/.release-please-manifest.json +1 -0
- {codapact-0.7.0 → codapact-0.8.0}/CHANGELOG.md +7 -0
- {codapact-0.7.0 → codapact-0.8.0}/PKG-INFO +1 -1
- {codapact-0.7.0 → codapact-0.8.0}/docs/configuration.md +1 -1
- {codapact-0.7.0 → codapact-0.8.0}/pyproject.toml +1 -1
- {codapact-0.7.0 → codapact-0.8.0}/pyproject.toml.orig +1 -1
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/__init__.py +1 -1
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/cli.py +21 -3
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/python/cli.py +4 -1
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_cli_builtins.py +11 -0
- {codapact-0.7.0 → codapact-0.8.0}/uv.lock +1 -1
- codapact-0.7.0/.release-please-manifest.json +0 -1
- {codapact-0.7.0 → codapact-0.8.0}/.github/workflows/ci.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/.github/workflows/codeql.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/.github/workflows/mutation.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/.github/workflows/nightly.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/.github/workflows/release.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/LICENSE +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/README.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/docs/architecture.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/docs/branding/README.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/docs/branding/mark.svg +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/docs/branding/wordmark.svg +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/docs/testing.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/examples/library/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/examples/library/operations.graphql +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/examples/library/schema.graphql +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/examples/petstore/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/examples/petstore/openapi.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/release-please-config.json +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/scripts/extract_openapi_subset.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/scripts/mutation_score.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/scripts/verify_dist.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/__main__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/commands/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/commands/derive.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/commands/model.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/core/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/core/diagnostics.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/core/errors.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/core/naming.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/core/net.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/api.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/authspec.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/migrations.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/rewrite.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/serialize.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/types.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/validate.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/model/values.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/cli.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/config.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/defaults.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/pipeline.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/sync.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/pipeline/writer.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/plugins/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/plugins/external.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/plugins/protocol.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/plugins/registry.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/py.typed +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/abstractions.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/arguments.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/auth.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/cli_auth.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/cli_tools.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/client.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/codec.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/credentials.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/errors.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/middleware.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/oauth.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/profiles.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/protocols/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/protocols/base.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/protocols/graphql.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/protocols/http.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/runtime/selftest.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/shaping/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/shaping/base.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/shaping/engine.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/shaping/transforms.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/base.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/graphql/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/graphql/translator.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/loader.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/openapi/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/sources/openapi/translator.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/surface/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/surface/derive.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/surface/model.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/python/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/python/e2e.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/python/library.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/python/naming.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/typescript/__init__.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/typescript/library.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/src/codapact/targets/typescript/runtime.ts +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/authlab.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/conftest.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/e2e/test_auth_e2e.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/e2e/test_cli_e2e.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/e2e/test_public_apis.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/authlab/authlab_plugin.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/authlab/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/authlab/fake_browser.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/authlab/openapi.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/authlab_smoke.ts +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/contracts/wire.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/README.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/countries/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/countries/operations.graphql +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/countries/schema.graphql +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/github/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/github/openapi.json +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/pokeapi/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/pokeapi/openapi.yml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/ynab/README.md +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/ynab/codapact.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/corpus/ynab/openapi.yaml +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/library_smoke.ts +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/outline_plugin.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/petstore_smoke.ts +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/fixtures/wire_parity.ts +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_cli_conformance.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_cli_conventions.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_contract_properties.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_corpus.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_generated_code_properties.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_generation.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_public_api_cli.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_wire_parity.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/integration/test_ynab_contract.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/perf/test_scaling.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/public_api_contract.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/strategies.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/support.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_architecture.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_auth_and_graphql_sources.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_auth_sources.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_bundle_e2e.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_cli_auth.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_cli_options.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_codec_serialize.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_core.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_credential_fields.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_env_prefix.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_guards.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_live_ynab_findings.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_model.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_mutation_score.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_oauth.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_openapi_edges.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_openapi_translator_units.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_plugins_pipeline.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_profiles.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_public_api_findings.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_runtime.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_runtime_edges.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_runtime_pagination.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_shaping_surface_commands.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_sources.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_sync.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_target_rendering.py +0 -0
- {codapact-0.7.0 → codapact-0.8.0}/tests/unit/test_usability.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.8.0"}
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- markdownlint-configure-file { "MD024": { "siblings_only": true } } -->
|
|
4
4
|
|
|
5
|
+
## [0.8.0](https://github.com/mikejhill/codapact/compare/v0.7.0...v0.8.0) (2026-11-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **cli:** report the installed distribution's version ([#49](https://github.com/mikejhill/codapact/issues/49)) ([d7d663d](https://github.com/mikejhill/codapact/commit/d7d663d611548534e3657b1ffc6ec8a048ebc96d))
|
|
11
|
+
|
|
5
12
|
## [0.7.0](https://github.com/mikejhill/codapact/compare/v0.6.1...v0.7.0) (2026-11-14)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -164,7 +164,7 @@ result is the item list, so `[].name`; a path that matches nothing fails with ex
|
|
|
164
164
|
| Need | How |
|
|
165
165
|
| --- | --- |
|
|
166
166
|
| Help | `-h`/`--help` on every level; bare `<program>` or `<program> GROUP` prints help (exit `0`). Command help has a usage line with positionals and required options, examples, and a global-options reminder. |
|
|
167
|
-
| Version | `-V`/`--version`: `poke 0.1.0 (PokéAPI 2.10.0; codapact 0.4.0)` |
|
|
167
|
+
| Version | `-V`/`--version`: `poke 0.1.0 (PokéAPI 2.10.0; codapact 0.4.0)`; the installed distribution's version when it differs from the generated `version` option (so a release tool can bump packaging alone) |
|
|
168
168
|
| Discovery for agents | `<program> describe [COMMAND…]`: JSON with every command's arguments (type, required, positional, choices, repeated), `read_only`/`destructive`/`paginated`, `requires_one_of` option groups, environment variables, exit codes. `describe --brief` keeps only names, summaries, and usage lines. Naming one command (or passing `--schemas`) adds the JSON Schema of its output and of each JSON-valued argument |
|
|
169
169
|
| Diagnosis | `<program> doctor [--offline]`: version, settings file, base URL and its source, credentials (set or missing, never printed), proxy, connectivity. Table on a terminal, JSON otherwise; exit `1` when a check fails |
|
|
170
170
|
| Completion | `<program> completion bash\|zsh\|fish\|powershell` prints a script that asks the program for candidates |
|
|
@@ -9,6 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
import argparse
|
|
11
11
|
import difflib
|
|
12
|
+
import importlib.metadata
|
|
12
13
|
import json
|
|
13
14
|
import os
|
|
14
15
|
import re
|
|
@@ -290,6 +291,23 @@ class CliRuntime:
|
|
|
290
291
|
"""Default ``package.module:factory`` auth plugin (``cli.auth_plugin`` in codapact.yaml)."""
|
|
291
292
|
auth_config: Mapping[str, Mapping[str, Any]] | None = None
|
|
292
293
|
"""Per-scheme OAuth defaults baked in at generation (``cli.auth`` in codapact.yaml)."""
|
|
294
|
+
distribution: str = ""
|
|
295
|
+
"""Installed distribution name; its metadata version wins over ``version``."""
|
|
296
|
+
|
|
297
|
+
@property
|
|
298
|
+
def program_version(self) -> str:
|
|
299
|
+
"""Return the installed distribution's version, else the generated ``version``.
|
|
300
|
+
|
|
301
|
+
Packaging may set the release version outside the generated code (for example a
|
|
302
|
+
hand-written ``pyproject.toml`` that release tooling bumps), so the installed
|
|
303
|
+
metadata is the source of truth when it exists.
|
|
304
|
+
"""
|
|
305
|
+
if self.distribution:
|
|
306
|
+
try:
|
|
307
|
+
return importlib.metadata.version(self.distribution)
|
|
308
|
+
except importlib.metadata.PackageNotFoundError:
|
|
309
|
+
pass
|
|
310
|
+
return self.version
|
|
293
311
|
|
|
294
312
|
@property
|
|
295
313
|
def env(self) -> dict[str, str]:
|
|
@@ -326,7 +344,7 @@ class CliRuntime:
|
|
|
326
344
|
"""Return ``program version (API version; codapact version)``."""
|
|
327
345
|
api = f"{self.api_name} {self.api_version}".strip()
|
|
328
346
|
parts = [p for p in (api, f"codapact {__version__}") if p]
|
|
329
|
-
return f"{self.program} {self.
|
|
347
|
+
return f"{self.program} {self.program_version or '0.0.0'} ({'; '.join(parts)})"
|
|
330
348
|
|
|
331
349
|
def epilog(self, credentials: str = "", examples: Sequence[str] = ()) -> str:
|
|
332
350
|
"""Return the root help epilog: examples, credentials, settings, exit codes."""
|
|
@@ -867,7 +885,7 @@ class CliRuntime:
|
|
|
867
885
|
if name == "describe":
|
|
868
886
|
header = {
|
|
869
887
|
"program": self.program,
|
|
870
|
-
"version": self.
|
|
888
|
+
"version": self.program_version,
|
|
871
889
|
"api": {"name": self.api_name, "version": self.api_version},
|
|
872
890
|
"usage": f"{self.program} [global options] COMMAND [arguments]",
|
|
873
891
|
"global_options": _global_options(parser),
|
|
@@ -896,7 +914,7 @@ class CliRuntime:
|
|
|
896
914
|
return EXIT_OK
|
|
897
915
|
doctor = cli_tools.Doctor(
|
|
898
916
|
program=self.program,
|
|
899
|
-
version=self.
|
|
917
|
+
version=self.program_version,
|
|
900
918
|
env_prefix=self.env_prefix,
|
|
901
919
|
env=self.env,
|
|
902
920
|
load_model=load_model,
|
|
@@ -48,6 +48,7 @@ class PythonCliTarget:
|
|
|
48
48
|
request.api.docs or request.api.name,
|
|
49
49
|
_auth_help(request),
|
|
50
50
|
version=options.version,
|
|
51
|
+
distribution=options.distribution,
|
|
51
52
|
api_name=request.api.name,
|
|
52
53
|
api_version=request.api.version,
|
|
53
54
|
auth_plugin=str(request.options.get("auth_plugin") or ""),
|
|
@@ -144,6 +145,7 @@ def render_cli(
|
|
|
144
145
|
auth_help: str = "",
|
|
145
146
|
*,
|
|
146
147
|
version: str = "0.1.0",
|
|
148
|
+
distribution: str = "",
|
|
147
149
|
api_name: str = "",
|
|
148
150
|
api_version: str = "",
|
|
149
151
|
auth_plugin: str = "",
|
|
@@ -157,7 +159,8 @@ def render_cli(
|
|
|
157
159
|
credentials = f"credentials:\n{auth_help}" if auth_help else ""
|
|
158
160
|
runtime = (
|
|
159
161
|
f"CliRuntime(program={program!r}, env_prefix={tree.env_prefix!r}, "
|
|
160
|
-
f"version={version!r},
|
|
162
|
+
f"version={version!r}, distribution={distribution!r}, "
|
|
163
|
+
f"api_name={api_name!r}, api_version={api_version!r}, "
|
|
161
164
|
f"model=_api_model, auth_plugin={auth_plugin!r}, auth_config={auth_config or {}!r})"
|
|
162
165
|
)
|
|
163
166
|
head = [
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import argparse
|
|
6
|
+
import importlib.metadata
|
|
6
7
|
import io
|
|
7
8
|
import json
|
|
8
9
|
import warnings
|
|
@@ -67,6 +68,16 @@ def test_version_line_and_epilog() -> None:
|
|
|
67
68
|
assert "credentials:\n login" in runtime().epilog("credentials:\n login")
|
|
68
69
|
|
|
69
70
|
|
|
71
|
+
def test_program_version_prefers_installed_distribution() -> None:
|
|
72
|
+
installed = importlib.metadata.version("pytest")
|
|
73
|
+
rt = CliRuntime("x", "X", {}, version="0.1.0", distribution="pytest")
|
|
74
|
+
assert rt.program_version == installed
|
|
75
|
+
assert rt.version_line().startswith(f"x {installed} (")
|
|
76
|
+
missing = CliRuntime("x", "X", {}, version="0.1.0", distribution="no-such-dist-codapact")
|
|
77
|
+
assert missing.program_version == "0.1.0"
|
|
78
|
+
assert CliRuntime("x", "X", {}, version="0.1.0").program_version == "0.1.0"
|
|
79
|
+
|
|
80
|
+
|
|
70
81
|
def test_improve_messages() -> None:
|
|
71
82
|
parser = tree()
|
|
72
83
|
many = ", ".join(repr(str(n)) for n in range(12))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{".":"0.7.0"}
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|