Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 12c6433

Browse files
Support for OpenSSF Best Practices Badge (#40)
2 parents e83f083 + d1e7c0e commit 12c6433

File tree

9 files changed

+167
-51
lines changed

9 files changed

+167
-51
lines changed

.github/workflows/standard.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# ----------------------------------------------------------------------
2626
action_contexts:
2727
name: "Display GitHub Action Contexts"
28-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_display_action_contexts.yaml@CI-v0.19.0
28+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_display_action_contexts.yaml@CI-v0.20.0
2929

3030
# ----------------------------------------------------------------------
3131
validate:
@@ -50,7 +50,7 @@ jobs:
5050
permissions:
5151
contents: read
5252

53-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python.yaml@CI-v0.19.0
53+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python.yaml@CI-v0.20.0
5454
with:
5555
operating_system: ${{ matrix.os }}
5656
python_version: ${{ matrix.python_version }}
@@ -64,7 +64,7 @@ jobs:
6464
permissions:
6565
contents: read
6666

67-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_package_python_coverage.yaml@CI-v0.19.0
67+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_package_python_coverage.yaml@CI-v0.20.0
6868
with:
6969
gist_id: 2f9d770d13e3a148424f374f74d41f4b
7070
gist_filename: PythonProjectBootstrapper_coverage.json
@@ -96,7 +96,7 @@ jobs:
9696
permissions:
9797
contents: read
9898

99-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_package.yaml@CI-v0.19.0
99+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_package.yaml@CI-v0.20.0
100100
with:
101101
operating_system: ${{ matrix.os }}
102102
python_version: ${{ matrix.python_version }}
@@ -126,7 +126,7 @@ jobs:
126126
permissions:
127127
contents: read
128128

129-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_package.yaml@CI-v0.19.0
129+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_package.yaml@CI-v0.20.0
130130
with:
131131
operating_system: ${{ matrix.os }}
132132
python_version: ${{ matrix.python_version }}
@@ -153,7 +153,7 @@ jobs:
153153
permissions:
154154
contents: read
155155

156-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_binary.yaml@CI-v0.19.0
156+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_binary.yaml@CI-v0.20.0
157157
with:
158158
operating_system: ${{ matrix.os }}
159159
python_version: ${{ matrix.python_version }}
@@ -179,7 +179,7 @@ jobs:
179179
permissions:
180180
contents: read
181181

182-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_binary.yaml@CI-v0.19.0
182+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_binary.yaml@CI-v0.20.0
183183
with:
184184
operating_system: ${{ matrix.os }}
185185
python_version: ${{ matrix.python_version }}
@@ -196,7 +196,7 @@ jobs:
196196
permissions:
197197
contents: write
198198

199-
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_publish_python.yaml@CI-v0.19.0
199+
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_publish_python.yaml@CI-v0.20.0
200200
with:
201201
release_sources_configuration_filename: .github/release_sources.yaml
202202
secrets:

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ Tool that helps in the creation of python projects.
3030
- Python [wheel](https://pythonwheels.com/) creation
3131
- Wheel deployment to [PyPi](https://pypi.org)
3232
- Executable generation via [cx_Freeze](https://marcelotduarte.github.io/cx_Freeze/)
33-
- Optional generation of development environment [docker](https://www.docker.com/) [images](https://aws.amazon.com/compare/the-difference-between-docker-images-and-containers/) in support of [FAIR principles](https://www.go-fair.org/fair-principles/)
3433
- Full [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration), [Continuous Delivery](https://en.wikipedia.org/wiki/Continuous_delivery), and [Continuous Deployment](https://en.wikipedia.org/wiki/Continuous_deployment) (via [GitHub Actions](https://github.com/features/actions)) for everything listed above
34+
- [Optional] Build artifact signing via [Minisign](https://jedisct1.github.io/minisign/)
35+
- [Optional] Participation in the [Open Source Security Foundation (OpenSSF) Best Practices Badge Program](https://www.bestpractices.dev/)
36+
- [Optional] Generation of development environment [docker](https://www.docker.com/) [images](https://aws.amazon.com/compare/the-difference-between-docker-images-and-containers/) in support of [FAIR principles](https://www.go-fair.org/fair-principles/)
3537

3638
#### Project Content Customization
3739

@@ -162,6 +164,8 @@ There are other tools available that offer similar functionality, each emphasizi
162164

163165
### Templating Systems
164166

167+
PythonProjectBootstrapper uses cookiecutter as its underlying templating engine, but others are available within python. Some are listed here if you want to use them directly.
168+
165169
| Tool | Description |
166170
| --- | --- |
167171
| [cookiecutter](https://github.com/cookiecutter/cookiecutter) | A cross-platform command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, C projects. |

src/PythonProjectBootstrapper/EntryPoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _VersionCallback(value: bool) -> None:
9696
)
9797

9898
_configuration_filename_option = typer.Option(
99-
"--configuration-filename",
99+
"--configuration",
100100
dir_okay=False,
101101
exists=True,
102102
resolve_path=True,

src/PythonProjectBootstrapper/ProjectGenerationUtils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ def DisplayPrompt(output_dir: Path, prompts: list[tuple[str, str]]) -> None:
363363
["yellow", "blue", "magenta", "cyan", "green"],
364364
)
365365

366-
# ----------------------------------------------------------------------
367366
# Print out saved prompts
368367
for prompt_index, (title, prompt) in enumerate(prompts):
369368
print(

src/PythonProjectBootstrapper/package/cookiecutter.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"gist_username": "{{ cookiecutter.github_username }}",
2222

2323
"sign_binaries": true,
24+
"openssf_best_practices_badge_id": "__openssf_badge_id__",
2425
"create_docker_image": false,
2526

2627
"__empty_dir": "",
@@ -31,15 +32,16 @@
3132
"name": "\n\nPlease enter your name.\n\nThis value will be used in:\n - The copyright header for source files\n - Metadata for the generated python package\n - Metadata for the generated python binary\n\n",
3233
"email": "\n\nPlease enter your email address.\n\nThis value will be used in:\n - Metadata for the generated python package\n - Metadata for the generated python binary\n\n",
3334
"project_description": "\n\nPlease enter a short description of your project (less than 100 characters).\n\nThis value will be used in:\n - Metadata for the generated python package\n - Metadata for the generated python binary\n\n",
34-
"license": "\n\nPlease enter the license you would like to use for your project. https://choosealicense.com/ is a\ngood resource that helps you choose the best license for your project.\n\nThis value will be used in:\n - Population of the License.txt file (or equivalent)\n - The copyright header for source files\n - Metadata for the generated python package\n - Metadata for the generated python binary\n - Metadata for the generated docker image (if applicable)\n\n",
35-
"github_url": "\n\nPlease enter the GitHub URL. You should use the URL to your GitHub repository as a guide when\nspecifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^^^^^^^^^^^\n This is the GitHub URL\n\n",
36-
"github_username": "\n\nPlease enter your GitHub username. You should use the URL to your GitHub repository as a guide when\nspecifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^\n This is the GitHub username\n\n",
37-
"github_project_name": "\n\nPlease enter your GitHub project name. You should use the URL to your GitHub repository as a guide\nwhen specifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^^^^\n This is the GitHub project name\n\n",
38-
"pypi_project_name": "\n\nPlease enter the name of your project as it will appear on PyPI (https://pypi.org). This\nname cannot be associated with any other project on PyPI.\n\n",
39-
"gist_id": "\n\nPlease enter the GitHub gist id for use with this project.\n\nGitHub defines a gist as \"a simple way to share snippets and pastes with others.\" The generated\npython project will use a gist to store information dynamically generated during the build (for\nexample code coverage information) that can be retrieved at a later time (for example, to display\na code coverage badge in the project's README.md file).\n\nTo create a gist:\n 1. Go to https://gist.github.com/\n 2. Enter the following values in their respective fields:\n\n Gist description...: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n Filename including extension...: README.md\n File contents: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n\n 3. Click the \"Create secret gist\" button\n 4. Copy the gist id (this will be the hex string at the end of the url associated with the gist\n that was just created). It will look something like:\n\n https://gist.github.com/<github username>/4c10281ff1abc26cafcb9a5f9a8a443e\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n This is the gist id\n\n",
35+
"license": "\n\nPlease enter the license you would like to use for your project. https://choosealicense.com/ is a good resource that helps you choose the best license for your project.\n\nThis value will be used in:\n - Population of the License.txt file (or equivalent)\n - The copyright header for source files\n - Metadata for the generated python package\n - Metadata for the generated python binary\n - Metadata for the generated docker image (if applicable)\n\n",
36+
"github_url": "\n\nPlease enter the GitHub URL. You should use the URL to your GitHub repository as a guide when specifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^^^^^^^^^^^\n This is the GitHub URL\n\n",
37+
"github_username": "\n\nPlease enter your GitHub username. You should use the URL to your GitHub repository as a guide when specifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^\n This is the GitHub username\n\n",
38+
"github_project_name": "\n\nPlease enter your GitHub project name. You should use the URL to your GitHub repository as a guide when specifying this value.\n\n https://github.com/username/projectname\n ^^^^^^^^^^^\n This is the GitHub project name\n\n",
39+
"pypi_project_name": "\n\nPlease enter the name of your project as it will appear on PyPI (https://pypi.org). This name cannot be associated with any other project on PyPI.\n\n",
40+
"gist_id": "\n\nPlease enter the GitHub gist id for use with this project.\n\nGitHub defines a gist as \"a simple way to share snippets and pastes with others.\" The generated python project will use a gist to store information dynamically generated during the build (for example code coverage information) that can be retrieved at a later time (for example, to display a code coverage badge in the project's README.md file). To create a gist:\n 1. Go to https://gist.github.com/\n 2. Enter the following values in their respective fields:\n\n Gist description...: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n Filename including extension...: README.md\n File contents: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n\n 3. Click the \"Create secret gist\" button\n 4. Copy the gist id (this will be the hex string at the end of the url associated with the gist\n that was just created). It will look something like:\n\n https://gist.github.com/<github username>/4c10281ff1abc26cafcb9a5f9a8a443e\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n This is the gist id\n\n",
4041
"gist_username": "\n\nPlease enter the username associated with your gist_id. In most cases, this will be the same as your GitHub username.\n\n",
41-
"sign_binaries": "\n\nWould you like the GitHub Action workflows to sign binaries produced by the project?\n\nA signed binary can be validated against its signature to ensure that changes have not been made\nto it after it was created. This is especially useful when distributing software to others and is\nhighly recommended.\n\n",
42-
"create_docker_image": "\n\nWould you like the GitHub Action workflows to create docker images of the development environment?\nThese images can be used to produce exact results across different commits made to the repository\nover time (which is especially valuable when writing scientific software).\n\n"
42+
"sign_binaries": "\n\nWould you like the GitHub Action workflows to sign binaries produced by the project?\n\nA signed binary can be validated against its signature to ensure that changes have not been made to it after it was created. This is especially useful when distributing software to others and is highly recommended.\n\n",
43+
"openssf_best_practices_badge_id": "\n\nEnter the OpenSSF Best Practices Badge ID to display in your README.md file. Keep this default value if you do not have an OpenSSF Best Practices Badge ID but would like to create one (this is highly recommended). Enter the value 'none' if you do not want to display this badge in your README.md file.\n\nThe Open Source Security Foundation (OpenSSF) Best Practices badge is a way for Free/Libre and Open Source Software (FLOSS) projects to show that they follow best practices. Additional information is available at https://www.bestpractices.dev/.\n\nThis script will automatically generate scaffolding to achieve a 63% score. Completing your project's documentation and following development best practices will raise your score to 100%. Participation in the OpenSSF Best Practices Badge program is highly recommended.\n\n",
44+
"create_docker_image": "\n\nWould you like the GitHub Action workflows to create docker images of the development environment? These images can be used to produce exact results across different commits made to the repository over time (which is especially valuable when writing scientific software).\n\n"
4345
},
4446

4547
"_extensions": [

src/PythonProjectBootstrapper/package/cookiecutter_prompts.yaml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ project_description: |-
2323
- Metadata for the generated python binary
2424
2525
license: |-
26-
Please enter the license you would like to use for your project. https://choosealicense.com/ is a
27-
good resource that helps you choose the best license for your project.
26+
Please enter the license you would like to use for your project. https://choosealicense.com/ is a good resource that helps you choose the best license for your project.
2827
2928
This value will be used in:
3029
- Population of the License.txt file (or equivalent)
@@ -34,42 +33,33 @@ license: |-
3433
- Metadata for the generated docker image (if applicable)
3534
3635
github_url: |-
37-
Please enter the GitHub URL. You should use the URL to your GitHub repository as a guide when
38-
specifying this value.
36+
Please enter the GitHub URL. You should use the URL to your GitHub repository as a guide when specifying this value.
3937
4038
https://github.com/username/projectname
4139
^^^^^^^^^^^^^^^^^^
4240
This is the GitHub URL
4341
4442
github_username: |-
45-
Please enter your GitHub username. You should use the URL to your GitHub repository as a guide when
46-
specifying this value.
43+
Please enter your GitHub username. You should use the URL to your GitHub repository as a guide when specifying this value.
4744
4845
https://github.com/username/projectname
4946
^^^^^^^^
5047
This is the GitHub username
5148
5249
github_project_name: |-
53-
Please enter your GitHub project name. You should use the URL to your GitHub repository as a guide
54-
when specifying this value.
50+
Please enter your GitHub project name. You should use the URL to your GitHub repository as a guide when specifying this value.
5551
5652
https://github.com/username/projectname
5753
^^^^^^^^^^^
5854
This is the GitHub project name
5955
6056
pypi_project_name: |-
61-
Please enter the name of your project as it will appear on PyPI (https://pypi.org). This
62-
name cannot be associated with any other project on PyPI.
57+
Please enter the name of your project as it will appear on PyPI (https://pypi.org). This name cannot be associated with any other project on PyPI.
6358
6459
gist_id: |-
6560
Please enter the GitHub gist id for use with this project.
6661
67-
GitHub defines a gist as "a simple way to share snippets and pastes with others." The generated
68-
python project will use a gist to store information dynamically generated during the build (for
69-
example code coverage information) that can be retrieved at a later time (for example, to display
70-
a code coverage badge in the project's README.md file).
71-
72-
To create a gist:
62+
GitHub defines a gist as "a simple way to share snippets and pastes with others." The generated python project will use a gist to store information dynamically generated during the build (for example code coverage information) that can be retrieved at a later time (for example, to display a code coverage badge in the project's README.md file). To create a gist:
7363
1. Go to https://gist.github.com/
7464
2. Enter the following values in their respective fields:
7565
@@ -91,11 +81,14 @@ gist_username: |-
9181
sign_binaries: |-
9282
Would you like the GitHub Action workflows to sign binaries produced by the project?
9383
94-
A signed binary can be validated against its signature to ensure that changes have not been made
95-
to it after it was created. This is especially useful when distributing software to others and is
96-
highly recommended.
84+
A signed binary can be validated against its signature to ensure that changes have not been made to it after it was created. This is especially useful when distributing software to others and is highly recommended.
85+
86+
openssf_best_practices_badge_id: |-
87+
Enter the OpenSSF Best Practices Badge ID to display in your README.md file. Keep this default value if you do not have an OpenSSF Best Practices Badge ID but would like to create one (this is highly recommended). Enter the value 'none' if you do not want to display this badge in your README.md file.
88+
89+
The Open Source Security Foundation (OpenSSF) Best Practices badge is a way for Free/Libre and Open Source Software (FLOSS) projects to show that they follow best practices. Additional information is available at https://www.bestpractices.dev/.
90+
91+
This script will automatically generate scaffolding to achieve a 63% score. Completing your project's documentation and following development best practices will raise your score to 100%. Participation in the OpenSSF Best Practices Badge program is highly recommended.
9792
9893
create_docker_image: |-
99-
Would you like the GitHub Action workflows to create docker images of the development environment?
100-
These images can be used to produce exact results across different commits made to the repository
101-
over time (which is especially valuable when writing scientific software).
94+
Would you like the GitHub Action workflows to create docker images of the development environment? These images can be used to produce exact results across different commits made to the repository over time (which is especially valuable when writing scientific software).

0 commit comments

Comments
 (0)