tro-utils 0.1.3__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.
- tro_utils-0.1.3/AUTHORS.rst +13 -0
- tro_utils-0.1.3/CONTRIBUTING.rst +128 -0
- tro_utils-0.1.3/HISTORY.rst +8 -0
- tro_utils-0.1.3/LICENSE +32 -0
- tro_utils-0.1.3/MANIFEST.in +11 -0
- tro_utils-0.1.3/PKG-INFO +190 -0
- tro_utils-0.1.3/README.rst +114 -0
- tro_utils-0.1.3/docs/Makefile +20 -0
- tro_utils-0.1.3/docs/authors.rst +1 -0
- tro_utils-0.1.3/docs/conf.py +162 -0
- tro_utils-0.1.3/docs/contributing.rst +1 -0
- tro_utils-0.1.3/docs/history.rst +1 -0
- tro_utils-0.1.3/docs/index.rst +20 -0
- tro_utils-0.1.3/docs/installation.rst +51 -0
- tro_utils-0.1.3/docs/make.bat +36 -0
- tro_utils-0.1.3/docs/readme.rst +1 -0
- tro_utils-0.1.3/docs/usage.rst +7 -0
- tro_utils-0.1.3/pyproject.toml +63 -0
- tro_utils-0.1.3/setup.cfg +23 -0
- tro_utils-0.1.3/tests/__init__.py +1 -0
- tro_utils-0.1.3/tests/test_cli.py +479 -0
- tro_utils-0.1.3/tests/test_tro_utils.py +1262 -0
- tro_utils-0.1.3/tro_utils/__init__.py +21 -0
- tro_utils-0.1.3/tro_utils/cli.py +394 -0
- tro_utils-0.1.3/tro_utils/default.jinja2 +69 -0
- tro_utils-0.1.3/tro_utils/tro_utils.py +610 -0
- tro_utils-0.1.3/tro_utils.egg-info/PKG-INFO +190 -0
- tro_utils-0.1.3/tro_utils.egg-info/SOURCES.txt +31 -0
- tro_utils-0.1.3/tro_utils.egg-info/dependency_links.txt +1 -0
- tro_utils-0.1.3/tro_utils.egg-info/entry_points.txt +2 -0
- tro_utils-0.1.3/tro_utils.egg-info/requires.txt +25 -0
- tro_utils-0.1.3/tro_utils.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
.. highlight:: shell
|
|
2
|
+
|
|
3
|
+
============
|
|
4
|
+
Contributing
|
|
5
|
+
============
|
|
6
|
+
|
|
7
|
+
Contributions are welcome, and they are greatly appreciated! Every little bit
|
|
8
|
+
helps, and credit will always be given.
|
|
9
|
+
|
|
10
|
+
You can contribute in many ways:
|
|
11
|
+
|
|
12
|
+
Types of Contributions
|
|
13
|
+
----------------------
|
|
14
|
+
|
|
15
|
+
Report Bugs
|
|
16
|
+
~~~~~~~~~~~
|
|
17
|
+
|
|
18
|
+
Report bugs at https://github.com/Xarthisius/tro_utils/issues.
|
|
19
|
+
|
|
20
|
+
If you are reporting a bug, please include:
|
|
21
|
+
|
|
22
|
+
* Your operating system name and version.
|
|
23
|
+
* Any details about your local setup that might be helpful in troubleshooting.
|
|
24
|
+
* Detailed steps to reproduce the bug.
|
|
25
|
+
|
|
26
|
+
Fix Bugs
|
|
27
|
+
~~~~~~~~
|
|
28
|
+
|
|
29
|
+
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
|
|
30
|
+
wanted" is open to whoever wants to implement it.
|
|
31
|
+
|
|
32
|
+
Implement Features
|
|
33
|
+
~~~~~~~~~~~~~~~~~~
|
|
34
|
+
|
|
35
|
+
Look through the GitHub issues for features. Anything tagged with "enhancement"
|
|
36
|
+
and "help wanted" is open to whoever wants to implement it.
|
|
37
|
+
|
|
38
|
+
Write Documentation
|
|
39
|
+
~~~~~~~~~~~~~~~~~~~
|
|
40
|
+
|
|
41
|
+
Transparent Research Object utils could always use more documentation, whether as part of the
|
|
42
|
+
official Transparent Research Object utils docs, in docstrings, or even on the web in blog posts,
|
|
43
|
+
articles, and such.
|
|
44
|
+
|
|
45
|
+
Submit Feedback
|
|
46
|
+
~~~~~~~~~~~~~~~
|
|
47
|
+
|
|
48
|
+
The best way to send feedback is to file an issue at https://github.com/Xarthisius/tro_utils/issues.
|
|
49
|
+
|
|
50
|
+
If you are proposing a feature:
|
|
51
|
+
|
|
52
|
+
* Explain in detail how it would work.
|
|
53
|
+
* Keep the scope as narrow as possible, to make it easier to implement.
|
|
54
|
+
* Remember that this is a volunteer-driven project, and that contributions
|
|
55
|
+
are welcome :)
|
|
56
|
+
|
|
57
|
+
Get Started!
|
|
58
|
+
------------
|
|
59
|
+
|
|
60
|
+
Ready to contribute? Here's how to set up `tro_utils` for local development.
|
|
61
|
+
|
|
62
|
+
1. Fork the `tro_utils` repo on GitHub.
|
|
63
|
+
2. Clone your fork locally::
|
|
64
|
+
|
|
65
|
+
$ git clone git@github.com:your_name_here/tro_utils.git
|
|
66
|
+
|
|
67
|
+
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
|
|
68
|
+
|
|
69
|
+
$ mkvirtualenv tro_utils
|
|
70
|
+
$ cd tro_utils/
|
|
71
|
+
$ python setup.py develop
|
|
72
|
+
|
|
73
|
+
4. Create a branch for local development::
|
|
74
|
+
|
|
75
|
+
$ git checkout -b name-of-your-bugfix-or-feature
|
|
76
|
+
|
|
77
|
+
Now you can make your changes locally.
|
|
78
|
+
|
|
79
|
+
5. When you're done making changes, check that your changes pass flake8 and the
|
|
80
|
+
tests, including testing other Python versions with tox::
|
|
81
|
+
|
|
82
|
+
$ flake8 tro_utils tests
|
|
83
|
+
$ python setup.py test or pytest
|
|
84
|
+
$ tox
|
|
85
|
+
|
|
86
|
+
To get flake8 and tox, just pip install them into your virtualenv.
|
|
87
|
+
|
|
88
|
+
6. Commit your changes and push your branch to GitHub::
|
|
89
|
+
|
|
90
|
+
$ git add .
|
|
91
|
+
$ git commit -m "Your detailed description of your changes."
|
|
92
|
+
$ git push origin name-of-your-bugfix-or-feature
|
|
93
|
+
|
|
94
|
+
7. Submit a pull request through the GitHub website.
|
|
95
|
+
|
|
96
|
+
Pull Request Guidelines
|
|
97
|
+
-----------------------
|
|
98
|
+
|
|
99
|
+
Before you submit a pull request, check that it meets these guidelines:
|
|
100
|
+
|
|
101
|
+
1. The pull request should include tests.
|
|
102
|
+
2. If the pull request adds functionality, the docs should be updated. Put
|
|
103
|
+
your new functionality into a function with a docstring, and add the
|
|
104
|
+
feature to the list in README.rst.
|
|
105
|
+
3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
|
|
106
|
+
https://travis-ci.com/Xarthisius/tro_utils/pull_requests
|
|
107
|
+
and make sure that the tests pass for all supported Python versions.
|
|
108
|
+
|
|
109
|
+
Tips
|
|
110
|
+
----
|
|
111
|
+
|
|
112
|
+
To run a subset of tests::
|
|
113
|
+
|
|
114
|
+
$ pytest tests.test_tro_utils
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
Deploying
|
|
118
|
+
---------
|
|
119
|
+
|
|
120
|
+
A reminder for the maintainers on how to deploy.
|
|
121
|
+
Make sure all your changes are committed (including an entry in HISTORY.rst).
|
|
122
|
+
Then run::
|
|
123
|
+
|
|
124
|
+
$ bump2version patch # possible: major / minor / patch
|
|
125
|
+
$ git push
|
|
126
|
+
$ git push --tags
|
|
127
|
+
|
|
128
|
+
Travis will then deploy to PyPI if tests pass.
|
tro_utils-0.1.3/LICENSE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
BSD License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2024, Kacper Kowalik
|
|
6
|
+
All rights reserved.
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
9
|
+
are permitted provided that the following conditions are met:
|
|
10
|
+
|
|
11
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
12
|
+
list of conditions and the following disclaimer.
|
|
13
|
+
|
|
14
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
16
|
+
other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
* Neither the name of the copyright holder nor the names of its
|
|
19
|
+
contributors may be used to endorse or promote products derived from this
|
|
20
|
+
software without specific prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
23
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
24
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
25
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
26
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
27
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
29
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
30
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
31
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include AUTHORS.rst
|
|
2
|
+
include CONTRIBUTING.rst
|
|
3
|
+
include HISTORY.rst
|
|
4
|
+
include LICENSE
|
|
5
|
+
include README.rst
|
|
6
|
+
|
|
7
|
+
recursive-include tests *
|
|
8
|
+
recursive-exclude * __pycache__
|
|
9
|
+
recursive-exclude * *.py[co]
|
|
10
|
+
|
|
11
|
+
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
tro_utils-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tro-utils
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Utilities for creating, editing and interacting with TROs
|
|
5
|
+
Author-email: Kacper Kowalik <xarthisius.kk@gmail.com>, Craig Willis <willis8@illinois.edu>
|
|
6
|
+
Maintainer-email: Kacper Kowalik <xarthisius.kk@gmail.com>
|
|
7
|
+
License:
|
|
8
|
+
|
|
9
|
+
BSD License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2024, Kacper Kowalik
|
|
12
|
+
All rights reserved.
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
15
|
+
are permitted provided that the following conditions are met:
|
|
16
|
+
|
|
17
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
18
|
+
list of conditions and the following disclaimer.
|
|
19
|
+
|
|
20
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
21
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
22
|
+
other materials provided with the distribution.
|
|
23
|
+
|
|
24
|
+
* Neither the name of the copyright holder nor the names of its
|
|
25
|
+
contributors may be used to endorse or promote products derived from this
|
|
26
|
+
software without specific prior written permission.
|
|
27
|
+
|
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
29
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
30
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
31
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
32
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
33
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
34
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
35
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
36
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
37
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Classifier: Development Status :: 3 - Alpha
|
|
41
|
+
Classifier: Intended Audience :: Developers
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
43
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
44
|
+
Classifier: Programming Language :: Python :: 3
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
48
|
+
Requires-Python: >=3.10
|
|
49
|
+
Description-Content-Type: text/x-rst
|
|
50
|
+
License-File: LICENSE
|
|
51
|
+
License-File: AUTHORS.rst
|
|
52
|
+
Requires-Dist: Click>=7.0
|
|
53
|
+
Requires-Dist: jinja2
|
|
54
|
+
Requires-Dist: requests
|
|
55
|
+
Requires-Dist: python-gnupg
|
|
56
|
+
Requires-Dist: python-magic
|
|
57
|
+
Requires-Dist: rfc3161ng
|
|
58
|
+
Requires-Dist: graphviz
|
|
59
|
+
Requires-Dist: rich
|
|
60
|
+
Provides-Extra: test
|
|
61
|
+
Requires-Dist: pytest>=6.2.4; extra == "test"
|
|
62
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "test"
|
|
63
|
+
Requires-Dist: coverage>=7.0; extra == "test"
|
|
64
|
+
Provides-Extra: dev
|
|
65
|
+
Requires-Dist: pytest>=6.2.4; extra == "dev"
|
|
66
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
67
|
+
Requires-Dist: coverage>=7.0; extra == "dev"
|
|
68
|
+
Requires-Dist: bump2version>=0.5.11; extra == "dev"
|
|
69
|
+
Requires-Dist: wheel>=0.33.6; extra == "dev"
|
|
70
|
+
Requires-Dist: watchdog>=0.9.0; extra == "dev"
|
|
71
|
+
Requires-Dist: flake8>=3.7.8; extra == "dev"
|
|
72
|
+
Requires-Dist: tox>=3.14.0; extra == "dev"
|
|
73
|
+
Requires-Dist: Sphinx>=1.8.5; extra == "dev"
|
|
74
|
+
Requires-Dist: twine>=1.14.0; extra == "dev"
|
|
75
|
+
Dynamic: license-file
|
|
76
|
+
|
|
77
|
+
=================================
|
|
78
|
+
Transparent Research Object utils
|
|
79
|
+
=================================
|
|
80
|
+
|
|
81
|
+
.. image:: https://img.shields.io/pypi/v/tro_utils.svg
|
|
82
|
+
:target: https://pypi.python.org/pypi/tro-utils
|
|
83
|
+
|
|
84
|
+
.. image:: https://zenodo.org/badge/765298086.svg
|
|
85
|
+
:target: https://zenodo.org/doi/10.5281/zenodo.11130420
|
|
86
|
+
|
|
87
|
+
.. image:: https://readthedocs.org/projects/tro-utils/badge/?version=latest
|
|
88
|
+
:target: https://tro-utils.readthedocs.io/en/latest/?version=latest
|
|
89
|
+
:alt: Documentation Status
|
|
90
|
+
|
|
91
|
+
This package provides a set of utilities for working with Transparent Research Objects (TROs). It is designed to be used in
|
|
92
|
+
conjunction with the `TRO specification <https://transparency-certified.github.io/trace-specification/docs/specifications/tro/0.1/index.html>`_.
|
|
93
|
+
|
|
94
|
+
It uses the ``Click`` library to define commands and options. Here's a summary of the main features:
|
|
95
|
+
|
|
96
|
+
1. **Global Options**: The script defines several global options that can be used with any command,
|
|
97
|
+
such as ``--declaration``, ``--profile``, ``--gpg-fingerprint``, ``--gpg-passphrase``, ``--tro-creator``,
|
|
98
|
+
``--tro-name``, and ``--tro-description``. These options can be used to specify various parameters for the TRO.
|
|
99
|
+
|
|
100
|
+
1. **Commands**: The script defines several commands, each with its own set of options and arguments. The commands include:
|
|
101
|
+
|
|
102
|
+
- ``verify``: Verifies that the TRO is signed and timestamped correctly.
|
|
103
|
+
|
|
104
|
+
- ``arrangement``: Manages arrangements in the TRO. It has subcommands like ``add`` (adds a directory as a composition to the TRO)
|
|
105
|
+
and ``list`` (lists available arrangements in the TRO).
|
|
106
|
+
|
|
107
|
+
- ``composition``: Manages compositions in the TRO. It has a subcommand ``info`` that gets info about the current composition.
|
|
108
|
+
|
|
109
|
+
- ``performance``: Manages performances in the TRO. It has a subcommand ``add`` that adds a performance to the TRO.
|
|
110
|
+
|
|
111
|
+
- ``sign``: Signs the TRO.
|
|
112
|
+
|
|
113
|
+
- ``report``: Generates a report of the TRO.
|
|
114
|
+
|
|
115
|
+
1. **TRO Interaction**: The script interacts with the TRO using the ``TRO`` class from the ``tro_utils`` module.
|
|
116
|
+
It uses this class to create a new TRO, add arrangements and performances to the TRO, verify the TRO,
|
|
117
|
+
and generate a report of the TRO.
|
|
118
|
+
|
|
119
|
+
Example Usage
|
|
120
|
+
-------------
|
|
121
|
+
|
|
122
|
+
Assumes that:
|
|
123
|
+
|
|
124
|
+
* this package is installed
|
|
125
|
+
* your GPG key is present
|
|
126
|
+
* ``trs.jsonld`` is available and defines TRS capabilities (see below for an example)
|
|
127
|
+
|
|
128
|
+
Example workflow::
|
|
129
|
+
|
|
130
|
+
$ cd /tmp
|
|
131
|
+
$ cat trs.jsonld
|
|
132
|
+
{
|
|
133
|
+
"rdfs:comment": "TRS that can monitor netowork accesses or provide Internet isolation",
|
|
134
|
+
"trov:hasCapability": [
|
|
135
|
+
{
|
|
136
|
+
"@id": "trs/capability/1",
|
|
137
|
+
"@type": "trov:CanRecordInternetAccess"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"@id": "trs/capability/2",
|
|
141
|
+
"@type": "trov:CanProvideInternetIsolation"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"trov:owner": "Kacper Kowalik",
|
|
145
|
+
"trov:description": "My local system",
|
|
146
|
+
"trov:contact": "root@dev.null",
|
|
147
|
+
"trov:url": "http://127.0.0.1/",
|
|
148
|
+
"trov:name": "shakuras"
|
|
149
|
+
}
|
|
150
|
+
$ export GPG_FINGERPRINT=...
|
|
151
|
+
$ export GPG_PASSPHRASE=...
|
|
152
|
+
$ git clone https://github.com/transparency-certified/sample-trace-workflow /tmp/sample
|
|
153
|
+
# It's sufficient to pass the profile only once
|
|
154
|
+
$ tro-utils --declaration sample_tro.jsonld --profile trs.jsonld arrangement add /tmp/sample \
|
|
155
|
+
-m "Before executing workflow" -i .git
|
|
156
|
+
Loading profile from trs.jsonld
|
|
157
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement list
|
|
158
|
+
Arrangement(id=arrangement/0): Before executing workflow
|
|
159
|
+
$ pushd /tmp/sample && \
|
|
160
|
+
docker build -t xarthisius/sample . && \
|
|
161
|
+
./run_locally.sh latest xarthisius && \
|
|
162
|
+
popd
|
|
163
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement add /tmp/sample \
|
|
164
|
+
-m "After executing workflow" -i .git
|
|
165
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement list
|
|
166
|
+
Arrangement(id=arrangement/0): Before executing workflow
|
|
167
|
+
Arrangement(id=arrangement/1): After executing workflow
|
|
168
|
+
$ tro-utils --declaration sample_tro.jsonld performance add \
|
|
169
|
+
-m "My magic workflow" \
|
|
170
|
+
-s 2024-03-01T09:22:01 \
|
|
171
|
+
-e 2024-03-02T10:00:11 \
|
|
172
|
+
-c trov:InternetIsolation \
|
|
173
|
+
-c trov:InternetAccessRecording \
|
|
174
|
+
-a arrangement/0 \
|
|
175
|
+
-M arrangement/1
|
|
176
|
+
$ tro-utils --declaration sample_tro.jsonld sign
|
|
177
|
+
$ tro-utils --declaration sample_tro.jsonld verify
|
|
178
|
+
...
|
|
179
|
+
Verification: OK
|
|
180
|
+
$ curl -LO https://raw.githubusercontent.com/craig-willis/trace-report/main/templates/tro.md.jinja2
|
|
181
|
+
$ tro-utils --declaration sample_tro.jsonld report --template tro.md.jinja2 -o report.md
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
Credits
|
|
185
|
+
-------
|
|
186
|
+
|
|
187
|
+
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
188
|
+
|
|
189
|
+
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
190
|
+
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
=================================
|
|
2
|
+
Transparent Research Object utils
|
|
3
|
+
=================================
|
|
4
|
+
|
|
5
|
+
.. image:: https://img.shields.io/pypi/v/tro_utils.svg
|
|
6
|
+
:target: https://pypi.python.org/pypi/tro-utils
|
|
7
|
+
|
|
8
|
+
.. image:: https://zenodo.org/badge/765298086.svg
|
|
9
|
+
:target: https://zenodo.org/doi/10.5281/zenodo.11130420
|
|
10
|
+
|
|
11
|
+
.. image:: https://readthedocs.org/projects/tro-utils/badge/?version=latest
|
|
12
|
+
:target: https://tro-utils.readthedocs.io/en/latest/?version=latest
|
|
13
|
+
:alt: Documentation Status
|
|
14
|
+
|
|
15
|
+
This package provides a set of utilities for working with Transparent Research Objects (TROs). It is designed to be used in
|
|
16
|
+
conjunction with the `TRO specification <https://transparency-certified.github.io/trace-specification/docs/specifications/tro/0.1/index.html>`_.
|
|
17
|
+
|
|
18
|
+
It uses the ``Click`` library to define commands and options. Here's a summary of the main features:
|
|
19
|
+
|
|
20
|
+
1. **Global Options**: The script defines several global options that can be used with any command,
|
|
21
|
+
such as ``--declaration``, ``--profile``, ``--gpg-fingerprint``, ``--gpg-passphrase``, ``--tro-creator``,
|
|
22
|
+
``--tro-name``, and ``--tro-description``. These options can be used to specify various parameters for the TRO.
|
|
23
|
+
|
|
24
|
+
1. **Commands**: The script defines several commands, each with its own set of options and arguments. The commands include:
|
|
25
|
+
|
|
26
|
+
- ``verify``: Verifies that the TRO is signed and timestamped correctly.
|
|
27
|
+
|
|
28
|
+
- ``arrangement``: Manages arrangements in the TRO. It has subcommands like ``add`` (adds a directory as a composition to the TRO)
|
|
29
|
+
and ``list`` (lists available arrangements in the TRO).
|
|
30
|
+
|
|
31
|
+
- ``composition``: Manages compositions in the TRO. It has a subcommand ``info`` that gets info about the current composition.
|
|
32
|
+
|
|
33
|
+
- ``performance``: Manages performances in the TRO. It has a subcommand ``add`` that adds a performance to the TRO.
|
|
34
|
+
|
|
35
|
+
- ``sign``: Signs the TRO.
|
|
36
|
+
|
|
37
|
+
- ``report``: Generates a report of the TRO.
|
|
38
|
+
|
|
39
|
+
1. **TRO Interaction**: The script interacts with the TRO using the ``TRO`` class from the ``tro_utils`` module.
|
|
40
|
+
It uses this class to create a new TRO, add arrangements and performances to the TRO, verify the TRO,
|
|
41
|
+
and generate a report of the TRO.
|
|
42
|
+
|
|
43
|
+
Example Usage
|
|
44
|
+
-------------
|
|
45
|
+
|
|
46
|
+
Assumes that:
|
|
47
|
+
|
|
48
|
+
* this package is installed
|
|
49
|
+
* your GPG key is present
|
|
50
|
+
* ``trs.jsonld`` is available and defines TRS capabilities (see below for an example)
|
|
51
|
+
|
|
52
|
+
Example workflow::
|
|
53
|
+
|
|
54
|
+
$ cd /tmp
|
|
55
|
+
$ cat trs.jsonld
|
|
56
|
+
{
|
|
57
|
+
"rdfs:comment": "TRS that can monitor netowork accesses or provide Internet isolation",
|
|
58
|
+
"trov:hasCapability": [
|
|
59
|
+
{
|
|
60
|
+
"@id": "trs/capability/1",
|
|
61
|
+
"@type": "trov:CanRecordInternetAccess"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"@id": "trs/capability/2",
|
|
65
|
+
"@type": "trov:CanProvideInternetIsolation"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"trov:owner": "Kacper Kowalik",
|
|
69
|
+
"trov:description": "My local system",
|
|
70
|
+
"trov:contact": "root@dev.null",
|
|
71
|
+
"trov:url": "http://127.0.0.1/",
|
|
72
|
+
"trov:name": "shakuras"
|
|
73
|
+
}
|
|
74
|
+
$ export GPG_FINGERPRINT=...
|
|
75
|
+
$ export GPG_PASSPHRASE=...
|
|
76
|
+
$ git clone https://github.com/transparency-certified/sample-trace-workflow /tmp/sample
|
|
77
|
+
# It's sufficient to pass the profile only once
|
|
78
|
+
$ tro-utils --declaration sample_tro.jsonld --profile trs.jsonld arrangement add /tmp/sample \
|
|
79
|
+
-m "Before executing workflow" -i .git
|
|
80
|
+
Loading profile from trs.jsonld
|
|
81
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement list
|
|
82
|
+
Arrangement(id=arrangement/0): Before executing workflow
|
|
83
|
+
$ pushd /tmp/sample && \
|
|
84
|
+
docker build -t xarthisius/sample . && \
|
|
85
|
+
./run_locally.sh latest xarthisius && \
|
|
86
|
+
popd
|
|
87
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement add /tmp/sample \
|
|
88
|
+
-m "After executing workflow" -i .git
|
|
89
|
+
$ tro-utils --declaration sample_tro.jsonld arrangement list
|
|
90
|
+
Arrangement(id=arrangement/0): Before executing workflow
|
|
91
|
+
Arrangement(id=arrangement/1): After executing workflow
|
|
92
|
+
$ tro-utils --declaration sample_tro.jsonld performance add \
|
|
93
|
+
-m "My magic workflow" \
|
|
94
|
+
-s 2024-03-01T09:22:01 \
|
|
95
|
+
-e 2024-03-02T10:00:11 \
|
|
96
|
+
-c trov:InternetIsolation \
|
|
97
|
+
-c trov:InternetAccessRecording \
|
|
98
|
+
-a arrangement/0 \
|
|
99
|
+
-M arrangement/1
|
|
100
|
+
$ tro-utils --declaration sample_tro.jsonld sign
|
|
101
|
+
$ tro-utils --declaration sample_tro.jsonld verify
|
|
102
|
+
...
|
|
103
|
+
Verification: OK
|
|
104
|
+
$ curl -LO https://raw.githubusercontent.com/craig-willis/trace-report/main/templates/tro.md.jinja2
|
|
105
|
+
$ tro-utils --declaration sample_tro.jsonld report --template tro.md.jinja2 -o report.md
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Credits
|
|
109
|
+
-------
|
|
110
|
+
|
|
111
|
+
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
112
|
+
|
|
113
|
+
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
114
|
+
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
@@ -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 = python -msphinx
|
|
7
|
+
SPHINXPROJ = tro_utils
|
|
8
|
+
SOURCEDIR = .
|
|
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 @@
|
|
|
1
|
+
.. include:: ../AUTHORS.rst
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# tro_utils documentation build configuration file, created by
|
|
4
|
+
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
|
|
5
|
+
#
|
|
6
|
+
# This file is execfile()d with the current directory set to its
|
|
7
|
+
# containing dir.
|
|
8
|
+
#
|
|
9
|
+
# Note that not all possible configuration values are present in this
|
|
10
|
+
# autogenerated file.
|
|
11
|
+
#
|
|
12
|
+
# All configuration values have a default; values that are commented out
|
|
13
|
+
# serve to show the default.
|
|
14
|
+
|
|
15
|
+
# If extensions (or modules to document with autodoc) are in another
|
|
16
|
+
# directory, add these directories to sys.path here. If the directory is
|
|
17
|
+
# relative to the documentation root, use os.path.abspath to make it
|
|
18
|
+
# absolute, like shown here.
|
|
19
|
+
#
|
|
20
|
+
import os
|
|
21
|
+
import sys
|
|
22
|
+
sys.path.insert(0, os.path.abspath('..'))
|
|
23
|
+
|
|
24
|
+
import tro_utils
|
|
25
|
+
|
|
26
|
+
# -- General configuration ---------------------------------------------
|
|
27
|
+
|
|
28
|
+
# If your documentation needs a minimal Sphinx version, state it here.
|
|
29
|
+
#
|
|
30
|
+
# needs_sphinx = '1.0'
|
|
31
|
+
|
|
32
|
+
# Add any Sphinx extension module names here, as strings. They can be
|
|
33
|
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
34
|
+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
|
|
35
|
+
|
|
36
|
+
# Add any paths that contain templates here, relative to this directory.
|
|
37
|
+
templates_path = ['_templates']
|
|
38
|
+
|
|
39
|
+
# The suffix(es) of source filenames.
|
|
40
|
+
# You can specify multiple suffix as a list of string:
|
|
41
|
+
#
|
|
42
|
+
# source_suffix = ['.rst', '.md']
|
|
43
|
+
source_suffix = '.rst'
|
|
44
|
+
|
|
45
|
+
# The master toctree document.
|
|
46
|
+
master_doc = 'index'
|
|
47
|
+
|
|
48
|
+
# General information about the project.
|
|
49
|
+
project = 'Transparent Research Object utils'
|
|
50
|
+
copyright = "2024, Kacper Kowalik"
|
|
51
|
+
author = "Kacper Kowalik"
|
|
52
|
+
|
|
53
|
+
# The version info for the project you're documenting, acts as replacement
|
|
54
|
+
# for |version| and |release|, also used in various other places throughout
|
|
55
|
+
# the built documents.
|
|
56
|
+
#
|
|
57
|
+
# The short X.Y version.
|
|
58
|
+
version = tro_utils.__version__
|
|
59
|
+
# The full version, including alpha/beta/rc tags.
|
|
60
|
+
release = tro_utils.__version__
|
|
61
|
+
|
|
62
|
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
63
|
+
# for a list of supported languages.
|
|
64
|
+
#
|
|
65
|
+
# This is also used if you do content translation via gettext catalogs.
|
|
66
|
+
# Usually you set "language" from the command line for these cases.
|
|
67
|
+
language = None
|
|
68
|
+
|
|
69
|
+
# List of patterns, relative to source directory, that match files and
|
|
70
|
+
# directories to ignore when looking for source files.
|
|
71
|
+
# This patterns also effect to html_static_path and html_extra_path
|
|
72
|
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
73
|
+
|
|
74
|
+
# The name of the Pygments (syntax highlighting) style to use.
|
|
75
|
+
pygments_style = 'sphinx'
|
|
76
|
+
|
|
77
|
+
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
78
|
+
todo_include_todos = False
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# -- Options for HTML output -------------------------------------------
|
|
82
|
+
|
|
83
|
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
84
|
+
# a list of builtin themes.
|
|
85
|
+
#
|
|
86
|
+
html_theme = 'alabaster'
|
|
87
|
+
|
|
88
|
+
# Theme options are theme-specific and customize the look and feel of a
|
|
89
|
+
# theme further. For a list of options available for each theme, see the
|
|
90
|
+
# documentation.
|
|
91
|
+
#
|
|
92
|
+
# html_theme_options = {}
|
|
93
|
+
|
|
94
|
+
# Add any paths that contain custom static files (such as style sheets) here,
|
|
95
|
+
# relative to this directory. They are copied after the builtin static files,
|
|
96
|
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
97
|
+
html_static_path = ['_static']
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# -- Options for HTMLHelp output ---------------------------------------
|
|
101
|
+
|
|
102
|
+
# Output file base name for HTML help builder.
|
|
103
|
+
htmlhelp_basename = 'tro_utilsdoc'
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# -- Options for LaTeX output ------------------------------------------
|
|
107
|
+
|
|
108
|
+
latex_elements = {
|
|
109
|
+
# The paper size ('letterpaper' or 'a4paper').
|
|
110
|
+
#
|
|
111
|
+
# 'papersize': 'letterpaper',
|
|
112
|
+
|
|
113
|
+
# The font size ('10pt', '11pt' or '12pt').
|
|
114
|
+
#
|
|
115
|
+
# 'pointsize': '10pt',
|
|
116
|
+
|
|
117
|
+
# Additional stuff for the LaTeX preamble.
|
|
118
|
+
#
|
|
119
|
+
# 'preamble': '',
|
|
120
|
+
|
|
121
|
+
# Latex figure (float) alignment
|
|
122
|
+
#
|
|
123
|
+
# 'figure_align': 'htbp',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Grouping the document tree into LaTeX files. List of tuples
|
|
127
|
+
# (source start file, target name, title, author, documentclass
|
|
128
|
+
# [howto, manual, or own class]).
|
|
129
|
+
latex_documents = [
|
|
130
|
+
(master_doc, 'tro_utils.tex',
|
|
131
|
+
'Transparent Research Object utils Documentation',
|
|
132
|
+
'Kacper Kowalik', 'manual'),
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# -- Options for manual page output ------------------------------------
|
|
137
|
+
|
|
138
|
+
# One entry per manual page. List of tuples
|
|
139
|
+
# (source start file, name, description, authors, manual section).
|
|
140
|
+
man_pages = [
|
|
141
|
+
(master_doc, 'tro_utils',
|
|
142
|
+
'Transparent Research Object utils Documentation',
|
|
143
|
+
[author], 1)
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# -- Options for Texinfo output ----------------------------------------
|
|
148
|
+
|
|
149
|
+
# Grouping the document tree into Texinfo files. List of tuples
|
|
150
|
+
# (source start file, target name, title, author,
|
|
151
|
+
# dir menu entry, description, category)
|
|
152
|
+
texinfo_documents = [
|
|
153
|
+
(master_doc, 'tro_utils',
|
|
154
|
+
'Transparent Research Object utils Documentation',
|
|
155
|
+
author,
|
|
156
|
+
'tro_utils',
|
|
157
|
+
'One line description of project.',
|
|
158
|
+
'Miscellaneous'),
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.. include:: ../CONTRIBUTING.rst
|