|
| 1 | +# Contributing to PyLD |
| 2 | + |
| 3 | +Want to contribute to PyLD? Great! Here are a few notes: |
| 4 | + |
| 5 | +## Code |
| 6 | + |
| 7 | +* In general, follow the common [PEP 8 Style Guide](https://www.python.org/dev/peps/pep-0008/). |
| 8 | +* Try to make the code pass [ruff](https://docs.astral.sh/ruff/) checks. |
| 9 | + |
| 10 | + * `make lint` or `ruff check lib/pyld/*` |
| 11 | + * You can also apply automatic fixing and formatting |
| 12 | + using `make fmt` |
| 13 | + |
| 14 | +* Use version `X.Y.Z-dev` in dev mode. |
| 15 | +* Use version `X.Y.Z` for releases. |
| 16 | + |
| 17 | +## Documentation |
| 18 | + |
| 19 | +The public documentation site is built with MkDocs Material. |
| 20 | + |
| 21 | +* Install documentation dependencies: |
| 22 | + |
| 23 | + * `pip install -r docs/requirements.txt` |
| 24 | + |
| 25 | +* Preview documentation locally: |
| 26 | + |
| 27 | + * `mkdocs serve` |
| 28 | + |
| 29 | +* Check documentation before submitting changes: |
| 30 | + |
| 31 | + * `mkdocs build --strict` |
| 32 | + |
| 33 | +* Refresh bundled JSON-LD context files: |
| 34 | + |
| 35 | + * `make download-bundled-contexts` |
| 36 | + |
| 37 | +## Versioning |
| 38 | + |
| 39 | +* Follow the [Semantic Versioning](https://semver.org/) guidelines. |
| 40 | + |
| 41 | +## Release Process |
| 42 | + |
| 43 | +* `$EDITOR CHANGELOG.md`: update CHANGELOG with new notes, version, and date. |
| 44 | +* commit changes |
| 45 | +* `$EDITOR lib/pyld/__about__.py`: update to release version and remove `-dev` suffix. |
| 46 | +* `git commit CHANGELOG.md lib/pyld/__about__.py -m "Release {version}."` |
| 47 | +* `git tag {version}` |
| 48 | +* `$EDITOR lib/pyld/__about__.py`: update to next version and add `-dev` suffix. |
| 49 | +* `git commit lib/pyld/__about__.py -m "Start {next-version}."` |
| 50 | +* `git push --tags` |
| 51 | + |
| 52 | +To ensure a clean [package](https://pypi.org/project/PyLD/) upload to [PyPI](https://pypi.org/), |
| 53 | +use a clean checkout, and run the following: |
| 54 | + |
| 55 | +* For more info, look at the packaging |
| 56 | + [guide](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/). |
| 57 | +* Setup an [API token](https://pypi.org/help/#apitoken). Recommend using a |
| 58 | + specific "PyLD" token and set it up as a "repository" in your |
| 59 | + [`~/.pypirc`](https://packaging.python.org/en/latest/specifications/pypirc/) |
| 60 | + for use in the upload command. |
| 61 | +* The below builds and uploads a sdist and wheel. Adjust as needed depending |
| 62 | + on how you manage and clean "dist/" dir files. |
| 63 | +* `git checkout {version}` |
| 64 | +* `python3 -m build` |
| 65 | +* `twine check dist/*` |
| 66 | +* `twine upload -r PyLD dist/*` |
| 67 | + |
| 68 | +## Implementation Report Process |
| 69 | + |
| 70 | +As of early 2020, the process to generate an EARL report for the official |
| 71 | +[JSON-LD Processor Conformance](https://w3c.github.io/json-ld-api/reports/) page is: |
| 72 | + |
| 73 | +* Run the tests on the `json-ld-api` and `json-ld-framing` test repos to |
| 74 | + generate a `.jsonld` test report as explained in [README.md](./README.md#tests) |
| 75 | +* Use the [rdf](https://rubygems.org/gems/rdf) tool to generate a `.ttl`: |
| 76 | + |
| 77 | + * `rdf serialize pyld-earl.jsonld --output-format turtle -o pyld-earl.ttl` |
| 78 | + |
| 79 | +* Optionally follow the [report instructions](https://github.com/w3c/json-ld-api/tree/master/reports) to generate the HTML report for inspection. |
| 80 | +* Submit a PR to the [json-ld-api repository](https://github.com/w3c/json-ld-api/pulls) with at least the `.ttl`. |
| 81 | + |
| 82 | +.. _JSON-LD Processor Conformance: https://w3c.github.io/json-ld-api/reports/ |
| 83 | +.. _PEP 8 Style Guide: https://www.python.org/dev/peps/pep-0008/ |
| 84 | +.. _Semantic Versioning: https://semver.org/ |
| 85 | +.. _ruff: https://docs.astral.sh/ruff/ |
| 86 | +.. _json-ld-api repository: https://github.com/w3c/json-ld-api/pulls |
| 87 | +.. _rdf: https://rubygems.org/gems/rdf |
| 88 | +.. _report instructions: https://github.com/w3c/json-ld-api/tree/master/reports |
| 89 | +.. _PyPI: https://pypi.org/ |
0 commit comments