Skip to content

Commit

Permalink
cli
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Sep 27, 2024
1 parent 815887a commit 3569738
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 1 deletion.
1 change: 0 additions & 1 deletion diracx-cli/src/diracx/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def callback(output_format: Optional[str] = None):


# Load all the sub commands

for entry_point in select_from_extension(group="diracx.cli"):
app.add_typer(entry_point.load(), name=entry_point.name)

Expand Down
9 changes: 9 additions & 0 deletions extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ What to do with the `environment.yaml` ? should we replicate wht's in diracx ?

When working with the extension, you MUST always (server, client, testing) have exported the environment variable ``DIRACX_EXTENSIONS=gubbins,diracx``

In the pyproject, the ``root`` of ``setuptools_scm`` will only be ``..`` for your extension

## CI

What is under ``.github/workflows/extensions.yaml`` should in fact be split in multiple jobs under ``.github/workflows/`` of your repo
Expand Down Expand Up @@ -87,6 +89,13 @@ aio_client_class = "gubbins.client.generated.aio._client:Dirac"

* Generate the autorest client (see ci ``regenerate_client``)

## CLI

* add a new subcommand
* extend an existing subcommand
* modify an existing subcommand
* no ``gubbins`` CI, everythign through ``dirac`` cli

## Writing tests


Expand Down
52 changes: 52 additions & 0 deletions extensions/gubbins/gubbins-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[project]
name = "gubbins-cli"
description = "TODO"
readme = "README.md"
requires-python = ">=3.11"
keywords = []
license = {text = "GPL-3.0-only"}
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Topic :: System :: Distributed Computing",
]
dependencies = ["diracx-cli"]
dynamic = ["version"]

[project.optional-dependencies]
testing = ["diracx-cli[testing]", "diracx-testing"]
types = [
"types-PyYAML",
]

# [project.scripts]
# dirac = "gubbins.cli:app"

[project.entry-points."diracx.cli"]
lollygag = "gubbins.cli.lollygag:app"


[tool.setuptools.packages.find]
where = ["src"]

[build-system]
requires = ["setuptools>=61", "wheel", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
root = "../../.."

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = [
"-v",
"--cov=diracx.cli", "--cov-report=term-missing",
"-pdiracx.testing",
"--import-mode=importlib",
]
asyncio_mode = "auto"
markers = [
"enabled_dependencies: List of dependencies which should be available to the FastAPI test client",
]
Empty file.
8 changes: 8 additions & 0 deletions extensions/gubbins/gubbins-cli/src/cli/lollygag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from diracx.cli.utils import AsyncTyper

app = AsyncTyper()


@app.command()
def boom():
print("yes baby")
1 change: 1 addition & 0 deletions extensions/gubbins/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
-e ./gubbins-db/[testing]
-e ./gubbins-testing/[testing]
-e ./gubbins-client/[testing]
-e ./gubbins-cli/[testing]

0 comments on commit 3569738

Please sign in to comment.