ose-cli 0.2.5__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.
- ose_cli-0.2.5/PKG-INFO +11 -0
- ose_cli-0.2.5/README.md +29 -0
- ose_cli-0.2.5/pyproject.toml +27 -0
- ose_cli-0.2.5/setup.cfg +4 -0
- ose_cli-0.2.5/src/ose_cli/__init__.py +38 -0
- ose_cli-0.2.5/src/ose_cli/externals.py +65 -0
- ose_cli-0.2.5/src/ose_cli/main.py +10 -0
- ose_cli-0.2.5/src/ose_cli/release.py +9 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/PKG-INFO +11 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/SOURCES.txt +12 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/dependency_links.txt +1 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/entry_points.txt +2 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/requires.txt +7 -0
- ose_cli-0.2.5/src/ose_cli.egg-info/top_level.txt +1 -0
ose_cli-0.2.5/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ose-cli
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Summary: CLI for OntoSpreadEd - Ontology spreadsheet editor
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: ose-core==0.2.5
|
|
7
|
+
Requires-Dist: Flask==2.3.3
|
|
8
|
+
Requires-Dist: Flask-Injector
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest; extra == "dev"
|
|
11
|
+
Requires-Dist: ruff; extra == "dev"
|
ose_cli-0.2.5/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# OSE CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for OntoSpreadEd - Ontology Spreadsheet Editor.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This package provides CLI commands for managing OntoSpreadEd from the terminal. It wraps Flask CLI commands and adds ontology-specific operations.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install ose-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Python 3.12+
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ose <command> [options]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The CLI provides access to Flask commands and custom OSE commands for ontology management, database operations, and release automation.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
LGPL-3.0-or-later
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ose-cli"
|
|
7
|
+
description = "CLI for OntoSpreadEd - Ontology spreadsheet editor"
|
|
8
|
+
requires-python = ">= 3.12"
|
|
9
|
+
version = "0.2.5"
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
"ose-core==0.2.5",
|
|
13
|
+
"Flask==2.3.3",
|
|
14
|
+
"Flask-Injector",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
dev = [
|
|
19
|
+
"pytest",
|
|
20
|
+
"ruff",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
ose = "ose_cli.main:main"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.packages.find]
|
|
27
|
+
where = ["src"]
|
ose_cli-0.2.5/setup.cfg
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OSE CLI - Command Line Interface for OntoSpreadEd
|
|
3
|
+
|
|
4
|
+
This package provides CLI commands for the OntoSpreadEd
|
|
5
|
+
ontology spreadsheet editor.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
|
|
10
|
+
import functools
|
|
11
|
+
|
|
12
|
+
from flask import Flask
|
|
13
|
+
from flask.cli import AppGroup
|
|
14
|
+
from injector import Injector, inject
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def init_app(app: Flask, injector: Injector):
|
|
18
|
+
ose_group = AppGroup("ose", help="Commands for OntoSpreadEd")
|
|
19
|
+
|
|
20
|
+
cli_groups = []
|
|
21
|
+
|
|
22
|
+
from .release import init_commands as release
|
|
23
|
+
cli_groups.append(release)
|
|
24
|
+
|
|
25
|
+
from .externals import init_commands as externals
|
|
26
|
+
cli_groups.append(externals)
|
|
27
|
+
|
|
28
|
+
def with_injector(fn):
|
|
29
|
+
@functools.wraps(fn)
|
|
30
|
+
def wrapper(*args, **kwargs):
|
|
31
|
+
return injector.call_with_injection(callable=inject(fn), args=args, kwargs=kwargs)
|
|
32
|
+
|
|
33
|
+
return wrapper
|
|
34
|
+
|
|
35
|
+
for init_group in cli_groups:
|
|
36
|
+
init_group(ose_group, with_injector)
|
|
37
|
+
|
|
38
|
+
app.cli.add_command(ose_group)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
from typing import Callable, Any, Dict, Tuple, Optional
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
from flask.cli import AppGroup
|
|
9
|
+
|
|
10
|
+
from ..commands.CLICommandContext import CLICommandContext
|
|
11
|
+
from ..commands.ImportExternalCommand import ImportExternalCommand
|
|
12
|
+
from ..model.ReleaseScript import ReleaseScript
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def init_commands(cli: AppGroup, inject: Callable[[Any], Callable[[Tuple[Any, ...], Dict[str, Any]], Any]]):
|
|
18
|
+
@cli.group("externals")
|
|
19
|
+
def group():
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
@group.command("build")
|
|
23
|
+
@click.option("--out", "-o", default=None)
|
|
24
|
+
@click.option("--release-script", "-r", default=".onto-ed/release_script.json")
|
|
25
|
+
@click.option("--local-path", "-l", default=".")
|
|
26
|
+
@click.option('-v', '--verbose', count=True, default=2)
|
|
27
|
+
@inject
|
|
28
|
+
def build(release_script: str, local_path: str, verbose: int, out: Optional[str]):
|
|
29
|
+
# set log level
|
|
30
|
+
log_level = logging.WARN if verbose == 1 else (
|
|
31
|
+
logging.INFO if verbose == 2 else (
|
|
32
|
+
logging.DEBUG if verbose >= 3 else logging.ERROR))
|
|
33
|
+
|
|
34
|
+
if not isinstance(log_level, int):
|
|
35
|
+
raise ValueError('Invalid log level: %s' % log_level)
|
|
36
|
+
logging.basicConfig(level=log_level)
|
|
37
|
+
logging.root.setLevel(log_level)
|
|
38
|
+
|
|
39
|
+
logger.info(f"Loading release script from {release_script}")
|
|
40
|
+
with open(release_script, "r") as f:
|
|
41
|
+
data = json.load(f)
|
|
42
|
+
script = ReleaseScript.from_json(data)
|
|
43
|
+
|
|
44
|
+
with CLICommandContext(local_path) as context:
|
|
45
|
+
command = ImportExternalCommand(context)
|
|
46
|
+
|
|
47
|
+
logger.info("Running external build command")
|
|
48
|
+
result, ok = command.run(script, local_path)
|
|
49
|
+
|
|
50
|
+
if not ok or result.has_errors():
|
|
51
|
+
logger.error("Command failed. Check the logs above!")
|
|
52
|
+
return 1
|
|
53
|
+
|
|
54
|
+
outfile = context.local_name(script.external.target.file)
|
|
55
|
+
|
|
56
|
+
if out is None:
|
|
57
|
+
out = os.path.join(local_path, script.external.target.file)
|
|
58
|
+
|
|
59
|
+
out = os.path.abspath(out)
|
|
60
|
+
outfile = os.path.abspath(outfile)
|
|
61
|
+
|
|
62
|
+
if out != outfile:
|
|
63
|
+
shutil.copy(outfile, out)
|
|
64
|
+
|
|
65
|
+
logger.info(f"External file written to {outfile}")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ose-cli
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Summary: CLI for OntoSpreadEd - Ontology spreadsheet editor
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: ose-core==0.2.5
|
|
7
|
+
Requires-Dist: Flask==2.3.3
|
|
8
|
+
Requires-Dist: Flask-Injector
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest; extra == "dev"
|
|
11
|
+
Requires-Dist: ruff; extra == "dev"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/ose_cli/__init__.py
|
|
4
|
+
src/ose_cli/externals.py
|
|
5
|
+
src/ose_cli/main.py
|
|
6
|
+
src/ose_cli/release.py
|
|
7
|
+
src/ose_cli.egg-info/PKG-INFO
|
|
8
|
+
src/ose_cli.egg-info/SOURCES.txt
|
|
9
|
+
src/ose_cli.egg-info/dependency_links.txt
|
|
10
|
+
src/ose_cli.egg-info/entry_points.txt
|
|
11
|
+
src/ose_cli.egg-info/requires.txt
|
|
12
|
+
src/ose_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ose_cli
|