-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Meiert Grootes
authored and
Meiert Grootes
committed
Oct 25, 2024
0 parents
commit 9128c1e
Showing
36 changed files
with
1,659 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Changes here will be overwritten by Copier | ||
SelectCitation: | ||
- AddCitationFile_flag | ||
- AddCFFConvert_flag | ||
SelectCodeQualityFeatures: | ||
- AddLocalTests_flag | ||
- SelectGitHubActions_flag | ||
- AddLinting_flag | ||
- AddSonarCloud_flag | ||
- AddEditorConfig_flag | ||
SelectCommunityFeatures: | ||
- AddCodeConduct_flag | ||
- AddContributing_flag | ||
SelectDocumentationFeatures: | ||
- AddLocalDocumentation_flag | ||
- AddOnlineDocumentation_flag | ||
- AddDevDoc_flag | ||
- AddGitHubActionDocumentation_flag | ||
SelectGitHubActions: | ||
- AddGitHubActionBuild_flag | ||
- AddLinkCheck_flag | ||
SelectPublishReleaseFeatures: | ||
- SelectCitation_flag | ||
- AddChangeLog_flag | ||
- AddZenodo_flag | ||
_commit: 0.6.1 | ||
_src_path: https://github.com/nlesc/python-template.git | ||
code_of_conduct_email: [email protected] | ||
copyright_holder: Meiert W. Grootes | ||
email: [email protected] | ||
full_name: Meiert W. Grootes | ||
github_organization: SDCCA | ||
keywords: ABM, Tensor, PyTorch | ||
license: Apachev2 | ||
package_name: dgl_abm | ||
package_short_description: ABM modelling framework using networks and tensor algebra | ||
supported by the DGL library | ||
template_profile: recommended | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
# 4 space indentation | ||
[*.{py,java,r,R}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# 2 space indentation | ||
[*.{js,json,y{a,}ml,html,cwl}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{md,Rmd,rst}] | ||
trim_trailing_whitespace = false | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Python package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | ||
python-version: ['3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Python info | ||
shell: bash -e {0} | ||
run: | | ||
which python | ||
python --version | ||
- name: Upgrade pip and install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install .[dev,publishing] | ||
- name: Run unit tests | ||
run: python -m pytest -v | ||
- name: Verify that we can build the package | ||
run: python -m build | ||
lint: | ||
name: Linting build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
- name: Python info | ||
shell: bash -e {0} | ||
run: | | ||
which python | ||
python --version | ||
- name: Upgrade pip and install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install .[dev,publishing] | ||
- name: Check style against standards using ruff | ||
run: | | ||
ruff check | ||
ruff format --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: cffconvert | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
verify: | ||
name: "cffconvert" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Check out a copy of the repository | ||
|
||
- name: Check whether the citation metadata from CITATION.cff is valid | ||
uses: citation-file-format/[email protected] | ||
with: | ||
args: "--validate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-documentation: | ||
name: Build documentation | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
- name: Python info | ||
shell: bash -e {0} | ||
run: | | ||
which python | ||
python --version | ||
- name: Upgrade pip and install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install .[dev,publishing] | ||
- name: Install pandoc using apt | ||
run: sudo apt install pandoc | ||
- name: Build documentation | ||
run: make coverage doctest html | ||
working-directory: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: link-check | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 1 * *' # first day of every month at midnight | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
|
||
jobs: | ||
linkChecker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Link Checker | ||
id: lychee | ||
uses: lycheeverse/lychee-action@v1 | ||
|
||
- name: Set Issue Title | ||
id: set_title | ||
run: echo "ISSUE_TITLE=Link Checker Report - $(date '+%Y-%m-%d')" >> $GITHUB_ENV | ||
|
||
- name: Create Issue From File | ||
if: env.lychee_exit_code != 0 | ||
uses: peter-evans/create-issue-from-file@v5 | ||
with: | ||
title: ${{ env.ISSUE_TITLE }} | ||
content-filepath: ./lychee/out.md | ||
labels: report, automated issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
on: [push] | ||
permissions: | ||
contents: write | ||
issues: write | ||
name: Create GitHub issues | ||
jobs: | ||
next_steps: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create citation data issue | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
filename: .github/workflows/next_steps_citation_issue.md | ||
id: citation | ||
- name: List created issues | ||
run: | | ||
echo "Created issues that must be completed to have fully working Python package: | ||
* Citation data ${{ steps.citation.outputs.url }}" | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps_citation_issue.md | ||
git commit -am "Cleanup automated next steps issue generator for citation" | ||
git push | ||
- name: Create linting issue | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
filename: .github/workflows/next_steps_linting_issue.md | ||
id: linting | ||
- name: List created issues | ||
run: | | ||
echo "Created issues that must be completed to have fully working Python package: | ||
* Linting fixes ${{ steps.linting.outputs.url }}" | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps_linting_issue.md | ||
git commit -am "Cleanup automated next steps issue generator" | ||
git push | ||
- name: Create online documentation issue | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
filename: .github/workflows/next_steps_online_documentation_issue.md | ||
id: readthedocs | ||
- name: List created issues | ||
run: | | ||
echo "Created issues that must be completed to have fully working Python package: | ||
* Read the Docs instructions ${{ steps.readthedocs.outputs.url }}" | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps_online_documentation_issue.md | ||
git commit -am "Cleanup automated next steps issue generator for online documentation" | ||
git push | ||
- name: Create Zenodo integration issue | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
filename: .github/workflows/next_steps_zenodo_issue.md | ||
id: zenodo | ||
- name: List created issues | ||
run: | | ||
echo "Created issues that must be completed to have fully working Python package: | ||
* Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}" | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps_zenodo_issue.md | ||
git commit -am "Cleanup automated next steps issue generator for zenodo" | ||
git push | ||
- name: Create Sonarcloud issue | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
filename: .github/workflows/next_steps_sonarcloud_issue.md | ||
id: sonarcloud | ||
- name: List created issues | ||
run: | | ||
echo "Created issues that must be completed to have fully working Python package: | ||
* Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}" | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps_sonarcloud_issue.md | ||
git commit -am "Cleanup automated next steps issue generator for sonarcloud" | ||
git push | ||
- name: Cleanup files needed to create next steps issues | ||
run: | | ||
git config --global user.name 'NLeSC Python template' | ||
git config --global user.email '[email protected]' | ||
git pull # other next step workflows may push changes before | ||
git rm .github/workflows/next_steps.yml | ||
git commit -am "Cleanup automated next steps issue generator" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: 'Next step: Citation data' | ||
--- | ||
|
||
It is likely that your `CITATION.cff` currently doesn't pass validation. The error messages you get from the [`cffconvert`](https://github.com/SDCCA/dgl_abm/actions/workflows/cffconvert.yml) GitHub Action are unfortunately a bit cryptic, but doing the following helps: | ||
|
||
- [ ] Check if the `given-name` and `family-name` keys need updating. If your family name has a name particle like `von` or `van` or `de`, use the `name-particle` key; if your name has a suffix like `Sr` or `IV`, use `name-suffix`. For details, refer to the schema description: https://github.com/citation-file-format/citation-file-format | ||
- [ ] Update the value of the `orcid` key. If you do not have an orcid yet, you can get one here [https://orcid.org/](https://orcid.org/). | ||
- [ ] Add more authors if needed | ||
- [ ] Update `date-released` using the YYYY-MM-DD format. | ||
|
||
- [ ] Update the `doi` key with the conceptDOI for your repository (see [https://help.zenodo.org](https://help.zenodo.org/) for more information on what a conceptDOI is). If your project doesn't have a DOI yet, you can use the string `10.0000/FIXME` to pass validation.- [ ] Verify that the `keywords` array accurately describes your project. | ||
|
||
Afterwards, the `cffconvert` GitHub Action should be green. | ||
|
||
To make sure services like [Zenodo](https://zenodo.org) andthe [Research Software Directory](https://research-software-directory.org/) can keep your citation data up to date, the [`cffconvert`](https://github.com/SDCCA/dgl_abm/actions/workflows/cffconvert.yml) GitHub Action checks the following: | ||
1. Whether your repository includes a `CITATION.cff` file. | ||
|
||
_By including this file, authors of the software can receive credit for the work they put in._ | ||
|
||
1. Whether your `CITATION.cff` is valid YAML. | ||
|
||
_Visit http://www.yamllint.com/ to see if the contents of your CITATION.cff are valid YAML._ | ||
|
||
1. Whether your `CITATION.cff` adheres to the schema (as listed in the `CITATION.cff` file itself under key `cff-version`). | ||
|
||
_The Citation File Format schema can be found [here](https://github.com/citation-file-format/citation-file-format), along with an explanation of all the keys. You're advised to use the latest available schema version._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: 'Next step: Linting' | ||
--- | ||
|
||
Your repository has a [workflow](https://github.com/SDCCA/dgl_abm/blob/main/.github/workflows/build.yml) which [lints](https://en.wikipedia.org/wiki/Lint_(software)) your code after every push and when creating a pull request. | ||
|
||
Linter workflow may fail if `description` or `keywords` field in [pyproject.toml](https://github.com/SDCCA/dgl_abm/blob/main/pyproject.toml) is empty. Please update these fields. To validate your changes run: | ||
|
||
```shell | ||
ruff . | ||
``` | ||
|
||
Enabling [githook](https://git-scm.com/docs/githooks) will automatically lint your code in every commit. You can enable it by running the command below. | ||
|
||
```shell | ||
git config --local core.hooksPath .githooks | ||
``` |
Oops, something went wrong.