ceos-ard-cli 0.1.0__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.
- ceos_ard_cli-0.1.0/LICENSE +201 -0
- ceos_ard_cli-0.1.0/PKG-INFO +102 -0
- ceos_ard_cli-0.1.0/README.md +77 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/__init__.py +94 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/compile.py +136 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/generate.py +63 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/schema.py +74 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/validate.py +46 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli/version.py +1 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/PKG-INFO +102 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/SOURCES.txt +15 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/dependency_links.txt +1 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/entry_points.txt +2 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/requires.txt +5 -0
- ceos_ard_cli-0.1.0/ceos_ard_cli.egg-info/top_level.txt +1 -0
- ceos_ard_cli-0.1.0/setup.cfg +4 -0
- ceos_ard_cli-0.1.0/setup.py +44 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: ceos-ard-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tools for CEOS-ARD
|
|
5
|
+
Home-page: https://github.com/ceos-org/ceos-ard-cli
|
|
6
|
+
Author: Matthias Mohr
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: strictyaml>=1.7.0
|
|
13
|
+
Requires-Dist: jinja2>=3.1.0
|
|
14
|
+
Requires-Dist: click>=8.0.0
|
|
15
|
+
Requires-Dist: weasyprint>=64.0
|
|
16
|
+
Requires-Dist: bibtexparser==2.0.0b8
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# CEOS-ARD CLI <!-- omit in toc -->
|
|
27
|
+
|
|
28
|
+
CLI for working with the [CEOS-ARD building blocks and PFSes](https://github.com/ceos-org/ceos-ard).
|
|
29
|
+
|
|
30
|
+
- [Getting Started](#getting-started)
|
|
31
|
+
- [Installation](#installation)
|
|
32
|
+
- [Execute a command](#execute-a-command)
|
|
33
|
+
- [Commands](#commands)
|
|
34
|
+
- [`ceos-ard compile`: Compile PFS document to a Markdown file](#ceos-ard-compile-compile-pfs-document-to-a-markdown-file)
|
|
35
|
+
- [`ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS](#ceos-ard-generate-create-wordhtmlpdf-documents-for-a-single-pfs)
|
|
36
|
+
- [`ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes](#ceos-ard-generate-all-create-wordhtmlpdf-documents-for-all-pfses)
|
|
37
|
+
- [`ceos-ard validate`: Validate CEOS-ARD components](#ceos-ard-validate-validate-ceos-ard-components)
|
|
38
|
+
- [Development](#development)
|
|
39
|
+
|
|
40
|
+
## Getting Started
|
|
41
|
+
|
|
42
|
+
In order to make working with CEOS-ARD easier we have developed command-line interface (CLI) tools.
|
|
43
|
+
|
|
44
|
+
### Installation
|
|
45
|
+
|
|
46
|
+
You will need to have **Python 3.9** or any later version installed.
|
|
47
|
+
|
|
48
|
+
For the `generate` and `generate-all` commands you also need the following software installed:
|
|
49
|
+
|
|
50
|
+
- pandoc 3.6 or later (for Word + HTML generation)
|
|
51
|
+
- pandoc-crossref (for table/image/section references)
|
|
52
|
+
- pango-view (for PDF generation)
|
|
53
|
+
|
|
54
|
+
> ![NOTE]
|
|
55
|
+
> The following command doesn't work yet as the package as not been published on pypi yet.
|
|
56
|
+
> Please continue with the [Development](#development) instructions for now.
|
|
57
|
+
|
|
58
|
+
Run `pip install ceos-ard-cli` in the CLI to install the tool.
|
|
59
|
+
|
|
60
|
+
### Execute a command
|
|
61
|
+
|
|
62
|
+
After the installation you should be able to run the following command: `ceos-ard`
|
|
63
|
+
|
|
64
|
+
You should see usage instructions and [available commands](#commands) for the CLI.
|
|
65
|
+
|
|
66
|
+
## Commands
|
|
67
|
+
|
|
68
|
+
### `ceos-ard compile`: Compile PFS document to a Markdown file
|
|
69
|
+
|
|
70
|
+
To compile a PFS document to a Markdown file, run: `ceos-ard compile SR`
|
|
71
|
+
|
|
72
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
73
|
+
|
|
74
|
+
Check `ceos-ard compile --help` for more details.
|
|
75
|
+
|
|
76
|
+
### `ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS
|
|
77
|
+
|
|
78
|
+
To create the Word, HTML, and PDF versions of a single PFS, run: `ceos-ard generate SR`
|
|
79
|
+
|
|
80
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
81
|
+
|
|
82
|
+
Check `ceos-ard generate --help` for more details.
|
|
83
|
+
|
|
84
|
+
### `ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes
|
|
85
|
+
|
|
86
|
+
To create the Word, HTML, and PDF versions for all PFSes, run: `ceos-ard generate-all`
|
|
87
|
+
|
|
88
|
+
Check `ceos-ard generate-all --help` for more details.
|
|
89
|
+
|
|
90
|
+
### `ceos-ard validate`: Validate CEOS-ARD components
|
|
91
|
+
|
|
92
|
+
To validate (most of) the building blocks, run: `ceos-ard validate`
|
|
93
|
+
|
|
94
|
+
Check `ceos-ard validate --help` for more details.
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
1. Install the dependencies (Python, Pandoc, pandoc-crossref, pango-view) as indicated in [Installation](#installation)
|
|
99
|
+
2. Fork this repository if you plan to change the code or create pull requests.
|
|
100
|
+
3. Clone either your forked repository or this repository, e.g. `git clone https://github.com/ceos-org/ceos-ard-cli`
|
|
101
|
+
4. Switch into the newly created folder: `cd ceos-ard-cli`
|
|
102
|
+
5. Install this package in development mode: `pip install -e .`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# CEOS-ARD CLI <!-- omit in toc -->
|
|
2
|
+
|
|
3
|
+
CLI for working with the [CEOS-ARD building blocks and PFSes](https://github.com/ceos-org/ceos-ard).
|
|
4
|
+
|
|
5
|
+
- [Getting Started](#getting-started)
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Execute a command](#execute-a-command)
|
|
8
|
+
- [Commands](#commands)
|
|
9
|
+
- [`ceos-ard compile`: Compile PFS document to a Markdown file](#ceos-ard-compile-compile-pfs-document-to-a-markdown-file)
|
|
10
|
+
- [`ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS](#ceos-ard-generate-create-wordhtmlpdf-documents-for-a-single-pfs)
|
|
11
|
+
- [`ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes](#ceos-ard-generate-all-create-wordhtmlpdf-documents-for-all-pfses)
|
|
12
|
+
- [`ceos-ard validate`: Validate CEOS-ARD components](#ceos-ard-validate-validate-ceos-ard-components)
|
|
13
|
+
- [Development](#development)
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
In order to make working with CEOS-ARD easier we have developed command-line interface (CLI) tools.
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
You will need to have **Python 3.9** or any later version installed.
|
|
22
|
+
|
|
23
|
+
For the `generate` and `generate-all` commands you also need the following software installed:
|
|
24
|
+
|
|
25
|
+
- pandoc 3.6 or later (for Word + HTML generation)
|
|
26
|
+
- pandoc-crossref (for table/image/section references)
|
|
27
|
+
- pango-view (for PDF generation)
|
|
28
|
+
|
|
29
|
+
> ![NOTE]
|
|
30
|
+
> The following command doesn't work yet as the package as not been published on pypi yet.
|
|
31
|
+
> Please continue with the [Development](#development) instructions for now.
|
|
32
|
+
|
|
33
|
+
Run `pip install ceos-ard-cli` in the CLI to install the tool.
|
|
34
|
+
|
|
35
|
+
### Execute a command
|
|
36
|
+
|
|
37
|
+
After the installation you should be able to run the following command: `ceos-ard`
|
|
38
|
+
|
|
39
|
+
You should see usage instructions and [available commands](#commands) for the CLI.
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
### `ceos-ard compile`: Compile PFS document to a Markdown file
|
|
44
|
+
|
|
45
|
+
To compile a PFS document to a Markdown file, run: `ceos-ard compile SR`
|
|
46
|
+
|
|
47
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
48
|
+
|
|
49
|
+
Check `ceos-ard compile --help` for more details.
|
|
50
|
+
|
|
51
|
+
### `ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS
|
|
52
|
+
|
|
53
|
+
To create the Word, HTML, and PDF versions of a single PFS, run: `ceos-ard generate SR`
|
|
54
|
+
|
|
55
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
56
|
+
|
|
57
|
+
Check `ceos-ard generate --help` for more details.
|
|
58
|
+
|
|
59
|
+
### `ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes
|
|
60
|
+
|
|
61
|
+
To create the Word, HTML, and PDF versions for all PFSes, run: `ceos-ard generate-all`
|
|
62
|
+
|
|
63
|
+
Check `ceos-ard generate-all --help` for more details.
|
|
64
|
+
|
|
65
|
+
### `ceos-ard validate`: Validate CEOS-ARD components
|
|
66
|
+
|
|
67
|
+
To validate (most of) the building blocks, run: `ceos-ard validate`
|
|
68
|
+
|
|
69
|
+
Check `ceos-ard validate --help` for more details.
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
1. Install the dependencies (Python, Pandoc, pandoc-crossref, pango-view) as indicated in [Installation](#installation)
|
|
74
|
+
2. Fork this repository if you plan to change the code or create pull requests.
|
|
75
|
+
3. Clone either your forked repository or this repository, e.g. `git clone https://github.com/ceos-org/ceos-ard-cli`
|
|
76
|
+
4. Switch into the newly created folder: `cd ceos-ard-cli`
|
|
77
|
+
5. Install this package in development mode: `pip install -e .`
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from .compile import compile as compile_
|
|
5
|
+
from .generate import generate as generate_, generate_all as generate_all_
|
|
6
|
+
from .validate import validate as validate_
|
|
7
|
+
from .version import __version__
|
|
8
|
+
|
|
9
|
+
@click.group()
|
|
10
|
+
@click.version_option(version=__version__)
|
|
11
|
+
def cli():
|
|
12
|
+
"""
|
|
13
|
+
The CEOS ARD CLI.
|
|
14
|
+
"""
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
@click.command()
|
|
18
|
+
@click.argument('pfs', nargs=1)
|
|
19
|
+
@click.option('--output', '-o', default=None, help='Output file without file extension, defaults to the name of the given PFS')
|
|
20
|
+
@click.option('--editable', '-e', is_flag=True, default=False, help="Adds an 'Assessment' section to the requirements (for editable Word documents)")
|
|
21
|
+
def compile(pfs, output, editable):
|
|
22
|
+
"""
|
|
23
|
+
Compiles the Markdown file for the given PFS.
|
|
24
|
+
"""
|
|
25
|
+
print(f"CEOS-ARD CLI {__version__} - Compile {pfs} as Markdown\n")
|
|
26
|
+
|
|
27
|
+
if not output:
|
|
28
|
+
output = pfs
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
compile_(pfs, output, editable)
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print(e)
|
|
34
|
+
sys.exit(1)
|
|
35
|
+
|
|
36
|
+
@click.command()
|
|
37
|
+
@click.argument('pfs', nargs=1)
|
|
38
|
+
@click.option('--output', '-o', default=None, help='Output file without file extension, defaults to the name of the given PFS')
|
|
39
|
+
@click.option('--pdf', is_flag=True, default=True, help='Enable/disable PDF generation')
|
|
40
|
+
def generate(pfs, output, pdf):
|
|
41
|
+
"""
|
|
42
|
+
Generates the Word and HTML files for the given PFS.
|
|
43
|
+
|
|
44
|
+
Requires that pandoc is installed.
|
|
45
|
+
"""
|
|
46
|
+
print(f"CEOS-ARD CLI {__version__} - Generate {pfs}\n")
|
|
47
|
+
|
|
48
|
+
if not output:
|
|
49
|
+
output = pfs
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
generate_(pfs, output, pdf)
|
|
53
|
+
except Exception as e:
|
|
54
|
+
print(e)
|
|
55
|
+
sys.exit(1)
|
|
56
|
+
|
|
57
|
+
@click.command()
|
|
58
|
+
@click.option('--output', '-o', default="", help='Output folder, defaults to the current folder')
|
|
59
|
+
@click.option('--pdf', is_flag=True, default=True, help='Enable/disable PDF generation')
|
|
60
|
+
def generate_all(output, pdf):
|
|
61
|
+
"""
|
|
62
|
+
Generates all files for all PFS.
|
|
63
|
+
|
|
64
|
+
Requires that pandoc is installed.
|
|
65
|
+
"""
|
|
66
|
+
print(f"CEOS-ARD CLI {__version__} - Generate all PFS\n")
|
|
67
|
+
try:
|
|
68
|
+
errors = generate_all_(output, pdf)
|
|
69
|
+
print()
|
|
70
|
+
print(f"Done with {errors} errors")
|
|
71
|
+
sys.exit(errors)
|
|
72
|
+
except Exception as e:
|
|
73
|
+
print(e)
|
|
74
|
+
sys.exit(1)
|
|
75
|
+
|
|
76
|
+
@click.command()
|
|
77
|
+
def validate():
|
|
78
|
+
"""
|
|
79
|
+
Validates (most of) the building blocks.
|
|
80
|
+
"""
|
|
81
|
+
print(f"CEOS-ARD CLI {__version__} - Validate building blocks\n")
|
|
82
|
+
try:
|
|
83
|
+
validate_()
|
|
84
|
+
except Exception as e:
|
|
85
|
+
print(e)
|
|
86
|
+
sys.exit(1)
|
|
87
|
+
|
|
88
|
+
cli.add_command(compile)
|
|
89
|
+
cli.add_command(generate)
|
|
90
|
+
cli.add_command(generate_all)
|
|
91
|
+
cli.add_command(validate)
|
|
92
|
+
|
|
93
|
+
if __name__ == '__main__':
|
|
94
|
+
cli()
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from .utils.files import read_file, write_file
|
|
5
|
+
from .utils.pfs import read_pfs
|
|
6
|
+
from .utils.requirement import slugify
|
|
7
|
+
from .utils.template import read_template
|
|
8
|
+
from .schema import REFERENCE_PATH
|
|
9
|
+
|
|
10
|
+
def unique_merge(existing, additional, key = None):
|
|
11
|
+
if key is None:
|
|
12
|
+
return list(set(existing + additional))
|
|
13
|
+
else:
|
|
14
|
+
existing_keys = [e[key] for e in existing]
|
|
15
|
+
for a in additional:
|
|
16
|
+
if a[key] not in existing_keys:
|
|
17
|
+
existing.append(a)
|
|
18
|
+
return existing
|
|
19
|
+
|
|
20
|
+
def bubble_up(root):
|
|
21
|
+
return _bubble_up(root, root)
|
|
22
|
+
|
|
23
|
+
def _bubble_up(data, root):
|
|
24
|
+
if isinstance(data, dict):
|
|
25
|
+
if "glossary" in data:
|
|
26
|
+
root["glossary"] = unique_merge(root["glossary"], data["glossary"], "term")
|
|
27
|
+
if "references" in data:
|
|
28
|
+
root["references"] = unique_merge(root["references"], data["references"])
|
|
29
|
+
for v in data.values():
|
|
30
|
+
_bubble_up(v, root)
|
|
31
|
+
elif isinstance(data, list):
|
|
32
|
+
for v in data:
|
|
33
|
+
_bubble_up(v, root)
|
|
34
|
+
return root
|
|
35
|
+
|
|
36
|
+
def compile(pfs, out, editable = False):
|
|
37
|
+
folder = Path(out).parent
|
|
38
|
+
# create folder if needed
|
|
39
|
+
folder.mkdir(parents=True, exist_ok=True)
|
|
40
|
+
# copy assets if needed
|
|
41
|
+
assets = folder / "assets"
|
|
42
|
+
if not assets.exists():
|
|
43
|
+
shutil.copytree(Path("assets"), assets)
|
|
44
|
+
# read the PFS information
|
|
45
|
+
data = read_pfs(pfs)
|
|
46
|
+
# move the glossary and references to the top level
|
|
47
|
+
data = bubble_up(data)
|
|
48
|
+
# write a json file for debugging
|
|
49
|
+
# import json
|
|
50
|
+
# write_file(f"{out}.debug.json", json.dumps(data, indent=2))
|
|
51
|
+
# create the markfown template
|
|
52
|
+
compile_markdown(data, f"{out}.md", editable)
|
|
53
|
+
# write bibtex file to disk
|
|
54
|
+
compile_bibtex(data, f"{out}.bib")
|
|
55
|
+
|
|
56
|
+
def compile_bibtex(data, out):
|
|
57
|
+
references = []
|
|
58
|
+
# Read references form disk
|
|
59
|
+
for ref in data["references"]:
|
|
60
|
+
filepath = REFERENCE_PATH.format(id=ref)
|
|
61
|
+
bibtex = read_file(filepath)
|
|
62
|
+
references.append(bibtex)
|
|
63
|
+
# Merge into a single string
|
|
64
|
+
merged_bibtex = "\n".join(references)
|
|
65
|
+
# Write a single bibtex file back to disk
|
|
66
|
+
write_file(out, merged_bibtex)
|
|
67
|
+
|
|
68
|
+
# make uid unique so that it can be used in multiple categories
|
|
69
|
+
def create_uid(block, req_id):
|
|
70
|
+
return slugify(block['category']['id'] + "-" + req_id)
|
|
71
|
+
|
|
72
|
+
def compile_markdown(data, out, editable):
|
|
73
|
+
# create a copy of the data for the template
|
|
74
|
+
context = data.copy()
|
|
75
|
+
|
|
76
|
+
context["editable"] = editable
|
|
77
|
+
# sort glossary
|
|
78
|
+
context["glossary"] = sorted(context["glossary"], key = lambda x: x['term'].lower())
|
|
79
|
+
# todo: implement automatic creation of history based on git logs?
|
|
80
|
+
# todo: alternatively, add changelog to the individual files with a timestamp and compile it from there
|
|
81
|
+
context["history"] = "Not available yet"
|
|
82
|
+
|
|
83
|
+
# make a dict of all requirements for efficient dependency lookup
|
|
84
|
+
all_requirements = {}
|
|
85
|
+
# generate uid for each requirement and fill dependency lookups
|
|
86
|
+
for block in context["requirements"]:
|
|
87
|
+
# make a dict of the requirements in this category for efficient dependency lookup
|
|
88
|
+
local_requirements = {}
|
|
89
|
+
for req in block["requirements"]:
|
|
90
|
+
# make uid unique if it can be used in multiple categories
|
|
91
|
+
req['uid'] = create_uid(block, req['id'])
|
|
92
|
+
local_requirements[req['id']] = req['uid']
|
|
93
|
+
all_requirements[req['id']] = req['uid']
|
|
94
|
+
|
|
95
|
+
# resolve dependencies
|
|
96
|
+
for block in context["requirements"]:
|
|
97
|
+
for req in block["requirements"]:
|
|
98
|
+
for i, id in enumerate(req['dependencies']):
|
|
99
|
+
# 1. Check to the requirement in the same requirement category.
|
|
100
|
+
if id in local_requirements:
|
|
101
|
+
ref_id = local_requirements[id]
|
|
102
|
+
# 2. Refers to the requirement in any other category.
|
|
103
|
+
elif id in all_requirements:
|
|
104
|
+
ref_id = all_requirements[id]
|
|
105
|
+
else:
|
|
106
|
+
raise ValueError(f"Unmet dependency {id} for requirement {req['uid']}")
|
|
107
|
+
|
|
108
|
+
req['dependencies'][i] = ref_id
|
|
109
|
+
# Update the requirements in the texts
|
|
110
|
+
update_requirement_references(req, id, ref_id)
|
|
111
|
+
|
|
112
|
+
# read, fill and write the template
|
|
113
|
+
template = read_template()
|
|
114
|
+
markdown = template.render(**context)
|
|
115
|
+
write_file(out, markdown)
|
|
116
|
+
|
|
117
|
+
# replace all requirement references in the texts with the resolved references
|
|
118
|
+
def update_requirement_references(req, old_id, new_id):
|
|
119
|
+
req['description'] = update_requirement_reference(req['description'], old_id, new_id)
|
|
120
|
+
if req['threshold'] is not None:
|
|
121
|
+
req['threshold']['description'] = update_requirement_reference(req['threshold']['description'], old_id, new_id)
|
|
122
|
+
req['threshold']['notes'] = update_requirement_reference(req['threshold']['notes'], old_id, new_id)
|
|
123
|
+
if req['goal'] is not None:
|
|
124
|
+
req['goal']['description'] = update_requirement_reference(req['goal']['description'], old_id, new_id)
|
|
125
|
+
req['goal']['notes'] = update_requirement_reference(req['goal']['notes'], old_id, new_id)
|
|
126
|
+
|
|
127
|
+
# replace all requirement references in the given texts with the resolved references
|
|
128
|
+
def update_requirement_reference(req, old_id, new_id):
|
|
129
|
+
if isinstance(req, list):
|
|
130
|
+
return [update_requirement_reference(r, old_id, new_id) for r in req]
|
|
131
|
+
elif isinstance(req, str):
|
|
132
|
+
# todo: this can probably be improved with a regex to minimmize false positives
|
|
133
|
+
print(old_id, new_id)
|
|
134
|
+
return req.replace(f"@{old_id}", f"@sec:{new_id}")
|
|
135
|
+
else:
|
|
136
|
+
return req
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import weasyprint
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from .compile import compile
|
|
6
|
+
|
|
7
|
+
def generate_all(out, pdf = True):
|
|
8
|
+
# read all folders from the pfs folder
|
|
9
|
+
pfs_folder = Path("pfs")
|
|
10
|
+
errors = 0
|
|
11
|
+
for folder in pfs_folder.iterdir():
|
|
12
|
+
if folder.is_dir():
|
|
13
|
+
pfs = folder.stem
|
|
14
|
+
print(pfs)
|
|
15
|
+
try:
|
|
16
|
+
pfs_folder = Path(out) / pfs
|
|
17
|
+
generate(pfs, pfs_folder, pdf)
|
|
18
|
+
except Exception as e:
|
|
19
|
+
print(f"Error generating {folder}: {e}")
|
|
20
|
+
errors += 1
|
|
21
|
+
|
|
22
|
+
return errors
|
|
23
|
+
|
|
24
|
+
def generate(pfs, out, pdf = True):
|
|
25
|
+
print("- Generating editable Markdown")
|
|
26
|
+
compile(pfs, out, True)
|
|
27
|
+
|
|
28
|
+
print("- Generating Word")
|
|
29
|
+
run_pandoc(out, "docx")
|
|
30
|
+
|
|
31
|
+
print("- Generating read-only Markdown")
|
|
32
|
+
compile(pfs, out, False)
|
|
33
|
+
|
|
34
|
+
print("- Generating HTML")
|
|
35
|
+
run_pandoc(out, "html")
|
|
36
|
+
|
|
37
|
+
if pdf:
|
|
38
|
+
print("- Generating PDF")
|
|
39
|
+
weasyprint.HTML(f"{out}.html").write_pdf(f"{out}.pdf")
|
|
40
|
+
|
|
41
|
+
def run_pandoc(out, format):
|
|
42
|
+
cmd = [
|
|
43
|
+
"pandoc",
|
|
44
|
+
f"{out}.md", # input file
|
|
45
|
+
"-s", # standalone
|
|
46
|
+
"-o", f"{out}.{format}", # output file
|
|
47
|
+
"-t", format, # output format
|
|
48
|
+
"-F", "pandoc-crossref", # enable cross-references, must be before -C: https://lierdakil.github.io/pandoc-crossref/#citeproc-and-pandoc-crossref
|
|
49
|
+
"-C", # enable citation processing
|
|
50
|
+
f"--bibliography={out}.bib", # bibliography file
|
|
51
|
+
"-L", "templates/no-sectionnumbers.lua", # remove section numbers from reference links
|
|
52
|
+
"-L", "templates/pagebreak.lua", # page breaks
|
|
53
|
+
f"--template=templates/template.{format}", # template
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
if format == "html":
|
|
57
|
+
cmd.append("--mathml") # alternative: --webtex for image rendering
|
|
58
|
+
elif format == "docx":
|
|
59
|
+
cmd.append("--reference-doc=templates/style.docx")
|
|
60
|
+
else:
|
|
61
|
+
raise ValueError(f"Unsupported format {format}")
|
|
62
|
+
|
|
63
|
+
subprocess.run(cmd)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
from strictyaml import Map, Str, Seq, UniqueSeq, EmptyList, Optional, NullNone, EmptyDict
|
|
2
|
+
from .strictyaml.id_reference import IdReference
|
|
3
|
+
from .strictyaml.md_reference import MdReference
|
|
4
|
+
from .strictyaml.markdown import Markdown
|
|
5
|
+
|
|
6
|
+
REFERENCE_PATH = "./references/{id}.bib"
|
|
7
|
+
GLOSSARY_PATH = "./glossary/{id}.yaml"
|
|
8
|
+
INTRODUCTION_PATH = "./sections/introduction/{id}.yaml"
|
|
9
|
+
ANNEX_PATH = "./sections/annexes/{id}.yaml"
|
|
10
|
+
REQUIREMENT_CATEGORY_PATH = "./sections/requirement-categories/{id}.yaml"
|
|
11
|
+
REQUIREMENT_PATH = "./requirements/{id}.yaml"
|
|
12
|
+
|
|
13
|
+
_REFS = lambda path, schema = None, resolve = False: EmptyList() | UniqueSeq(IdReference(path, schema, resolve))
|
|
14
|
+
_RESOLVED_REFS = lambda path, schema: _REFS(path, schema, resolve = True)
|
|
15
|
+
_RESOLVED_SECTIONS = lambda path: _RESOLVED_REFS(path, SECTION)
|
|
16
|
+
_REFERENCE_IDS = _REFS(REFERENCE_PATH)
|
|
17
|
+
|
|
18
|
+
_MARKDOWN = lambda file: Markdown() | MdReference(file) # The order is important
|
|
19
|
+
|
|
20
|
+
_REQUIREMENT_PART = lambda file: NullNone() | Map({
|
|
21
|
+
'description': _MARKDOWN(file),
|
|
22
|
+
Optional('notes', default = []): EmptyList() | Seq(_MARKDOWN(file)),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
AUTHORS = lambda file: Seq(Map({
|
|
26
|
+
'name': Str(),
|
|
27
|
+
Optional('country', default = ''): Str(),
|
|
28
|
+
'members': UniqueSeq(Str()),
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
GLOSSARY = lambda file: Map({
|
|
32
|
+
'term': Str(),
|
|
33
|
+
'description': _MARKDOWN(file),
|
|
34
|
+
})
|
|
35
|
+
_RESOLVED_GLOSSARY = _RESOLVED_REFS(GLOSSARY_PATH, GLOSSARY)
|
|
36
|
+
|
|
37
|
+
SECTION = lambda file: Map({
|
|
38
|
+
Optional('id', default = ""): Str(),
|
|
39
|
+
'title': Str(),
|
|
40
|
+
'description': _MARKDOWN(file),
|
|
41
|
+
Optional('glossary', default = []): _RESOLVED_GLOSSARY,
|
|
42
|
+
Optional('references', default = []): _REFERENCE_IDS,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
PFS_DOCUMENT = lambda file: Map({
|
|
46
|
+
'id': Str(),
|
|
47
|
+
'title': Str(),
|
|
48
|
+
'type': Str(),
|
|
49
|
+
'applies_to': _MARKDOWN(file),
|
|
50
|
+
Optional('introduction', default = []): _RESOLVED_SECTIONS(INTRODUCTION_PATH),
|
|
51
|
+
Optional('glossary', default = []): _RESOLVED_GLOSSARY,
|
|
52
|
+
Optional('references', default = []): _REFERENCE_IDS,
|
|
53
|
+
Optional('annexes', default = []): _RESOLVED_SECTIONS(ANNEX_PATH),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
REQUIREMENT = lambda file: Map({
|
|
57
|
+
'title': Str(),
|
|
58
|
+
Optional('description', default = ""): Str(),
|
|
59
|
+
'threshold': _REQUIREMENT_PART(file),
|
|
60
|
+
"goal": _REQUIREMENT_PART(file),
|
|
61
|
+
Optional('dependencies', default = []): _REFS(REQUIREMENT_PATH, REQUIREMENT),
|
|
62
|
+
Optional('glossary', default = []): _RESOLVED_GLOSSARY,
|
|
63
|
+
Optional('references', default = []): _REFERENCE_IDS,
|
|
64
|
+
Optional('metadata', default = {}): EmptyDict(), # todo: add metadata schema
|
|
65
|
+
Optional('legacy', default = None): EmptyDict() | Map({
|
|
66
|
+
'optical': NullNone() | Str(),
|
|
67
|
+
'sar': NullNone() | Str(),
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
REQUIREMENTS = lambda file: Seq(Map({
|
|
72
|
+
'category': IdReference(REQUIREMENT_CATEGORY_PATH, SECTION),
|
|
73
|
+
'requirements': UniqueSeq(IdReference(REQUIREMENT_PATH, REQUIREMENT)),
|
|
74
|
+
}))
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from .utils.files import get_all_files, get_all_folders, FILE_CACHE
|
|
2
|
+
from .utils.pfs import read_pfs
|
|
3
|
+
from .utils.template import read_template
|
|
4
|
+
|
|
5
|
+
def log(id, error = None):
|
|
6
|
+
message = str(error) if error is not None else "OK"
|
|
7
|
+
print(f"- {id}: {message}")
|
|
8
|
+
|
|
9
|
+
def validate():
|
|
10
|
+
|
|
11
|
+
# Validate PFS template
|
|
12
|
+
print("Validating PFS template (basic checks only)")
|
|
13
|
+
error = None
|
|
14
|
+
try:
|
|
15
|
+
# todo: check more, this check is only very high-level jinja-based
|
|
16
|
+
read_template()
|
|
17
|
+
except Exception as e:
|
|
18
|
+
error = e
|
|
19
|
+
finally:
|
|
20
|
+
log("templates/template.md", error)
|
|
21
|
+
|
|
22
|
+
# Validate all PFS
|
|
23
|
+
# This also validates all files that are used/referenced in the PFS
|
|
24
|
+
print("Validating PFS")
|
|
25
|
+
all_pfs = get_all_folders("pfs")
|
|
26
|
+
for folder in all_pfs:
|
|
27
|
+
pfs = folder.stem
|
|
28
|
+
error = None
|
|
29
|
+
try:
|
|
30
|
+
read_pfs(pfs)
|
|
31
|
+
except Exception as e:
|
|
32
|
+
error = e
|
|
33
|
+
finally:
|
|
34
|
+
log(pfs, error)
|
|
35
|
+
|
|
36
|
+
# todo: check all files, even if unused
|
|
37
|
+
print("Checking for files not referenced by any PFS (none of them gets validated)")
|
|
38
|
+
# Get a list of all files that were read during PFS validation
|
|
39
|
+
used_files = list(FILE_CACHE.keys())
|
|
40
|
+
# Get all files in the glossary, requirements, and sections
|
|
41
|
+
all_files = get_all_files(["glossary", "requirements", "sections"])
|
|
42
|
+
# Print all files that are not refernced by any PFS
|
|
43
|
+
for file in all_files:
|
|
44
|
+
filepath = str(file.absolute())
|
|
45
|
+
if filepath not in used_files:
|
|
46
|
+
print(f"- {file.relative_to(".")}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: ceos-ard-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tools for CEOS-ARD
|
|
5
|
+
Home-page: https://github.com/ceos-org/ceos-ard-cli
|
|
6
|
+
Author: Matthias Mohr
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: strictyaml>=1.7.0
|
|
13
|
+
Requires-Dist: jinja2>=3.1.0
|
|
14
|
+
Requires-Dist: click>=8.0.0
|
|
15
|
+
Requires-Dist: weasyprint>=64.0
|
|
16
|
+
Requires-Dist: bibtexparser==2.0.0b8
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# CEOS-ARD CLI <!-- omit in toc -->
|
|
27
|
+
|
|
28
|
+
CLI for working with the [CEOS-ARD building blocks and PFSes](https://github.com/ceos-org/ceos-ard).
|
|
29
|
+
|
|
30
|
+
- [Getting Started](#getting-started)
|
|
31
|
+
- [Installation](#installation)
|
|
32
|
+
- [Execute a command](#execute-a-command)
|
|
33
|
+
- [Commands](#commands)
|
|
34
|
+
- [`ceos-ard compile`: Compile PFS document to a Markdown file](#ceos-ard-compile-compile-pfs-document-to-a-markdown-file)
|
|
35
|
+
- [`ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS](#ceos-ard-generate-create-wordhtmlpdf-documents-for-a-single-pfs)
|
|
36
|
+
- [`ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes](#ceos-ard-generate-all-create-wordhtmlpdf-documents-for-all-pfses)
|
|
37
|
+
- [`ceos-ard validate`: Validate CEOS-ARD components](#ceos-ard-validate-validate-ceos-ard-components)
|
|
38
|
+
- [Development](#development)
|
|
39
|
+
|
|
40
|
+
## Getting Started
|
|
41
|
+
|
|
42
|
+
In order to make working with CEOS-ARD easier we have developed command-line interface (CLI) tools.
|
|
43
|
+
|
|
44
|
+
### Installation
|
|
45
|
+
|
|
46
|
+
You will need to have **Python 3.9** or any later version installed.
|
|
47
|
+
|
|
48
|
+
For the `generate` and `generate-all` commands you also need the following software installed:
|
|
49
|
+
|
|
50
|
+
- pandoc 3.6 or later (for Word + HTML generation)
|
|
51
|
+
- pandoc-crossref (for table/image/section references)
|
|
52
|
+
- pango-view (for PDF generation)
|
|
53
|
+
|
|
54
|
+
> ![NOTE]
|
|
55
|
+
> The following command doesn't work yet as the package as not been published on pypi yet.
|
|
56
|
+
> Please continue with the [Development](#development) instructions for now.
|
|
57
|
+
|
|
58
|
+
Run `pip install ceos-ard-cli` in the CLI to install the tool.
|
|
59
|
+
|
|
60
|
+
### Execute a command
|
|
61
|
+
|
|
62
|
+
After the installation you should be able to run the following command: `ceos-ard`
|
|
63
|
+
|
|
64
|
+
You should see usage instructions and [available commands](#commands) for the CLI.
|
|
65
|
+
|
|
66
|
+
## Commands
|
|
67
|
+
|
|
68
|
+
### `ceos-ard compile`: Compile PFS document to a Markdown file
|
|
69
|
+
|
|
70
|
+
To compile a PFS document to a Markdown file, run: `ceos-ard compile SR`
|
|
71
|
+
|
|
72
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
73
|
+
|
|
74
|
+
Check `ceos-ard compile --help` for more details.
|
|
75
|
+
|
|
76
|
+
### `ceos-ard generate`: Create Word/HTML/PDF documents for a single PFS
|
|
77
|
+
|
|
78
|
+
To create the Word, HTML, and PDF versions of a single PFS, run: `ceos-ard generate SR`
|
|
79
|
+
|
|
80
|
+
The last part is the PFS to create, e.g. `SR` or `SAR-NRB`.
|
|
81
|
+
|
|
82
|
+
Check `ceos-ard generate --help` for more details.
|
|
83
|
+
|
|
84
|
+
### `ceos-ard generate-all`: Create Word/HTML/PDF documents for all PFSes
|
|
85
|
+
|
|
86
|
+
To create the Word, HTML, and PDF versions for all PFSes, run: `ceos-ard generate-all`
|
|
87
|
+
|
|
88
|
+
Check `ceos-ard generate-all --help` for more details.
|
|
89
|
+
|
|
90
|
+
### `ceos-ard validate`: Validate CEOS-ARD components
|
|
91
|
+
|
|
92
|
+
To validate (most of) the building blocks, run: `ceos-ard validate`
|
|
93
|
+
|
|
94
|
+
Check `ceos-ard validate --help` for more details.
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
1. Install the dependencies (Python, Pandoc, pandoc-crossref, pango-view) as indicated in [Installation](#installation)
|
|
99
|
+
2. Fork this repository if you plan to change the code or create pull requests.
|
|
100
|
+
3. Clone either your forked repository or this repository, e.g. `git clone https://github.com/ceos-org/ceos-ard-cli`
|
|
101
|
+
4. Switch into the newly created folder: `cd ceos-ard-cli`
|
|
102
|
+
5. Install this package in development mode: `pip install -e .`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
ceos_ard_cli/__init__.py
|
|
5
|
+
ceos_ard_cli/compile.py
|
|
6
|
+
ceos_ard_cli/generate.py
|
|
7
|
+
ceos_ard_cli/schema.py
|
|
8
|
+
ceos_ard_cli/validate.py
|
|
9
|
+
ceos_ard_cli/version.py
|
|
10
|
+
ceos_ard_cli.egg-info/PKG-INFO
|
|
11
|
+
ceos_ard_cli.egg-info/SOURCES.txt
|
|
12
|
+
ceos_ard_cli.egg-info/dependency_links.txt
|
|
13
|
+
ceos_ard_cli.egg-info/entry_points.txt
|
|
14
|
+
ceos_ard_cli.egg-info/requires.txt
|
|
15
|
+
ceos_ard_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ceos_ard_cli
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
def get_version():
|
|
6
|
+
with open('ceos_ard_cli/version.py', 'r') as file:
|
|
7
|
+
content = file.read()
|
|
8
|
+
return re.match(r'__version__\s*=\s*"([^"]+)"', content)[1]
|
|
9
|
+
|
|
10
|
+
def get_description():
|
|
11
|
+
this_directory = Path(__file__).parent
|
|
12
|
+
return (this_directory / "README.md").read_text()
|
|
13
|
+
|
|
14
|
+
setup(
|
|
15
|
+
name="ceos-ard-cli",
|
|
16
|
+
version=get_version(),
|
|
17
|
+
license="Apache-2.0",
|
|
18
|
+
description="CLI tools for CEOS-ARD",
|
|
19
|
+
long_description=get_description(),
|
|
20
|
+
long_description_content_type="text/markdown",
|
|
21
|
+
author="Matthias Mohr",
|
|
22
|
+
url="https://github.com/ceos-org/ceos-ard-cli",
|
|
23
|
+
install_requires=[
|
|
24
|
+
"strictyaml>=1.7.0",
|
|
25
|
+
"jinja2>=3.1.0",
|
|
26
|
+
"click>=8.0.0",
|
|
27
|
+
"weasyprint>=64.0",
|
|
28
|
+
"bibtexparser==2.0.0b8"
|
|
29
|
+
],
|
|
30
|
+
extras_require={},
|
|
31
|
+
packages=find_packages(),
|
|
32
|
+
package_data={
|
|
33
|
+
"ceos_ard_cli": []
|
|
34
|
+
},
|
|
35
|
+
entry_points={
|
|
36
|
+
"console_scripts": [
|
|
37
|
+
"ceos-ard=ceos_ard_cli:cli"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
classifiers=[
|
|
41
|
+
'Development Status :: 4 - Beta',
|
|
42
|
+
'Programming Language :: Python :: 3',
|
|
43
|
+
],
|
|
44
|
+
)
|