Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
e980585
update the unlist and unlist_incexcl functions
DylanWelzel Aug 30, 2024
ab7952f
add tests for each function
DylanWelzel Aug 30, 2024
cefeca5
move unlist helper functions outside
DylanWelzel Sep 17, 2024
fb13da2
add comments for internal helper functions
DylanWelzel Sep 18, 2024
bb5b3b3
Improve index error messaging (#351)
ctrl-schaff Sep 30, 2024
a3ecb92
Hide cloud credentials when finding snapshots
DylanWelzel Oct 11, 2024
65ec46a
added more detailed error logging for when the temporary collection c…
jal347 Nov 12, 2024
bf9d35d
fix: :bug: an issue when calling load_json
newgene Nov 12, 2024
a2973d0
add postgresql collection class
DylanWelzel Nov 5, 2024
c5987fb
add tests for postgresql collection class
DylanWelzel Nov 5, 2024
c638bfa
fix import in test
DylanWelzel Nov 5, 2024
b4ab233
fix imports
DylanWelzel Nov 5, 2024
dae48c6
fix codacy issues
DylanWelzel Nov 12, 2024
0b7f21a
add sync_snapshots functionality
DylanWelzel Oct 16, 2024
9ce1e9e
use keyword args
DylanWelzel Oct 16, 2024
3774770
fix keyword argument
DylanWelzel Oct 16, 2024
4dd03a6
use keyword args in cleanup method
DylanWelzel Oct 17, 2024
772baf8
handle undefined environments
DylanWelzel Oct 17, 2024
22ed1f0
handle unregistered environment
DylanWelzel Oct 17, 2024
d676d60
update missing environment message
DylanWelzel Oct 17, 2024
bc062f0
move key error catch for both legacy and current formats
DylanWelzel Oct 17, 2024
aee5e75
add not found err message
DylanWelzel Oct 17, 2024
5fd6c12
use workers
DylanWelzel Oct 22, 2024
8dc859e
change sync to validate
DylanWelzel Oct 22, 2024
1e7746c
update sync to validate in commands
DylanWelzel Oct 22, 2024
947423d
add ignore errors logic
DylanWelzel Oct 24, 2024
9b3ceb7
handle delete_snapshots body args
DylanWelzel Oct 24, 2024
9b08b55
remove f strings from logging messages
DylanWelzel Oct 25, 2024
4854677
handle merge conflict
DylanWelzel Oct 25, 2024
e05134d
fix codacy errors
DylanWelzel Nov 12, 2024
99d12f3
fix line too long in snapshooter
DylanWelzel Nov 12, 2024
eb27c34
add SnapshotManager method doc strings
DylanWelzel Nov 12, 2024
7883da1
add doc strings in snapshot_cleanup
DylanWelzel Nov 12, 2024
af098fc
corrected order of checks for temp_collection in switch_collection
jal347 Nov 13, 2024
fb7a019
Fix the logic for table_space assignment
Nov 13, 2024
03a774c
Leverage the findv2 over find due to counting (#366)
ctrl-schaff Dec 13, 2024
abf9fa2
use .get to avoid key error
DylanWelzel Dec 30, 2024
020b6e4
Apply black formatting to the main repository base (#374)
ctrl-schaff Jan 10, 2025
5243b52
Update our CLI tooling initialization and debug messaging (#367)
ctrl-schaff Jan 14, 2025
ccedaa3
Cleanup the cli module imports (#375)
ctrl-schaff Jan 15, 2025
7047159
changed to have query work on an empty body (#378)
jal347 Jan 18, 2025
666821f
Remove cgi dependency (#379)
ctrl-schaff Jan 23, 2025
e4a3ae0
Add build and index support to the command-line tooling (biothings-cl…
ctrl-schaff Jan 24, 2025
5d108ff
Provide manifest validation and improved error messages upon invalid …
ctrl-schaff Jan 25, 2025
d3fc93d
fixed assistantmanager import issue (#383)
jal347 Feb 3, 2025
2d15ffb
Modify biothings jsonschema namespace (#370)
ctrl-schaff Feb 3, 2025
a4f3e16
Redirect pip show output to /dev/null (#385)
ctrl-schaff Feb 5, 2025
4a1605c
build: :arrow_up: upgraded typer package version
newgene Feb 5, 2025
13616d9
build: :arrow_up: upgraded tornado package version
newgene Feb 5, 2025
b909ff1
Update from loader to loaders module (#386)
ctrl-schaff Feb 6, 2025
70513ef
Update the loader import path to be absolute (#387)
ctrl-schaff Feb 6, 2025
fa5fad6
Update asyncssh dependency (2.11.0 -> 2.19.0) (#389)
ctrl-schaff Feb 20, 2025
612fdf1
Plugin directory loading error (#388)
ctrl-schaff Feb 25, 2025
b35f744
Suppress INFO logs for elastic_transport.transport. (#390)
everaldorodrigo Mar 19, 2025
26b7463
Add BulkIndexError exception to the indexer task.
everaldorodrigo Jan 28, 2025
36d40ba
Use lazy % formatting in logging function
everaldorodrigo Jan 28, 2025
b68f5d0
refactor: :recycle: add an optional logger parameter
newgene Apr 3, 2025
d010efd
Data source registration cleanup (#361)
ctrl-schaff Apr 8, 2025
de2ff77
Re-add the os import to manager module
ctrl-schaff Apr 8, 2025
57b3dc5
Fix mutation in metadata endpoint. (#392)
everaldorodrigo Apr 8, 2025
e06dc2b
Refactor: Improve meta dictionary filtering logic. (#394)
everaldorodrigo Apr 11, 2025
442548c
Set Github Action Tests on Pull Request (#395)
everaldorodrigo Apr 11, 2025
ae0f6a9
Upgrade ES to 8.17.0 and python to 3.12. Also fix some tests from bra…
everaldorodrigo Apr 14, 2025
4892863
Validator for Biothings Studio Plugin (#382)
jal347 Apr 16, 2025
b0bc0bd
setup disable property for basic and advanced plugins
DylanWelzel Apr 15, 2025
b52481f
make lowercase to match manifest syntax
DylanWelzel Apr 15, 2025
93a7306
fix setting property
DylanWelzel Apr 15, 2025
f7fd86e
CLI index command enhancement(#391)
ctrl-schaff Apr 28, 2025
2201b57
Cleanup biothings test infrastructure and discovery (#397)
ctrl-schaff Apr 28, 2025
1ac8563
build: :building_construction: switch to use pyproject.toml for packa…
newgene May 1, 2025
2e110e7
fix: :pencil2: fixed a typo
newgene May 1, 2025
a377e51
build: :package: updated package version to 1.0.0
newgene May 1, 2025
08f9a24
ci: :construction_worker: fixing github actions for new pyproject.yaml
newgene May 1, 2025
4dd1694
build: :package: fix license field for Python 3.8
newgene May 1, 2025
44f3667
build: :heavy_minus_sign: remove aiocron from cli dependencies
newgene May 1, 2025
e082ddc
build: :heavy_minus_sign: remove python-dateutil as direct dependency
newgene May 1, 2025
fcd5e89
build: :package: switch to use git module intead
newgene May 1, 2025
4a65437
build: :wrench: remove unused MANUFEST.in
newgene May 2, 2025
76e6606
build: :coffin: remove old travis.yml
newgene May 2, 2025
9333780
build: :coffin: remove unused pre-commit hook
newgene May 2, 2025
08355a8
Ensure plugin_name is passed as kwarg for cli operation(s)(#400)
ctrl-schaff May 6, 2025
4b1c7b3
Revert dataplugin module loading (#399)
ctrl-schaff May 6, 2025
f65986b
fix: :bug: use more compatible elasticsearch_dsl.__versionstr__
newgene May 2, 2025
de91d67
Move hub commits to inner scope (#403)
ctrl-schaff May 8, 2025
88d3b56
Error handling for the IndexerTask mindex function (#401)
ctrl-schaff May 8, 2025
87839fd
fix: suppress pydantic ImportError in CLI
newgene May 8, 2025
926bd9b
fix: make psutil required for CLI
newgene May 8, 2025
44bdd38
Various bugfixes and cleanup (#404)
ctrl-schaff May 9, 2025
07093cd
Remove Deprecated doc_type (#402)
everaldorodrigo May 15, 2025
fc0202c
added keylookup as an optional property to the manifest schema
jal347 May 15, 2025
629c113
fixed trailing comma on manifest schema
jal347 May 15, 2025
9da8262
Isolate cli job management (#405)
ctrl-schaff May 16, 2025
aba1af0
updated help text for --plugin-name
newgene May 16, 2025
3fa46a6
rename CLI option --pluginname to --name
newgene May 16, 2025
7994de5
various minor fixes in CLI
newgene May 16, 2025
d41b01a
updated dataplugin template readme
newgene May 16, 2025
13db751
some coding style fixes
newgene May 16, 2025
497f9b6
minor typing and styling fixes
newgene May 17, 2025
68f3fe8
renaming parser.py to avoid conflict with buildin parser module
newgene May 17, 2025
debb384
added post_dump_sanity_check as part of the basedumper
jal347 May 23, 2025
3cebf87
integrated post_dump_sanity_check into post_dump
jal347 May 23, 2025
e53a571
change how elasticsearch dsl package is imported
shuchenliu May 29, 2025
85948d6
update displayed dsl version info
shuchenliu May 29, 2025
c271f19
remove elasticsearch-dsl in dependencies
shuchenliu May 29, 2025
3b906ef
Merge pull request #407 from biothings/upgrade-dsl
shuchenliu May 29, 2025
300ee0d
Merge master into 1.1.x
everaldorodrigo Jul 31, 2025
a6947bf
fix: :bug: fix missing dependencies for building sphinx docs
newgene Jul 31, 2025
2de0d63
test: :white_check_mark: updated test_http_dumper_download test
newgene Aug 1, 2025
ebc75ef
fix: :bug: fix Python 3.8 typing compatibility
newgene Aug 1, 2025
13b8bda
fix: :bug: fix type for http status code
newgene Aug 1, 2025
1f2267c
Merge branch 'master' into 1.1.x
newgene Aug 1, 2025
03e2acf
add prefix option to DataTransformMDB class
DylanWelzel Aug 5, 2025
856018e
Improve handler missing name. (#412)
everaldorodrigo Aug 21, 2025
0dd55d7
Merge branch 'master' into 1.1.x
everaldorodrigo Aug 25, 2025
d430975
Import clean_big_nums function in inspector.py
jal347 Oct 3, 2025
435db00
fix: improve error handling in bulk indexing with detailed logging
DylanWelzel Oct 14, 2025
f0983d0
add TAR format file handling
shuchenliu Oct 20, 2025
9efe641
add proper error handling to tar file processing
shuchenliu Oct 24, 2025
5407535
fix: improve assert validations
everaldorodrigo Sep 9, 2025
b2b1e83
Merge pull request #424 from biothings/tar-file-handling
shuchenliu Oct 27, 2025
554005a
Clear Elasticsearch scroll_id context.
everaldorodrigo Oct 10, 2025
1c6da04
Improve error handling.
everaldorodrigo Oct 24, 2025
f56a79e
Refactor code.
everaldorodrigo Oct 27, 2025
e9a47d0
Refactor code.
everaldorodrigo Oct 28, 2025
76b3f85
fix: replace json serialization with to_json for error logging in bul…
DylanWelzel Oct 28, 2025
0b9a32d
Merge pull request #425 from biothings/indexer-errors
DylanWelzel Oct 28, 2025
87acd81
Add cli configuration application (#418)
ctrl-schaff Nov 6, 2025
5c33a2b
fix: replace deprecated timeout with request_timeout parameter
newgene Nov 11, 2025
388f9ed
fix: remove deprecated doc_type and old ES support
newgene Nov 11, 2025
d991be7
fix: rename default .hubdb to biothings_hubdb
newgene Nov 11, 2025
8144430
fix: :bug: fix ES exception handling
newgene Nov 12, 2025
0c0aa32
ci: :construction_worker: updated version to 1.1.0
newgene Nov 12, 2025
6537075
build: :construction_worker: drop Python 3.8, add 3.14
newgene Nov 13, 2025
9b02943
fix: :recycle: more doc_type clean-up
newgene Nov 13, 2025
b2cfda6
ci: :construction_worker: drop 3.8, add 3.14t in github actions
newgene Nov 13, 2025
a398fcf
ci: :construction_worker: python version updates in publish and build…
newgene Nov 13, 2025
2d84b08
Merge pull request #411 from biothings/datatransform-prefix
DylanWelzel Nov 13, 2025
e4cb4a1
Fix typo in license key from 'licence' to 'license' (#417)
everaldorodrigo Nov 13, 2025
213734b
Bugfix the typer package loading of the rich_utils module (#426)
ctrl-schaff Nov 13, 2025
40689e1
Add cli pathing application (#422)
ctrl-schaff Nov 13, 2025
c94eced
Add cli dump mark success option (#423)
ctrl-schaff Nov 13, 2025
be149bf
fix: :bug: fix RuntimeError in Python 3.14 when get_event_loop is called
newgene Dec 10, 2025
ec6da5c
fix: :bug: fix default config value for APITEST_PATH, also add missin…
newgene Dec 10, 2025
9434a6c
build: :arrow_up: updated orjson for Py3.14 and new torando version
newgene Dec 12, 2025
4c9f170
fix: :ambulance: force to use fork in Python 3.14
newgene Dec 23, 2025
8dc2e84
docs: :memo: added detailed comments for the fix
newgene Dec 23, 2025
48b3697
Merge pull request #427 from biothings/py314_fix
newgene Dec 24, 2025
813b9e3
extend the manifest's uploader and dumper section to use locally defi…
shuchenliu Feb 3, 2026
a5f7a48
improve BuilderManager api request
DylanWelzel Feb 11, 2026
0cf3a49
Merge pull request #431 from biothings/custom-uploader
shuchenliu Feb 12, 2026
4a4cde6
feat: add MongoBuildCleanupManager and related commands for managing …
DylanWelzel Feb 17, 2026
0ad2d84
refactor: rename API endpoints for MongoDB builds for clarity
DylanWelzel Feb 17, 2026
7095ff2
fix: ensure asynchronous closing of database connection in delete_bui…
DylanWelzel Feb 17, 2026
e42b018
feat: enhance delete_builds method to return deleted collections info…
DylanWelzel Feb 17, 2026
970bee7
Centralize `orjson` usage across library (#435)
shuchenliu Feb 24, 2026
de9f047
add zst file handling for Python 3.14 and below (#428)
shuchenliu Feb 24, 2026
df09f92
Merge pull request #432 from biothings/build-requests
DylanWelzel Feb 24, 2026
7d58821
add validate_mongo_builds method and API endpoint
DylanWelzel Feb 26, 2026
56a1387
remove excess brackets (#436)
shuchenliu Feb 26, 2026
c74e044
Merge pull request #437 from biothings/build-cleanup
DylanWelzel Mar 2, 2026
29b5aab
remove deprecated Google Analytics support and clean up related code
DylanWelzel Mar 25, 2026
e86a059
fix: handle NaN-like values in dict_sweep to prevent ValueError
DylanWelzel Mar 31, 2026
6eb5acb
fix: update NaN handling in dict_sweep and add tests for _val_to_delete
DylanWelzel Apr 7, 2026
2775ebf
Merge pull request #439 from biothings/remove-ga-deprication
DylanWelzel May 21, 2026
ec6b8b8
fix: enhance NaN handling in dict_sweep and _val_to_delete with impro…
DylanWelzel May 21, 2026
47c9c49
Merge pull request #442 from biothings/fix/dict-sweep-nan-handling
DylanWelzel May 21, 2026
c3e40d9
build: 📦 updated package version to 1.0.3
DylanWelzel May 21, 2026
d659399
fix: refactor code for codacy
DylanWelzel May 26, 2026
0903280
style: address remaining codacy f-string issues
DylanWelzel May 26, 2026
79cb1fd
test: make any query randomness assertion deterministic
DylanWelzel May 26, 2026
8460eb4
Revert "test: make any query randomness assertion deterministic"
DylanWelzel May 26, 2026
5a30fdf
Merge pull request #446 from biothings/codacy-fixes
DylanWelzel May 26, 2026
6c24999
fix: close zst tar resources safely
DylanWelzel May 26, 2026
132e503
fix: raise specific error for invalid zst tar member
DylanWelzel May 26, 2026
fb69a24
fix: replace broad common utility exceptions
DylanWelzel May 27, 2026
7fc553a
fix: preserve tar member lookup context
DylanWelzel May 27, 2026
69a5955
Merge origin/master into 1.1.x for release 1.1.0
DylanWelzel May 27, 2026
572048f
build: 📦 updated package version to 1.1.0
DylanWelzel May 27, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
pull_request:
branches:
- master
- 1.0.x
- 1.1.x

jobs:
install_and_run_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14t']

services:
# mongo:
Expand Down Expand Up @@ -41,9 +41,9 @@ jobs:

steps:
- name: Checkout source
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13', '3.14t' ]
steps:
- name: Checkout source
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
63 changes: 63 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,67 @@

v1.1.0 (2026/05/27)
Highlights:
- Added Python 3.14 support and dropped Python 3.8 support.
- Reworked biothings CLI configuration, pathing, and dataplugin command organization.
- Added MongoDB build cleanup management APIs and commands.

biothings.hub improvements:
- Added prefix support to DataTransformMDB. ([#411](https://github.com/biothings/biothings.api/pull/411))
- Added TAR and Zstandard file handling. ([#424](https://github.com/biothings/biothings.api/pull/424), [#428](https://github.com/biothings/biothings.api/pull/428))
- Added support for custom local uploader and dumper classes in dataplugin manifests. ([#431](https://github.com/biothings/biothings.api/pull/431))
- Added MongoDB build cleanup validation and deletion tooling. ([#437](https://github.com/biothings/biothings.api/pull/437))

biothings.utils improvements:
- Fixed dict_sweep handling for NaN-like values, including pandas.NA and pandas.NaT. ([#442](https://github.com/biothings/biothings.api/pull/442))
- Centralized orjson usage across the library. ([#435](https://github.com/biothings/biothings.api/pull/435))

biothings.web improvements:
- Removed deprecated Google Analytics event support. ([#439](https://github.com/biothings/biothings.api/pull/439))
- Removed old doc_type and deprecated Elasticsearch compatibility code.
- Improved Elasticsearch exception handling and query response behavior.
- Optimized Elasticsearch memory usage when using scroll API.

biothings.cli improvements:
- Added CLI config and pathing commands. ([#418](https://github.com/biothings/biothings.api/pull/418), [#422](https://github.com/biothings/biothings.api/pull/422))
- Added CLI dump mark-success support. ([#423](https://github.com/biothings/biothings.api/pull/423))
- Fixed Typer/rich_utils loading behavior. ([#426](https://github.com/biothings/biothings.api/pull/426))

Misc improvements:
- Updated dependencies and package metadata for Python 3.9+, including tornado, typer, pymongo, orjson, and zstandard.
- Updated GitHub Actions test, build, and publish workflows.


v1.1.0 (2026/05/27)
Highlights:
- Added Python 3.14 support and dropped Python 3.8 support.
- Reworked biothings CLI configuration, pathing, and dataplugin command organization.
- Added MongoDB build cleanup management APIs and commands.

biothings.hub improvements:
- Added prefix support to DataTransformMDB. ([#411](https://github.com/biothings/biothings.api/pull/411))
- Added TAR and Zstandard file handling. ([#424](https://github.com/biothings/biothings.api/pull/424), [#428](https://github.com/biothings/biothings.api/pull/428))
- Added support for custom local uploader and dumper classes in dataplugin manifests. ([#431](https://github.com/biothings/biothings.api/pull/431))
- Added MongoDB build cleanup validation and deletion tooling. ([#437](https://github.com/biothings/biothings.api/pull/437))

biothings.utils improvements:
- Fixed dict_sweep handling for NaN-like values, including pandas.NA and pandas.NaT. ([#442](https://github.com/biothings/biothings.api/pull/442))
- Centralized orjson usage across the library. ([#435](https://github.com/biothings/biothings.api/pull/435))

biothings.web improvements:
- Removed deprecated Google Analytics event support. ([#439](https://github.com/biothings/biothings.api/pull/439))
- Removed old doc_type and deprecated Elasticsearch compatibility code.
- Improved Elasticsearch exception handling and query response behavior.
- Optimized Elasticsearch memory usage when using scroll API.

biothings.cli improvements:
- Added CLI config and pathing commands. ([#418](https://github.com/biothings/biothings.api/pull/418), [#422](https://github.com/biothings/biothings.api/pull/422))
- Added CLI dump mark-success support. ([#423](https://github.com/biothings/biothings.api/pull/423))
- Fixed Typer/rich_utils loading behavior. ([#426](https://github.com/biothings/biothings.api/pull/426))

Misc improvements:
- Updated dependencies and package metadata for Python 3.9+, including tornado, typer, pymongo, orjson, and zstandard.
- Updated GitHub Actions test, build, and publish workflows.

v1.0.2 (2025/10/15)
Bugfix:
- Fixed an import issue in inspector.py that was causing the mapping inspect to fail.
Expand Down
2 changes: 1 addition & 1 deletion biothings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class _version_info(NamedTuple):
micro: int


version_info = _version_info(1, 0, 2)
version_info = _version_info(1, 1, 0)
__version__ = ".".join(map(str, version_info))


Expand Down
45 changes: 26 additions & 19 deletions biothings/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,41 @@
Entrypoint for the biothings-cli tool
"""

from typing import Literal
import importlib.util
import logging
import os
import sys

import typer
from rich.logging import RichHandler

from biothings.cli.settings import (
setup_biothings_configuration,
setup_commandline_configuration,
setup_logging_configuration,
)
from biothings.cli.commands.admin import build_admin_application
from biothings.cli.commands.config import config_application, load_configuration
from biothings.cli.commands.dataplugin import dataplugin_application
from biothings.cli.commands.pathing import path_application


def check_module_import_status(module: str) -> bool:
def setup_logging_configuration(logging_level: Literal[10, 20, 30, 40, 50]) -> None:
"""
Verify that we can import a module prior to proceeding with creating our commandline
tooling that depends on those modules
Configures the logging based off our environment configuration
"""
module_specification = importlib.util.find_spec(module)
status = module_specification is not None
return status
rich_handler = RichHandler(
level=logging_level,
markup=True,
rich_tracebacks=False, # typer creates it already
show_path=False,
tracebacks_suppress=[typer],
)
logging.basicConfig(level=logging_level, format="%(message)s", datefmt="[%X]", handlers=[rich_handler])


def main():
"""
The entrypoint for running the BioThings CLI to test your local data plugin
The entrypoint for running the BioThings CLI
"""
typer_status = check_module_import_status("typer")
module_specification = importlib.util.find_spec("typer")
typer_status = module_specification is not None
if not typer_status:
logging.error(
(
Expand All @@ -48,14 +55,14 @@ def main():
cli_debug_flag = os.environ.get("BTCLI_DEBUG", False)
cli_rich_traceback_flag = os.environ.get("BTCLI_RICH_TRACEBACK", False)

cli = setup_commandline_configuration(debug=cli_debug_flag, rich_traceback=cli_rich_traceback_flag)
admin_application = build_admin_application(debug=cli_debug_flag, rich_traceback=cli_rich_traceback_flag)
logging_level = logging.WARNING
if cli_debug_flag:
logging_level = logging.DEBUG
setup_logging_configuration(logging_level)
setup_biothings_configuration()
load_configuration()

from biothings.cli.dataplugin import dataplugin_application

cli.add_typer(dataplugin_application, name="dataplugin")
return cli()
admin_application.add_typer(dataplugin_application, name="dataplugin")
admin_application.add_typer(config_application, name="config")
admin_application.add_typer(path_application, name="path")
return admin_application()
2 changes: 1 addition & 1 deletion biothings/cli/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CLIAssistant(BaseAssistant):

plugin_type = "CLI"

def __init__(self, plugin_name: Optional[str] = None, job_manager: "JobManager" = None):
def __init__(self, plugin_name: Optional[str] = None, job_manager: CLIJobManager = None):
from biothings import config
from biothings.hub.databuild.builder import BuilderManager
from biothings.hub.dataindex.indexer import IndexManager
Expand Down
Empty file.
48 changes: 48 additions & 0 deletions biothings/cli/commands/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
Configuration settings for the biothings-cli tool

> Logging
> Tool Configuration
> Creates a mock config used in the biothings.api backend
"""

import sys

import typer
import typer.rich_utils


def build_admin_application(debug: bool, rich_traceback: bool) -> typer.Typer:
"""
Builds the main administrative command line application for the
biothings-cli application
"""
pretty_exceptions_show_locals = False
pretty_exceptions_enable = False
sys.tracebacklimit = 1

if rich_traceback:
pretty_exceptions_enable = True
sys.tracebacklimit = 1000

if debug:
pretty_exceptions_enable = True
pretty_exceptions_show_locals = True
sys.tracebacklimit = 1000

# prevent dimming the help text from the 2nd line
# see: https://github.com/tiangolo/typer/issues/437#issuecomment-1224149402
typer.rich_utils.STYLE_HELPTEXT = ""

context_settings = {"help_option_names": ["-h", "--help"]}
typer_instance = typer.Typer(
help="[green]BioThings Admin CLI to test your local data plugins. See helps for each command for specific usage.[/green]",
rich_help_panel="Help and Others",
rich_markup_mode="rich",
context_settings=context_settings,
no_args_is_help=True,
pretty_exceptions_show_locals=pretty_exceptions_show_locals,
pretty_exceptions_enable=pretty_exceptions_enable,
)

return typer_instance
Loading
Loading