Skip to content

Commit 0fd62c5

Browse files
README: fill in details (#43)
* README: fill in details * README: add CI badge * ci, Makefile: enforce `--help` timeliness * workflows/ci: fix syntax * CONTRIBUTING: add * README: link to CONTRIBUTING * README: flatten, tweak * setup: move sigstore to alpha * Update README.md Co-authored-by: Alex Cameron <[email protected]>
1 parent 6937fa1 commit 0fd62c5

File tree

5 files changed

+268
-27
lines changed

5 files changed

+268
-27
lines changed

.github/workflows/ci.yml

+44-23
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
run: make dev
2828
- name: test
2929
run: make test
30+
3031
lint:
3132
runs-on: ubuntu-latest
3233
steps:
@@ -37,26 +38,46 @@ jobs:
3738
- name: lint
3839
run: make lint
3940

40-
# TODO: Enable once CLI development begins.
41-
# check-readme:
42-
# runs-on: ubuntu-latest
43-
# steps:
44-
# - uses: actions/checkout@v2
45-
# - uses: actions/setup-python@v2
46-
# # NOTE(ww): Important: use pip-audit's minimum supported Python version
47-
# # in this check, since Python can change the `--help` rendering in
48-
# # `argparse` between major versions.
49-
# with:
50-
# python-version: "3.6"
51-
# - name: deps
52-
# run: make dev
53-
# - name: check-readme
54-
# run: |
55-
# diff \
56-
# <( \
57-
# awk '/@begin-pip-audit-help@/{f=1;next} /@end-pip-audit-help@/{f=0} f' \
58-
# < README.md | sed '1d;$d' \
59-
# ) \
60-
# <( \
61-
# make run ARGS="--help" \
62-
# )
41+
check-readme:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- uses: actions/setup-python@v2
46+
# NOTE(ww): Important: use pip-audit's minimum supported Python version
47+
# in this check, since Python can change the `--help` rendering in
48+
# `argparse` between major versions.
49+
with:
50+
python-version: "3.7"
51+
- name: deps
52+
run: make dev
53+
- name: check-readme
54+
run: |
55+
# sigstore --help
56+
diff \
57+
<( \
58+
awk '/@begin-sigstore-help@/{f=1;next} /@end-sigstore-help@/{f=0} f' \
59+
< README.md | sed '1d;$d' \
60+
) \
61+
<( \
62+
make run ARGS="--help" \
63+
)
64+
65+
# sigstore sign --help
66+
diff \
67+
<( \
68+
awk '/@begin-sigstore-sign-help@/{f=1;next} /@end-sigstore-sign-help@/{f=0} f' \
69+
< README.md | sed '1d;$d' \
70+
) \
71+
<( \
72+
make run ARGS="sign --help" \
73+
)
74+
75+
# sigstore verify --help
76+
diff \
77+
<( \
78+
awk '/@begin-sigstore-verify-help@/{f=1;next} /@end-sigstore-verify-help@/{f=0} f' \
79+
< README.md | sed '1d;$d' \
80+
) \
81+
<( \
82+
make run ARGS="verify --help" \
83+
)

CONTRIBUTING.md

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
Contributing to sigstore
2+
========================
3+
4+
Thank you for your interest in contributing to `sigstore`!
5+
6+
The information below will help you set up a local development environment,
7+
as well as performing common development tasks.
8+
9+
## Requirements
10+
11+
`sigstore`'s only development environment requirement *should* be Python 3.7
12+
or newer. Development and testing is actively performed on macOS and Linux,
13+
but Windows and other supported platforms that are supported by Python
14+
should also work.
15+
16+
If you're on a system that has GNU Make, you can use the convenience targets
17+
included in the `Makefile` that comes in the `sigstore` repository detailed
18+
below. But this isn't required; all steps can be done without Make.
19+
20+
## Development steps
21+
22+
First, clone this repository:
23+
24+
```bash
25+
git clone https://github.com/trailofbits/sigstore
26+
cd sigstore
27+
```
28+
29+
Then, use one of the `Makefile` targets to run a task. The first time this is
30+
run, this will also set up the local development virtual environment, and will
31+
install `sigstore` as an editable package into this environment.
32+
33+
Any changes you make to the `sigstore` source tree will take effect
34+
immediately in the virtual environment.
35+
36+
### Linting
37+
38+
You can lint locally with:
39+
40+
```bash
41+
make lint
42+
```
43+
44+
`sigstore` is automatically linted and formatted with a collection of tools:
45+
46+
* [`black`](https://github.com/psf/black): Code formatting
47+
* [`isort`](https://github.com/PyCQA/isort): Import sorting, ordering
48+
* [`flake8`](https://flake8.pycqa.org/en/latest/): PEP-8 linting, style enforcement
49+
* [`mypy`](https://mypy.readthedocs.io/en/stable/): Static type checking
50+
* [`interrogate`](https://interrogate.readthedocs.io/en/latest/): Documentation coverage
51+
52+
53+
### Testing
54+
55+
You can run the tests locally with:
56+
57+
```bash
58+
make test
59+
```
60+
61+
You can also filter by a pattern (uses `pytest -k`):
62+
63+
```bash
64+
make test TESTS=test_version
65+
```
66+
67+
To test a specific file:
68+
69+
```bash
70+
make test T=path/to/file.py
71+
```
72+
73+
`sigstore` has a [`pytest`](https://docs.pytest.org/)-based unit test suite,
74+
including code coverage with [`coverage.py`](https://coverage.readthedocs.io/).
75+
76+
### Documentation
77+
78+
If you're running Python 3.7 or newer, you can run the documentation build locally:
79+
80+
```bash
81+
make doc
82+
```
83+
84+
`sigstore` uses [`pdoc3`](https://github.com/pdoc3/pdoc) to generate HTML documentation for
85+
the public Python APIs.
86+
87+
Live documentation for the `main` branch is hosted
88+
[here](https://trailofbits.github.io/sigstore/). Only the public APIs are
89+
documented, all undocumented APIs are **intentionally private and unstable.**
90+
91+
### Releasing
92+
93+
**NOTE**: If you're a non-maintaining contributor, you don't need the steps
94+
here! They're documented for completeness and for onboarding future maintainers.
95+
96+
Releases of `sigstore` are managed with [`bump`](https://github.com/di/bump)
97+
and GitHub Actions.
98+
99+
```bash
100+
# default release (patch bump)
101+
make release
102+
103+
# override the default
104+
# vX.Y.Z -> vX.Y.Z-rc.0
105+
make release BUMP_ARGS="--pre rc.0"
106+
107+
# vX.Y.Z -> vN.0.0
108+
make release BUMP_ARGS="--major"
109+
```
110+
111+
`make release` will fail if there are any untracked changes in the source tree.
112+
113+
If `make release` succeeds, you'll see an output like this:
114+
115+
```
116+
RUN ME MANUALLY: git push origin main && git push origin vX.Y.Z
117+
```
118+
119+
Run that last command sequence to complete the release.
120+
121+
## Development practices
122+
123+
Here are some guidelines to follow if you're working on a new feature or changes to
124+
`sigstore`'s internal APIs:
125+
126+
* *Keep the `sigstore` APIs as private as possible*. Nearly all of `sigstore`'s
127+
APIs should be private and treated as unstable and unsuitable for public use.
128+
If you're adding a new module to the source tree, prefix the filename with an underscore to
129+
emphasize that it's an internal (e.g., `sigstore/_foo.py` instead of `sigstore/foo.py`).
130+
131+
* *Perform judicious debug logging.* `sigstore` uses the standard Python
132+
[`logging`](https://docs.python.org/3/library/logging.html) module. Use
133+
`logger.debug` early and often -- users who experience errors can submit better
134+
bug reports when their debug logs include helpful context!
135+
136+
* *Update the [CHANGELOG](./CHANGELOG.md)*. If your changes are public or result
137+
in changes to `sigstore`'s CLI, please record them under the "Unreleased" section,
138+
with an entry in an appropriate subsection ("Added", "Changed", "Removed", or "Fixed").

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dev:
3737

3838
.PHONY: run
3939
run:
40-
@. env/bin/activate && pip-audit $(ARGS)
40+
@. env/bin/activate && sigstore $(ARGS)
4141

4242
.PHONY: lint
4343
lint:

README.md

+84-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,91 @@
11
sigstore-python
22
===============
33

4-
⚠️ This project is not ready for use! ⚠️
4+
<!--- @begin-badges@ --->
5+
![CI](https://github.com/trailofbits/sigstore-python/workflows/CI/badge.svg)
6+
<!--- @end-badges@ --->
57

6-
`sigstore` is a tool for signing Python package distributions.
8+
⚠️ This project is not ready for general-purpose use! ⚠️
9+
10+
`sigstore` is a tool for signing and verifying Python package distributions.
711

812
This project is developed by [Trail of Bits](https://www.trailofbits.com/) with
913
support from Google. This is not an official Google product.
14+
15+
## Features
16+
17+
* Support for signing Python package distributions using an OpenID Connect identity
18+
* Support for publishing signatures to a [Rekor](https://github.com/sigstore/rekor) instance
19+
* Support for verifying signatures on Python package distributions
20+
21+
## Installation
22+
23+
`sigstore` requires Python 3.7 or newer, and can be installed directly via `pip`:
24+
25+
```console
26+
python -m pip install sigstore
27+
```
28+
29+
## Usage
30+
31+
You can run `sigstore` as a standalone program, or via `python -m`:
32+
33+
```console
34+
sigstore --help
35+
python -m sigstore --help
36+
```
37+
38+
Top-level:
39+
40+
<!-- @begin-sigstore-help@ -->
41+
```
42+
Usage: sigstore [OPTIONS] COMMAND [ARGS]...
43+
44+
Options:
45+
--help Show this message and exit.
46+
47+
Commands:
48+
sign
49+
verify
50+
```
51+
<!-- @end-sigstore-help@ -->
52+
53+
Signing:
54+
55+
<!-- @begin-sigstore-sign-help@ -->
56+
```
57+
Usage: sigstore sign [OPTIONS] FILE
58+
59+
Options:
60+
--identity-token TEXT
61+
--ctfe FILENAME
62+
--help Show this message and exit.
63+
```
64+
<!-- @end-sigstore-sign-help@ -->
65+
66+
Verifying
67+
68+
<!-- @begin-sigstore-verify-help@ -->
69+
```
70+
Usage: sigstore verify [OPTIONS] FILE
71+
72+
Options:
73+
--cert FILENAME [required]
74+
--signature FILENAME [required]
75+
--cert-email TEXT
76+
--help Show this message and exit.
77+
```
78+
<!-- @end-sigstore-verify-help@ -->
79+
80+
## Licensing
81+
82+
`sigstore` is licensed under the Apache 2.0 License.
83+
84+
## Contributing
85+
86+
See [the contributing docs](CONTRIBUTING.md) for details.
87+
88+
## Code of Conduct
89+
Everyone interacting with this project is expected to follow the
90+
[PSF Code of Conduct](https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md).
91+

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"Programming Language :: Python :: 3.8",
6868
"Programming Language :: Python :: 3.9",
6969
"Programming Language :: Python :: 3.10",
70-
"Development Status :: 1 - Planning",
70+
"Development Status :: 3 - Alpha",
7171
"Intended Audience :: Developers",
7272
"Topic :: Security",
7373
"Topic :: Security :: Cryptography",

0 commit comments

Comments
 (0)