dtool-cli 0.7.1__tar.gz → 0.7.2__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.
- dtool_cli-0.7.2/.github/workflows/publish.yml +62 -0
- dtool_cli-0.7.2/.github/workflows/test.yml +57 -0
- dtool_cli-0.7.2/.gitignore +15 -0
- dtool_cli-0.7.2/CHANGELOG.rst +154 -0
- dtool_cli-0.7.2/PKG-INFO +77 -0
- {dtool-cli-0.7.1 → dtool_cli-0.7.2}/README.rst +10 -15
- dtool_cli-0.7.2/docs/Makefile +20 -0
- dtool_cli-0.7.2/docs/make.bat +36 -0
- dtool_cli-0.7.2/docs/source/CHANGELOG.rst +1 -0
- dtool_cli-0.7.2/docs/source/LICENSE.rst +1 -0
- dtool_cli-0.7.2/docs/source/README.rst +1 -0
- dtool_cli-0.7.2/docs/source/conf.py +165 -0
- dtool_cli-0.7.2/docs/source/index.rst +12 -0
- dtool_cli-0.7.2/dtool_cli/__init__.py +9 -0
- {dtool-cli-0.7.1 → dtool_cli-0.7.2}/dtool_cli/cli.py +46 -11
- dtool_cli-0.7.2/pyproject.toml +42 -0
- dtool_cli-0.7.2/requirements.txt +1 -0
- dtool_cli-0.7.2/setup.cfg +16 -0
- dtool_cli-0.7.2/tests/__init__.py +41 -0
- dtool_cli-0.7.2/tests/test_dtool_cli_module.py +102 -0
- dtool_cli-0.7.2/tests/test_validators.py +69 -0
- dtool_cli-0.7.2/tox.ini +14 -0
- dtool-cli-0.7.1/MANIFEST.in +0 -2
- dtool-cli-0.7.1/PKG-INFO +0 -74
- dtool-cli-0.7.1/dtool_cli/__init__.py +0 -3
- dtool-cli-0.7.1/dtool_cli.egg-info/PKG-INFO +0 -74
- dtool-cli-0.7.1/dtool_cli.egg-info/SOURCES.txt +0 -13
- dtool-cli-0.7.1/dtool_cli.egg-info/dependency_links.txt +0 -1
- dtool-cli-0.7.1/dtool_cli.egg-info/entry_points.txt +0 -3
- dtool-cli-0.7.1/dtool_cli.egg-info/requires.txt +0 -3
- dtool-cli-0.7.1/dtool_cli.egg-info/top_level.txt +0 -1
- dtool-cli-0.7.1/setup.cfg +0 -14
- dtool-cli-0.7.1/setup.py +0 -27
- {dtool-cli-0.7.1 → dtool_cli-0.7.2}/LICENSE.rst +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# Pushing a version tag (e.g. 0.7.2) runs the test suite, then builds the
|
|
4
|
+
# package and publishes it to PyPI. The upload uses PyPI trusted publishing
|
|
5
|
+
# (OIDC), so no API tokens are stored in the repository.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags:
|
|
10
|
+
- '[0-9]+.[0-9]+.[0-9]+*'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
uses: ./.github/workflows/test.yml
|
|
15
|
+
|
|
16
|
+
build:
|
|
17
|
+
needs: test
|
|
18
|
+
runs-on: ubuntu-24.04
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v7
|
|
22
|
+
with:
|
|
23
|
+
# hatch-vcs derives the version from the git tags
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- name: Set up Python 3.12
|
|
27
|
+
uses: actions/setup-python@v7
|
|
28
|
+
with:
|
|
29
|
+
python-version: 3.12
|
|
30
|
+
|
|
31
|
+
- name: Package distribution
|
|
32
|
+
run: |
|
|
33
|
+
pip install --upgrade build
|
|
34
|
+
python -m build
|
|
35
|
+
|
|
36
|
+
- name: Check version matches tag
|
|
37
|
+
run: |
|
|
38
|
+
ls "dist/dtool_cli-${GITHUB_REF_NAME}.tar.gz" \
|
|
39
|
+
"dist/dtool_cli-${GITHUB_REF_NAME}-py3-none-any.whl"
|
|
40
|
+
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
|
|
46
|
+
publish-pypi:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-24.04
|
|
49
|
+
environment:
|
|
50
|
+
name: pypi
|
|
51
|
+
url: https://pypi.org/p/dtool-cli
|
|
52
|
+
permissions:
|
|
53
|
+
id-token: write
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/download-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
- name: Publish distribution to PyPI
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
workflow_call:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
python -m pip install pytest pytest-cov pytest-mock
|
|
31
|
+
python -m pip install .
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: pytest --cov-report=xml
|
|
35
|
+
|
|
36
|
+
- name: Upload coverage to Codecov
|
|
37
|
+
uses: codecov/codecov-action@v4
|
|
38
|
+
with:
|
|
39
|
+
files: ./coverage.xml
|
|
40
|
+
flags: py${{ matrix.python-version }}
|
|
41
|
+
fail_ci_if_error: false
|
|
42
|
+
|
|
43
|
+
flake8:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python
|
|
49
|
+
uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: "3.13"
|
|
52
|
+
|
|
53
|
+
- name: Install flake8
|
|
54
|
+
run: python -m pip install flake8
|
|
55
|
+
|
|
56
|
+
- name: Run flake8
|
|
57
|
+
run: flake8
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
CHANGELOG
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
This project uses `semantic versioning <http://semver.org/>`_.
|
|
5
|
+
This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.
|
|
6
|
+
|
|
7
|
+
[Unreleased]
|
|
8
|
+
------------
|
|
9
|
+
|
|
10
|
+
Added
|
|
11
|
+
^^^^^
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Changed
|
|
15
|
+
^^^^^^^
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Deprecated
|
|
19
|
+
^^^^^^^^^^
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Removed
|
|
23
|
+
^^^^^^^
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Fixed
|
|
27
|
+
^^^^^
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Security
|
|
31
|
+
^^^^^^^^
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[0.7.2] - 2026-11-23
|
|
35
|
+
--------------------
|
|
36
|
+
|
|
37
|
+
Added
|
|
38
|
+
^^^^^
|
|
39
|
+
|
|
40
|
+
- GitHub Actions workflow that publishes a release to PyPI when a version
|
|
41
|
+
tag is pushed
|
|
42
|
+
|
|
43
|
+
Changed
|
|
44
|
+
^^^^^^^
|
|
45
|
+
|
|
46
|
+
- Build system switched to hatchling with hatch-vcs; the version is now
|
|
47
|
+
derived from git tags
|
|
48
|
+
- Replaced ``pkg_resources`` entry-point discovery with
|
|
49
|
+
``importlib.metadata``, removing the ``pkg_resources`` deprecation warning
|
|
50
|
+
|
|
51
|
+
Removed
|
|
52
|
+
^^^^^^^
|
|
53
|
+
|
|
54
|
+
- Dropped support for Python < 3.10 (including Python 2)
|
|
55
|
+
|
|
56
|
+
Fixed
|
|
57
|
+
^^^^^
|
|
58
|
+
|
|
59
|
+
- The ``--version`` text is only built when ``--version`` is given. Previously
|
|
60
|
+
it was built on import, so every ``dtool`` invocation imported all plugins,
|
|
61
|
+
and a single plugin without ``__version__`` (or one that failed to import)
|
|
62
|
+
broke the whole ``dtool`` command, including ``--help``; this also broke
|
|
63
|
+
frozen (e.g. PyInstaller) builds
|
|
64
|
+
- A plugin or storage broker without ``__version__`` is listed with version
|
|
65
|
+
"unknown" instead of crashing ``dtool --version``
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
[0.7.1] - 2021-06-23
|
|
69
|
+
--------------------
|
|
70
|
+
|
|
71
|
+
Fixed
|
|
72
|
+
^^^^^
|
|
73
|
+
|
|
74
|
+
- Licence file now included in release thanks to Jan Janssen (https://github.com/jan-janssen)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
[0.7.0] - 2018-05-18
|
|
78
|
+
--------------------
|
|
79
|
+
|
|
80
|
+
Added
|
|
81
|
+
^^^^^
|
|
82
|
+
|
|
83
|
+
- Added support for ``-h`` flag as well as ``--help``
|
|
84
|
+
- Added timestamp to logging output
|
|
85
|
+
|
|
86
|
+
Fixed
|
|
87
|
+
^^^^^
|
|
88
|
+
|
|
89
|
+
- Improved handling of URIs in validation code
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[0.6.0] - 2017-09-25
|
|
93
|
+
--------------------
|
|
94
|
+
|
|
95
|
+
Added
|
|
96
|
+
^^^^^
|
|
97
|
+
|
|
98
|
+
- ``dtool_cli.cli.base_dataset_uri_validation`` helper parameter validation method
|
|
99
|
+
- ``dtool_cli.cli.base_dataset_uri_argument`` helper decorator
|
|
100
|
+
- ``dtool_cli.cli.proto_dataset_uri_validation`` helper parameter validation method
|
|
101
|
+
- ``dtool_cli.cli.proto_dataset_uri_argument`` helper decorator
|
|
102
|
+
|
|
103
|
+
Changed
|
|
104
|
+
^^^^^^^
|
|
105
|
+
|
|
106
|
+
- ``dtool_cli.cli.dataset_uri_validation`` now validates that dataset is frozen
|
|
107
|
+
- ``dtool_cli.cli.dataset_uri_argument`` now validates that the dataset is frozen
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
[0.5.0] - 2017-09-20
|
|
111
|
+
--------------------
|
|
112
|
+
|
|
113
|
+
Changed
|
|
114
|
+
^^^^^^^
|
|
115
|
+
|
|
116
|
+
- Improved version string
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
[0.4.0] - 2017-09-15
|
|
120
|
+
--------------------
|
|
121
|
+
|
|
122
|
+
Added
|
|
123
|
+
^^^^^
|
|
124
|
+
|
|
125
|
+
- ``dtool_cli.cli.storagebroker_validation`` helper parameter validation method
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
[0.3.0] - 2017-09-13
|
|
129
|
+
--------------------
|
|
130
|
+
|
|
131
|
+
Added
|
|
132
|
+
^^^^^
|
|
133
|
+
|
|
134
|
+
- ``dtool_cli.cli.dataset_uri_validation`` helper parameter validation method
|
|
135
|
+
- ``dtool_cli.cli.dataset_uri_argument`` helper decorator
|
|
136
|
+
- ``dtool_cli.cli.CONFIG_PATH`` global variable
|
|
137
|
+
- Add ``--debug`` option
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
[0.2.0] - 2017-08-30
|
|
141
|
+
--------------------
|
|
142
|
+
|
|
143
|
+
Basic scaffold to create a ``dtool`` client that uses the ``dtoolcore`` version
|
|
144
|
+
2 API.
|
|
145
|
+
|
|
146
|
+
Added
|
|
147
|
+
^^^^^
|
|
148
|
+
|
|
149
|
+
- Entry point for ``dtool.cli``
|
|
150
|
+
|
|
151
|
+
Removed
|
|
152
|
+
^^^^^^^
|
|
153
|
+
|
|
154
|
+
- Entry points ``dtool.dataset`` and ``dtool.collection``
|
dtool_cli-0.7.2/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dtool-cli
|
|
3
|
+
Version: 0.7.2
|
|
4
|
+
Summary: Data management command line tool: dtool.
|
|
5
|
+
Project-URL: Repository, https://github.com/jic-dtool/dtool-cli
|
|
6
|
+
Author-email: Tjelvar Olsson <tjelvar.olsson@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.rst
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: click
|
|
16
|
+
Requires-Dist: click-plugins
|
|
17
|
+
Requires-Dist: dtoolcore>=2
|
|
18
|
+
Description-Content-Type: text/x-rst
|
|
19
|
+
|
|
20
|
+
README
|
|
21
|
+
======
|
|
22
|
+
|
|
23
|
+
Data management command line tool: dtool.
|
|
24
|
+
|
|
25
|
+
Overview
|
|
26
|
+
--------
|
|
27
|
+
|
|
28
|
+
The ``dtool-cli`` python package provides a skeleton command line interface to
|
|
29
|
+
dtool that other "dtool" command line packages can be plugged into.
|
|
30
|
+
|
|
31
|
+
It makes use of `click <https://github.com/pallets/click>`_ and `click-plugins
|
|
32
|
+
<https://github.com/click-contrib/click-plugins>`_.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Creating a plugin
|
|
36
|
+
-----------------
|
|
37
|
+
|
|
38
|
+
The ``dtool-cli`` plug-in system exposes name space ``dtool.cli`` for
|
|
39
|
+
registering commands.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
To create a ``dtool-cli`` plug-in, create a Python package and register the
|
|
43
|
+
click commands of interest as entry points in its ``pyproject.toml`` file.
|
|
44
|
+
Below is the content of a hypothetical ``dtool_create/__init__.py`` file::
|
|
45
|
+
|
|
46
|
+
import click
|
|
47
|
+
|
|
48
|
+
@click.command()
|
|
49
|
+
def create():
|
|
50
|
+
print("Creating dataset...")
|
|
51
|
+
|
|
52
|
+
@click.command()
|
|
53
|
+
def freeze():
|
|
54
|
+
print("Freezing dataset...")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
To create entry points for these commands add the below to the
|
|
58
|
+
``pyproject.toml``::
|
|
59
|
+
|
|
60
|
+
[project.entry-points."dtool.cli"]
|
|
61
|
+
create = "dtool_create:create"
|
|
62
|
+
freeze = "dtool_create:freeze"
|
|
63
|
+
|
|
64
|
+
The entry points must refer to click commands (or groups). Plain functions,
|
|
65
|
+
e.g. ``argparse`` based scripts, belong under ``[project.scripts]`` instead.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Installation
|
|
70
|
+
------------
|
|
71
|
+
|
|
72
|
+
To install the dtool-cli package.
|
|
73
|
+
|
|
74
|
+
.. code-block:: bash
|
|
75
|
+
|
|
76
|
+
cd dtool-cli
|
|
77
|
+
pip install .
|
|
@@ -21,8 +21,8 @@ registering commands.
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
To create a ``dtool-cli`` plug-in, create a Python package and register the
|
|
24
|
-
|
|
25
|
-
hypothetical ``dtool_create/__init__.py`` file::
|
|
24
|
+
click commands of interest as entry points in its ``pyproject.toml`` file.
|
|
25
|
+
Below is the content of a hypothetical ``dtool_create/__init__.py`` file::
|
|
26
26
|
|
|
27
27
|
import click
|
|
28
28
|
|
|
@@ -35,20 +35,15 @@ hypothetical ``dtool_create/__init__.py`` file::
|
|
|
35
35
|
print("Freezing dataset...")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
To create
|
|
38
|
+
To create entry points for these commands add the below to the
|
|
39
|
+
``pyproject.toml``::
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
[project.entry-points."dtool.cli"]
|
|
42
|
+
create = "dtool_create:create"
|
|
43
|
+
freeze = "dtool_create:freeze"
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
entry_points={
|
|
45
|
-
"dtool.cli": [
|
|
46
|
-
"create=dtool_create:create",
|
|
47
|
-
"freeze=dtool_create:freeze",
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
...
|
|
51
|
-
)
|
|
45
|
+
The entry points must refer to click commands (or groups). Plain functions,
|
|
46
|
+
e.g. ``argparse`` based scripts, belong under ``[project.scripts]`` instead.
|
|
52
47
|
|
|
53
48
|
|
|
54
49
|
|
|
@@ -60,4 +55,4 @@ To install the dtool-cli package.
|
|
|
60
55
|
.. code-block:: bash
|
|
61
56
|
|
|
62
57
|
cd dtool-cli
|
|
63
|
-
|
|
58
|
+
pip install .
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
SPHINXPROJ = dtool-cli
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
set SPHINXPROJ=cookiecutterrepo_name
|
|
13
|
+
|
|
14
|
+
if "%1" == "" goto help
|
|
15
|
+
|
|
16
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
17
|
+
if errorlevel 9009 (
|
|
18
|
+
echo.
|
|
19
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
20
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
21
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
22
|
+
echo.may add the Sphinx directory to PATH.
|
|
23
|
+
echo.
|
|
24
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
25
|
+
echo.http://sphinx-doc.org/
|
|
26
|
+
exit /b 1
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
30
|
+
goto end
|
|
31
|
+
|
|
32
|
+
:help
|
|
33
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
34
|
+
|
|
35
|
+
:end
|
|
36
|
+
popd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.. include:: ../../CHANGELOG.rst
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.. include:: ../../LICENSE.rst
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.. include:: ../../README.rst
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is execfile()d with the current directory set to its
|
|
3
|
+
# containing dir.
|
|
4
|
+
#
|
|
5
|
+
# Note that not all possible configuration values are present in this
|
|
6
|
+
# autogenerated file.
|
|
7
|
+
#
|
|
8
|
+
# All configuration values have a default; values that are commented out
|
|
9
|
+
# serve to show the default.
|
|
10
|
+
|
|
11
|
+
# If extensions (or modules to document with autodoc) are in another directory,
|
|
12
|
+
# add these directories to sys.path here. If the directory is relative to the
|
|
13
|
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
14
|
+
#
|
|
15
|
+
import os
|
|
16
|
+
# import sys
|
|
17
|
+
# sys.path.insert(0, os.path.abspath('.'))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# -- General configuration ------------------------------------------------
|
|
21
|
+
|
|
22
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
|
23
|
+
#
|
|
24
|
+
# needs_sphinx = '1.0'
|
|
25
|
+
|
|
26
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
|
27
|
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
28
|
+
# ones.
|
|
29
|
+
extensions = [
|
|
30
|
+
'sphinx.ext.autodoc',
|
|
31
|
+
'sphinx.ext.doctest',
|
|
32
|
+
'sphinx.ext.viewcode']
|
|
33
|
+
|
|
34
|
+
# Add any paths that contain templates here, relative to this directory.
|
|
35
|
+
templates_path = ['_templates']
|
|
36
|
+
|
|
37
|
+
# The suffix(es) of source filenames.
|
|
38
|
+
# You can specify multiple suffix as a list of string:
|
|
39
|
+
#
|
|
40
|
+
# source_suffix = ['.rst', '.md']
|
|
41
|
+
source_suffix = '.rst'
|
|
42
|
+
|
|
43
|
+
# The master toctree document.
|
|
44
|
+
master_doc = 'index'
|
|
45
|
+
|
|
46
|
+
# General information about the project.
|
|
47
|
+
project = "dtool-cli"
|
|
48
|
+
copyright = "2017, Tjelvar Olsson"
|
|
49
|
+
author = "Tjelvar Olsson"
|
|
50
|
+
repo_name = "dtool-cli"
|
|
51
|
+
|
|
52
|
+
# The version info for the project you're documenting, acts as replacement for
|
|
53
|
+
# |version| and |release|, also used in various other places throughout the
|
|
54
|
+
# built documents.
|
|
55
|
+
#
|
|
56
|
+
# The short X.Y version.
|
|
57
|
+
version = "0.7.2"
|
|
58
|
+
# The full version, including alpha/beta/rc tags.
|
|
59
|
+
release = version
|
|
60
|
+
|
|
61
|
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
62
|
+
# for a list of supported languages.
|
|
63
|
+
#
|
|
64
|
+
# This is also used if you do content translation via gettext catalogs.
|
|
65
|
+
# Usually you set "language" from the command line for these cases.
|
|
66
|
+
language = None
|
|
67
|
+
|
|
68
|
+
# List of patterns, relative to source directory, that match files and
|
|
69
|
+
# directories to ignore when looking for source files.
|
|
70
|
+
# This patterns also effect to html_static_path and html_extra_path
|
|
71
|
+
exclude_patterns = []
|
|
72
|
+
|
|
73
|
+
# The name of the Pygments (syntax highlighting) style to use.
|
|
74
|
+
pygments_style = 'sphinx'
|
|
75
|
+
|
|
76
|
+
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
77
|
+
todo_include_todos = False
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# -- Options for HTML output ----------------------------------------------
|
|
81
|
+
|
|
82
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
83
|
+
# a list of builtin themes.
|
|
84
|
+
#
|
|
85
|
+
html_theme = 'default'
|
|
86
|
+
|
|
87
|
+
# Set the readthedocs theme.
|
|
88
|
+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
|
89
|
+
|
|
90
|
+
if not on_rtd: # only import and set the theme if we're building docs locally
|
|
91
|
+
print('using readthedocs theme...')
|
|
92
|
+
import sphinx_rtd_theme
|
|
93
|
+
html_theme = 'sphinx_rtd_theme'
|
|
94
|
+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
95
|
+
# otherwise, readthedocs.org uses their theme by default, so no need to specify
|
|
96
|
+
# it
|
|
97
|
+
|
|
98
|
+
# Theme options are theme-specific and customize the look and feel of a theme
|
|
99
|
+
# further. For a list of options available for each theme, see the
|
|
100
|
+
# documentation.
|
|
101
|
+
#
|
|
102
|
+
# html_theme_options = {}
|
|
103
|
+
|
|
104
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
|
105
|
+
# relative to this directory. They are copied after the builtin static files,
|
|
106
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
107
|
+
html_static_path = ['_static']
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# -- Options for HTMLHelp output ------------------------------------------
|
|
111
|
+
|
|
112
|
+
# Output file base name for HTML help builder.
|
|
113
|
+
htmlhelp_basename = '{}doc'.format(repo_name)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# -- Options for LaTeX output ---------------------------------------------
|
|
117
|
+
|
|
118
|
+
latex_elements = {
|
|
119
|
+
# The paper size ('letterpaper' or 'a4paper').
|
|
120
|
+
#
|
|
121
|
+
# 'papersize': 'letterpaper',
|
|
122
|
+
|
|
123
|
+
# The font size ('10pt', '11pt' or '12pt').
|
|
124
|
+
#
|
|
125
|
+
# 'pointsize': '10pt',
|
|
126
|
+
|
|
127
|
+
# Additional stuff for the LaTeX preamble.
|
|
128
|
+
#
|
|
129
|
+
# 'preamble': '',
|
|
130
|
+
|
|
131
|
+
# Latex figure (float) alignment
|
|
132
|
+
#
|
|
133
|
+
# 'figure_align': 'htbp',
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
# Grouping the document tree into LaTeX files. List of tuples
|
|
137
|
+
# (source start file, target name, title,
|
|
138
|
+
# author, documentclass [howto, manual, or own class]).
|
|
139
|
+
latex_documents = [
|
|
140
|
+
(master_doc, '{}.tex'.format(repo_name),
|
|
141
|
+
'{} Documentation'.format(repo_name),
|
|
142
|
+
author, 'manual'),
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# -- Options for manual page output ---------------------------------------
|
|
147
|
+
|
|
148
|
+
# One entry per manual page. List of tuples
|
|
149
|
+
# (source start file, name, description, authors, manual section).
|
|
150
|
+
man_pages = [
|
|
151
|
+
(master_doc, repo_name, '{} Documentation'.format(repo_name),
|
|
152
|
+
[author], 1)
|
|
153
|
+
]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# -- Options for Texinfo output -------------------------------------------
|
|
157
|
+
|
|
158
|
+
# Grouping the document tree into Texinfo files. List of tuples
|
|
159
|
+
# (source start file, target name, title, author,
|
|
160
|
+
# dir menu entry, description, category)
|
|
161
|
+
texinfo_documents = [
|
|
162
|
+
(master_doc, repo_name, '{} Documentation'.format(repo_name),
|
|
163
|
+
author, repo_name, 'Data management command line interface: dtool.',
|
|
164
|
+
'Miscellaneous'),
|
|
165
|
+
]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import os
|
|
4
4
|
import logging
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from importlib.metadata import entry_points
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
from click_plugins import with_plugins
|
|
@@ -22,6 +22,11 @@ _CLICK_CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
|
|
|
22
22
|
CONFIG_PATH = os.path.expanduser("~/.config/dtool/dtool.json")
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def iter_entry_points(group):
|
|
26
|
+
"""Yield the entry points registered under ``group``."""
|
|
27
|
+
return entry_points(group=group)
|
|
28
|
+
|
|
29
|
+
|
|
25
30
|
def storagebroker_validation(ctx, param, value):
|
|
26
31
|
storage_broker_lookup = dtoolcore._generate_storage_broker_lookup()
|
|
27
32
|
if value not in storage_broker_lookup:
|
|
@@ -86,6 +91,26 @@ dataset_uri_argument = click.argument(
|
|
|
86
91
|
)
|
|
87
92
|
|
|
88
93
|
|
|
94
|
+
def _package_version(package):
|
|
95
|
+
"""Return the ``__version__`` of ``package``, or "unknown".
|
|
96
|
+
|
|
97
|
+
A plugin that cannot be imported or that lacks ``__version__`` must not
|
|
98
|
+
break the version listing.
|
|
99
|
+
"""
|
|
100
|
+
try:
|
|
101
|
+
return __import__(package).__version__
|
|
102
|
+
except Exception:
|
|
103
|
+
return "unknown"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _storage_broker_key(ep):
|
|
107
|
+
"""Return the key of the storage broker behind entry point ``ep``."""
|
|
108
|
+
try:
|
|
109
|
+
return ep.load().key
|
|
110
|
+
except Exception:
|
|
111
|
+
return ep.name
|
|
112
|
+
|
|
113
|
+
|
|
89
114
|
def pretty_version_text():
|
|
90
115
|
"""Return pretty version text listing all plugins."""
|
|
91
116
|
version_lines = ["dtool, version {}".format(dtool_version)]
|
|
@@ -96,33 +121,43 @@ def pretty_version_text():
|
|
|
96
121
|
# List the storage broker packages.
|
|
97
122
|
version_lines.append("\nStorage brokers:")
|
|
98
123
|
for ep in iter_entry_points("dtool.storage_brokers"):
|
|
99
|
-
package = ep.
|
|
100
|
-
dyn_load_p = __import__(package)
|
|
101
|
-
version = dyn_load_p.__version__
|
|
102
|
-
storage_broker = ep.load()
|
|
124
|
+
package = ep.module.split(".")[0]
|
|
103
125
|
version_lines.append(
|
|
104
126
|
"{}, {}, version {}".format(
|
|
105
|
-
|
|
127
|
+
_storage_broker_key(ep),
|
|
106
128
|
package.replace("_", "-"),
|
|
107
|
-
|
|
129
|
+
_package_version(package)))
|
|
108
130
|
|
|
109
131
|
# List the plugin packages.
|
|
110
|
-
modules = [ep.
|
|
132
|
+
modules = [ep.module for ep in iter_entry_points("dtool.cli")]
|
|
111
133
|
packages = set([m.split(".")[0] for m in modules])
|
|
112
134
|
version_lines.append("\nPlugins:")
|
|
113
135
|
for p in packages:
|
|
114
|
-
dyn_load_p = __import__(p)
|
|
115
136
|
version_lines.append(
|
|
116
137
|
"{}, version {}".format(
|
|
117
138
|
p.replace("_", "-"),
|
|
118
|
-
|
|
139
|
+
_package_version(p)))
|
|
119
140
|
|
|
120
141
|
return "\n".join(version_lines)
|
|
121
142
|
|
|
122
143
|
|
|
144
|
+
def _print_version(ctx, param, value):
|
|
145
|
+
"""Print the version of dtool and its plugins, then exit.
|
|
146
|
+
|
|
147
|
+
The text is only built when ``--version`` is given: building it imports
|
|
148
|
+
every plugin, which should neither slow down nor be able to break other
|
|
149
|
+
invocations of ``dtool``.
|
|
150
|
+
"""
|
|
151
|
+
if not value or ctx.resilient_parsing:
|
|
152
|
+
return
|
|
153
|
+
click.echo(pretty_version_text())
|
|
154
|
+
ctx.exit()
|
|
155
|
+
|
|
156
|
+
|
|
123
157
|
@with_plugins(iter_entry_points("dtool.cli"))
|
|
124
158
|
@click.group(context_settings=_CLICK_CONTEXT_SETTINGS)
|
|
125
|
-
@click.
|
|
159
|
+
@click.option("--version", is_flag=True, expose_value=False, is_eager=True,
|
|
160
|
+
callback=_print_version, help="Show the version and exit.")
|
|
126
161
|
@click.option("--debug", is_flag=True, help="Turn on debugging output.")
|
|
127
162
|
def dtool(debug):
|
|
128
163
|
"""Tool to work with datasets."""
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27", "hatch-vcs"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dtool-cli"
|
|
7
|
+
description = "Data management command line tool: dtool."
|
|
8
|
+
readme = "README.rst"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE.rst"]
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Tjelvar Olsson", email = "tjelvar.olsson@gmail.com"},
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
dynamic = ["version"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"click",
|
|
18
|
+
"click-plugins",
|
|
19
|
+
"dtoolcore>=2",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/jic-dtool/dtool-cli"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
dtool = "dtool_cli.cli:dtool"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.version]
|
|
36
|
+
source = "vcs"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.version.raw-options]
|
|
39
|
+
local_scheme = "no-local-version"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["dtool_cli"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-e .
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
exclude=env*,.tox,.git,*.egg,build,docs
|
|
3
|
+
|
|
4
|
+
[tool:pytest]
|
|
5
|
+
testpaths = tests
|
|
6
|
+
addopts = --cov=dtool_cli --cov-report=term-missing
|
|
7
|
+
|
|
8
|
+
[coverage:run]
|
|
9
|
+
source = dtool_cli
|
|
10
|
+
|
|
11
|
+
[coverage:report]
|
|
12
|
+
# Lines that are version-gated or only reachable when an optional package is
|
|
13
|
+
# (un)installed; covered across the full test matrix rather than any single run.
|
|
14
|
+
exclude_lines =
|
|
15
|
+
pragma: no cover
|
|
16
|
+
except ImportError
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Test fixtures."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import tempfile
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
_HERE = os.path.dirname(__file__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture
|
|
13
|
+
def chdir_fixture(request):
|
|
14
|
+
d = tempfile.mkdtemp()
|
|
15
|
+
curdir = os.getcwd()
|
|
16
|
+
os.chdir(d)
|
|
17
|
+
|
|
18
|
+
@request.addfinalizer
|
|
19
|
+
def teardown():
|
|
20
|
+
os.chdir(curdir)
|
|
21
|
+
shutil.rmtree(d)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.fixture
|
|
25
|
+
def tmp_dir_fixture(request):
|
|
26
|
+
d = tempfile.mkdtemp()
|
|
27
|
+
|
|
28
|
+
@request.addfinalizer
|
|
29
|
+
def teardown():
|
|
30
|
+
shutil.rmtree(d)
|
|
31
|
+
return d
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.fixture
|
|
35
|
+
def local_tmp_dir_fixture(request):
|
|
36
|
+
d = tempfile.mkdtemp(dir=_HERE)
|
|
37
|
+
|
|
38
|
+
@request.addfinalizer
|
|
39
|
+
def teardown():
|
|
40
|
+
shutil.rmtree(d)
|
|
41
|
+
return d
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""Test the dtool-cli package."""
|
|
2
|
+
|
|
3
|
+
from click.testing import CliRunner
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_version_is_string():
|
|
7
|
+
import dtool_cli
|
|
8
|
+
assert isinstance(dtool_cli.__version__, str)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_dtool():
|
|
12
|
+
from dtool_cli.cli import dtool
|
|
13
|
+
runner = CliRunner()
|
|
14
|
+
result = runner.invoke(dtool, ["--help"])
|
|
15
|
+
assert result.exit_code == 0
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_dtool_debug_flag():
|
|
19
|
+
# Attach a throwaway subcommand so the group callback body actually runs
|
|
20
|
+
# (--help would short-circuit before it). This exercises the --debug branch
|
|
21
|
+
# that switches logging to DEBUG.
|
|
22
|
+
import click
|
|
23
|
+
from dtool_cli.cli import dtool
|
|
24
|
+
|
|
25
|
+
@dtool.command(name="_noop")
|
|
26
|
+
def _noop():
|
|
27
|
+
click.echo("ran")
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
runner = CliRunner()
|
|
31
|
+
result = runner.invoke(dtool, ["--debug", "_noop"])
|
|
32
|
+
assert result.exit_code == 0
|
|
33
|
+
assert "ran" in result.output
|
|
34
|
+
finally:
|
|
35
|
+
dtool.commands.pop("_noop", None)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_version_option_reports_components():
|
|
39
|
+
from dtool_cli.cli import dtool
|
|
40
|
+
runner = CliRunner()
|
|
41
|
+
result = runner.invoke(dtool, ["--version"])
|
|
42
|
+
assert result.exit_code == 0
|
|
43
|
+
assert "dtoolcore, version" in result.output
|
|
44
|
+
assert "dtool-cli, version" in result.output
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_pretty_version_text_is_string():
|
|
48
|
+
from dtool_cli.cli import pretty_version_text
|
|
49
|
+
text = pretty_version_text()
|
|
50
|
+
assert isinstance(text, str)
|
|
51
|
+
assert "Storage brokers:" in text
|
|
52
|
+
assert "Plugins:" in text
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_iter_entry_points_returns_iterable():
|
|
56
|
+
# The wrapper bridges the importlib.metadata group= API across versions;
|
|
57
|
+
# an unknown group should yield an empty (but iterable) result.
|
|
58
|
+
from dtool_cli.cli import iter_entry_points
|
|
59
|
+
assert list(iter_entry_points("dtool.no_such_group")) == []
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_version_text_not_built_unless_requested(mocker):
|
|
63
|
+
# Building the version text imports every plugin; it must not happen on
|
|
64
|
+
# import or for other invocations such as --help.
|
|
65
|
+
from dtool_cli.cli import dtool
|
|
66
|
+
pretty = mocker.patch("dtool_cli.cli.pretty_version_text",
|
|
67
|
+
return_value="VERSION TEXT")
|
|
68
|
+
runner = CliRunner()
|
|
69
|
+
|
|
70
|
+
result = runner.invoke(dtool, ["--help"])
|
|
71
|
+
assert result.exit_code == 0
|
|
72
|
+
pretty.assert_not_called()
|
|
73
|
+
|
|
74
|
+
result = runner.invoke(dtool, ["--version"])
|
|
75
|
+
assert result.exit_code == 0
|
|
76
|
+
assert result.output == "VERSION TEXT\n"
|
|
77
|
+
pretty.assert_called_once_with()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_pretty_version_text_tolerates_broken_plugins(mocker):
|
|
81
|
+
from types import SimpleNamespace
|
|
82
|
+
from dtool_cli.cli import pretty_version_text
|
|
83
|
+
|
|
84
|
+
def broken_load():
|
|
85
|
+
raise ImportError("broken storage broker")
|
|
86
|
+
|
|
87
|
+
entry_points = {
|
|
88
|
+
# "os" exists but has no __version__; "no_such_pkg" cannot be imported.
|
|
89
|
+
"dtool.storage_brokers": [
|
|
90
|
+
SimpleNamespace(name="BrokenBroker", module="no_such_pkg.broker",
|
|
91
|
+
load=broken_load),
|
|
92
|
+
],
|
|
93
|
+
"dtool.cli": [
|
|
94
|
+
SimpleNamespace(name="noversion", module="os"),
|
|
95
|
+
],
|
|
96
|
+
}
|
|
97
|
+
mocker.patch("dtool_cli.cli.iter_entry_points",
|
|
98
|
+
side_effect=lambda group: entry_points.get(group, []))
|
|
99
|
+
|
|
100
|
+
text = pretty_version_text()
|
|
101
|
+
assert "BrokenBroker, no-such-pkg, version unknown" in text
|
|
102
|
+
assert "os, version unknown" in text
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Tests for the reusable click argument validation callbacks."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
import dtoolcore
|
|
8
|
+
|
|
9
|
+
from dtool_cli.cli import (
|
|
10
|
+
storagebroker_validation,
|
|
11
|
+
base_dataset_uri_validation,
|
|
12
|
+
proto_dataset_uri_validation,
|
|
13
|
+
dataset_uri_validation,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture
|
|
18
|
+
def datasets(tmp_path):
|
|
19
|
+
"""Create a proto and a frozen dataset in a temporary file base URI.
|
|
20
|
+
|
|
21
|
+
Returns a dict with the ``base``, ``proto`` and ``frozen`` URIs.
|
|
22
|
+
"""
|
|
23
|
+
base_uri = "file://{}".format(tmp_path)
|
|
24
|
+
|
|
25
|
+
proto = dtoolcore.create_proto_dataset("proto_ds", base_uri)
|
|
26
|
+
|
|
27
|
+
frozen = dtoolcore.create_proto_dataset("frozen_ds", base_uri)
|
|
28
|
+
frozen.freeze()
|
|
29
|
+
|
|
30
|
+
return {"base": base_uri, "proto": proto.uri, "frozen": frozen.uri}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_storagebroker_validation_accepts_known_broker():
|
|
34
|
+
assert storagebroker_validation(None, None, "file") == "file"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_storagebroker_validation_rejects_unknown_broker():
|
|
38
|
+
with pytest.raises(click.BadParameter):
|
|
39
|
+
storagebroker_validation(None, None, "no-such-broker")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_base_dataset_uri_validation_accepts_dataset(datasets):
|
|
43
|
+
uri = datasets["proto"]
|
|
44
|
+
assert base_dataset_uri_validation(None, None, uri) == uri
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_base_dataset_uri_validation_rejects_non_dataset(datasets):
|
|
48
|
+
with pytest.raises(click.BadParameter):
|
|
49
|
+
base_dataset_uri_validation(None, None, datasets["base"])
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_proto_dataset_uri_validation_accepts_proto(datasets):
|
|
53
|
+
uri = datasets["proto"]
|
|
54
|
+
assert proto_dataset_uri_validation(None, None, uri) == uri
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_proto_dataset_uri_validation_rejects_frozen(datasets):
|
|
58
|
+
with pytest.raises(click.BadParameter):
|
|
59
|
+
proto_dataset_uri_validation(None, None, datasets["frozen"])
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_dataset_uri_validation_accepts_frozen(datasets):
|
|
63
|
+
uri = datasets["frozen"]
|
|
64
|
+
assert dataset_uri_validation(None, None, uri) == uri
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_dataset_uri_validation_rejects_proto(datasets):
|
|
68
|
+
with pytest.raises(click.BadParameter):
|
|
69
|
+
dataset_uri_validation(None, None, datasets["proto"])
|
dtool_cli-0.7.2/tox.ini
ADDED
dtool-cli-0.7.1/MANIFEST.in
DELETED
dtool-cli-0.7.1/PKG-INFO
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: dtool-cli
|
|
3
|
-
Version: 0.7.1
|
|
4
|
-
Summary: Data management command line tool: dtool.
|
|
5
|
-
Home-page: https://github.com/jic-dtool/dtool-cli
|
|
6
|
-
Author: Tjelvar Olsson
|
|
7
|
-
Author-email: tjelvar.olsson@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/jic-dtool/dtool-cli/tarball/0.7.1
|
|
10
|
-
Description: README
|
|
11
|
-
======
|
|
12
|
-
|
|
13
|
-
Data management command line tool: dtool.
|
|
14
|
-
|
|
15
|
-
Overview
|
|
16
|
-
--------
|
|
17
|
-
|
|
18
|
-
The ``dtool-cli`` python package provides a skeleton command line interface to
|
|
19
|
-
dtool that other "dtool" command line packages can be plugged into.
|
|
20
|
-
|
|
21
|
-
It makes use of `click <https://github.com/pallets/click>`_ and `click-plugins
|
|
22
|
-
<https://github.com/click-contrib/click-plugins>`_.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Creating a plugin
|
|
26
|
-
-----------------
|
|
27
|
-
|
|
28
|
-
The ``dtool-cli`` plug-in system exposes name space ``dtool.cli`` for
|
|
29
|
-
registering commands.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
To create a ``dtool-cli`` plug-in, create a Python package and register the
|
|
33
|
-
function of interest in the ``setup.py`` file. Below is the content of a
|
|
34
|
-
hypothetical ``dtool_create/__init__.py`` file::
|
|
35
|
-
|
|
36
|
-
import click
|
|
37
|
-
|
|
38
|
-
@click.command()
|
|
39
|
-
def create():
|
|
40
|
-
print("Creating dataset...")
|
|
41
|
-
|
|
42
|
-
@click.command()
|
|
43
|
-
def freeze():
|
|
44
|
-
print("Freezing dataset...")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
To create an entry point for this function add the below in the ``setup.py``::
|
|
48
|
-
|
|
49
|
-
from setuptools import setup
|
|
50
|
-
|
|
51
|
-
setup(
|
|
52
|
-
...
|
|
53
|
-
entry_points={
|
|
54
|
-
"dtool.cli": [
|
|
55
|
-
"create=dtool_create:create",
|
|
56
|
-
"freeze=dtool_create:freeze",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
...
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Installation
|
|
65
|
-
------------
|
|
66
|
-
|
|
67
|
-
To install the dtool-cli package.
|
|
68
|
-
|
|
69
|
-
.. code-block:: bash
|
|
70
|
-
|
|
71
|
-
cd dtool-cli
|
|
72
|
-
python setup.py install
|
|
73
|
-
|
|
74
|
-
Platform: UNKNOWN
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: dtool-cli
|
|
3
|
-
Version: 0.7.1
|
|
4
|
-
Summary: Data management command line tool: dtool.
|
|
5
|
-
Home-page: https://github.com/jic-dtool/dtool-cli
|
|
6
|
-
Author: Tjelvar Olsson
|
|
7
|
-
Author-email: tjelvar.olsson@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/jic-dtool/dtool-cli/tarball/0.7.1
|
|
10
|
-
Description: README
|
|
11
|
-
======
|
|
12
|
-
|
|
13
|
-
Data management command line tool: dtool.
|
|
14
|
-
|
|
15
|
-
Overview
|
|
16
|
-
--------
|
|
17
|
-
|
|
18
|
-
The ``dtool-cli`` python package provides a skeleton command line interface to
|
|
19
|
-
dtool that other "dtool" command line packages can be plugged into.
|
|
20
|
-
|
|
21
|
-
It makes use of `click <https://github.com/pallets/click>`_ and `click-plugins
|
|
22
|
-
<https://github.com/click-contrib/click-plugins>`_.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Creating a plugin
|
|
26
|
-
-----------------
|
|
27
|
-
|
|
28
|
-
The ``dtool-cli`` plug-in system exposes name space ``dtool.cli`` for
|
|
29
|
-
registering commands.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
To create a ``dtool-cli`` plug-in, create a Python package and register the
|
|
33
|
-
function of interest in the ``setup.py`` file. Below is the content of a
|
|
34
|
-
hypothetical ``dtool_create/__init__.py`` file::
|
|
35
|
-
|
|
36
|
-
import click
|
|
37
|
-
|
|
38
|
-
@click.command()
|
|
39
|
-
def create():
|
|
40
|
-
print("Creating dataset...")
|
|
41
|
-
|
|
42
|
-
@click.command()
|
|
43
|
-
def freeze():
|
|
44
|
-
print("Freezing dataset...")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
To create an entry point for this function add the below in the ``setup.py``::
|
|
48
|
-
|
|
49
|
-
from setuptools import setup
|
|
50
|
-
|
|
51
|
-
setup(
|
|
52
|
-
...
|
|
53
|
-
entry_points={
|
|
54
|
-
"dtool.cli": [
|
|
55
|
-
"create=dtool_create:create",
|
|
56
|
-
"freeze=dtool_create:freeze",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
...
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Installation
|
|
65
|
-
------------
|
|
66
|
-
|
|
67
|
-
To install the dtool-cli package.
|
|
68
|
-
|
|
69
|
-
.. code-block:: bash
|
|
70
|
-
|
|
71
|
-
cd dtool-cli
|
|
72
|
-
python setup.py install
|
|
73
|
-
|
|
74
|
-
Platform: UNKNOWN
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
LICENSE.rst
|
|
2
|
-
MANIFEST.in
|
|
3
|
-
README.rst
|
|
4
|
-
setup.cfg
|
|
5
|
-
setup.py
|
|
6
|
-
dtool_cli/__init__.py
|
|
7
|
-
dtool_cli/cli.py
|
|
8
|
-
dtool_cli.egg-info/PKG-INFO
|
|
9
|
-
dtool_cli.egg-info/SOURCES.txt
|
|
10
|
-
dtool_cli.egg-info/dependency_links.txt
|
|
11
|
-
dtool_cli.egg-info/entry_points.txt
|
|
12
|
-
dtool_cli.egg-info/requires.txt
|
|
13
|
-
dtool_cli.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dtool_cli
|
dtool-cli-0.7.1/setup.cfg
DELETED
dtool-cli-0.7.1/setup.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
url = "https://github.com/jic-dtool/dtool-cli"
|
|
4
|
-
version = "0.7.1"
|
|
5
|
-
readme = open('README.rst').read()
|
|
6
|
-
|
|
7
|
-
setup(
|
|
8
|
-
name="dtool-cli",
|
|
9
|
-
packages=["dtool_cli"],
|
|
10
|
-
version=version,
|
|
11
|
-
description="Data management command line tool: dtool.",
|
|
12
|
-
long_description=readme,
|
|
13
|
-
include_package_data=True,
|
|
14
|
-
author="Tjelvar Olsson",
|
|
15
|
-
author_email="tjelvar.olsson@gmail.com",
|
|
16
|
-
url=url,
|
|
17
|
-
install_requires=[
|
|
18
|
-
"click",
|
|
19
|
-
"click-plugins",
|
|
20
|
-
"dtoolcore>=2",
|
|
21
|
-
],
|
|
22
|
-
entry_points={
|
|
23
|
-
'console_scripts': ['dtool=dtool_cli.cli:dtool'],
|
|
24
|
-
},
|
|
25
|
-
download_url="{}/tarball/{}".format(url, version),
|
|
26
|
-
license="MIT"
|
|
27
|
-
)
|
|
File without changes
|