Skip to content

Commit 4890ed7

Browse files
Update README.md to describe JSON/YAML/XML capabilities.
Signed-off-by: Xavier Figueroa <[email protected]>
1 parent 7be4ce0 commit 4890ed7

File tree

2 files changed

+55
-370
lines changed

2 files changed

+55
-370
lines changed

README.md

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
# Python SPDX Library to parse, validate and create SPDX documents [GSoC2019 adding support task]
1+
# Python SPDX Library to parse, validate and create SPDX documents
32

43
| Linux | macOS | Windows |
54
| :---- | :------ | :---- |
@@ -16,51 +15,77 @@ This library implements an SPDX tag/value and RDF parser, validator and handler
1615
This is the result of an initial GSoC contribution by @[ah450](https://github.com/ah450) (or https://github.com/a-h-i) and
1716
is maintained by a community of SPDX adopters and enthusiasts.
1817

19-
# What's new? [GSoC 2019]
18+
Home: https://github.com/spdx/tools-python
19+
20+
Issues: https://github.com/spdx/tools-python/issues
21+
22+
Pypi: https://pypi.python.org/pypi/spdx-tools
2023

21-
As a requirement for being eligible as a GSoC student, JSON format support was added to this project.
22-
Currently, this support include writing and parsing **^[new]^** capabilities.
23-
Additionally, not only JSON writing capabilities were added, but also YAML.
2424

2525
# License
2626

2727
[Apache-2.0](LICENSE)
2828

2929

30-
# How to use [GSoC 2019]
30+
# Features
31+
32+
* API to create and manipulate SPDX documents.
33+
* Parse and create Tag/Value, RDF, JSON, YAML, XML format SPDX files
34+
35+
36+
# TODOs
37+
38+
* Update to full SPDX v2.1
39+
* Add to full license expression support
40+
41+
42+
# How to use
3143

32-
The `examples` directory contains several **new** code samples:
33-
To test writing capabilities:
34-
* `rdf_to_json.py` demonstrates how to convert an RDF file to a JSON one.
35-
To test it, run `python rdf_to_json.py ../data/SPDXRdfExample.rdf`
44+
Example tag/value parsing usage:
45+
```Python
46+
from spdx.parsers.tagvalue import Parser
47+
from spdx.parsers.tagvaluebuilders import Builder
48+
from spdx.parsers.loggers import StandardLogger
49+
p = Parser(Builder(), StandardLogger())
50+
p.build()
51+
# data is a string containing the SPDX file.
52+
document, error = p.parse(data)
3653

37-
* `rdf_to_yaml.py` demonstrates how to convert an RDF file to a YAML one.
38-
To test it, run `python rdf_to_yaml.py ../data/SPDXRdfExample.rdf`
39-
40-
* `tv_to_json.py` demonstrates how to convert a tag/value file to a JSON one.
41-
To test it, run `python tv_to_json.py ../data/SPDXSimpleTag.tag`
42-
43-
* `tv_to_yaml.py` demonstrates how to convert a tag/value file to a YAML one.
44-
To test it, run `python tv_to_yaml.py ../data/SPDXSimpleTag.tag`
54+
```
55+
56+
The `examples` directory contains several code samples. Here some of them:
4557

4658
* `parse_tv.py` is an example tag/value parsing usage.
4759
Try running `python parse_tv.py ../data/SPDXSimpleTag.tag `
4860

49-
To test parsing capabilities **^[new]^**:
50-
* `parse_json.py` is an example of JSON parsing usage.
51-
To test it, run `python parse_json.py ../data/SPDXJsonExample.json`
61+
* `write_tv.py` provides an example of writing tag/value files.
62+
Run `python write_tv.py sample.tag` to test it.
63+
64+
* `pp_tv.py` demonstrates how to pretty-print a tag/value file.
65+
To test it run `python pp_tv.py ../data/SPDXTagExample.tag pretty.tag`.
5266

53-
* `parse_yaml.py` is an example of YAML parsing usage.
54-
To test it, run `python parse_yaml.py ../data/SPDXYamlExample.yaml`
67+
* `parse_rdf.py` demonstrates how to parse an RDF file and print out document
68+
information. To test it run `python parse_rdf.py ../data/SPDXRdfExample.rdf`
5569

56-
# Known issues [GSoC 2019]
70+
* `rdf_to_tv.py` demonstrates how to convert an RDF file to a tag/value one.
71+
To test it run `python rdf_to_tv.py ../data/SPDXRdfExample.rdf converted.tag`
72+
73+
* `pp_rdf.py` demonstrates how to pretty-print an RDF file, to test it run
74+
`python pp_rdf.py ../data/SPDXRdfExample.rdf pretty.rdf`
5775

58-
* Some string values in YAML files are not quoted and some others are. This issue may be solved by changing the way python strings are stored in python dictionaries (which are then dumped by `ruamel.yaml`). Current `tools-python` issues complicate a little bit this change. See [#91](https://github.com/spdx/tools-python/issues/91).
5976

6077
# Installation
6178

6279
Clone or download the repository and run `python setup.py install`. (In a virtualenv, of course)
6380

81+
or install from Pypi with `pip install spdx-tools`
82+
83+
84+
# How to run tests
85+
86+
From the project root directory run: `python setup.py test`.
87+
You can use another test runner such as pytest or nose at your preference.
88+
6489

6590
# Development process
6691

@@ -93,8 +118,10 @@ If there is no issue for the changes that you want to make, create first an issu
93118
# Dependencies
94119
95120
* PLY : https://pypi.python.org/pypi/ply/ used for parsing.
96-
* rdflib : https://pypi.python.org/pypi/rdflib/ for for handling RDF.
97-
* ruamel.yaml : https://pypi.org/project/ruamel.yaml/ for handling YAML. **^[new]^**
121+
* rdflib : https://pypi.python.org/pypi/rdflib/ for handling RDF.
122+
* PyYAML: https://pypi.org/project/PyYAML/ for handling YAML.
123+
* xmltodict: https://pypi.org/project/xmltodict/ for handling XML.
124+
98125
99126
# Support
100127

0 commit comments

Comments
 (0)