Skip to content

Commit 3aeaaa7

Browse files
committed
Initial commit of a Python template repo. Primarily created by Copilot based off the datastore-python repo
0 parents  commit 3aeaaa7

34 files changed

Lines changed: 1476 additions & 0 deletions

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{code_owner_handle}}
2+
{{code_owner_handle_2}}

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Description
2+
3+
Please provide a brief description of the changes in this pull request.
4+
5+
## Type of Change
6+
7+
Please delete options that are not relevant.
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] This change requires a documentation update
13+
14+
## How Has This Been Tested?
15+
16+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
17+
18+
- [ ] Unit tests
19+
- [ ] Integration tests
20+
- [ ] Manual testing
21+
22+
## Checklist:
23+
24+
- [ ] My code follows the style guidelines of this project
25+
- [ ] I have performed a self-review of my own code
26+
- [ ] I have commented my code, particularly in hard-to-understand areas
27+
- [ ] I have made corresponding changes to the documentation
28+
- [ ] My changes generate no new warnings
29+
- [ ] I have added tests that prove my fix is effective or that my feature works
30+
- [ ] New and existing unit tests pass locally with my changes
31+
- [ ] Any dependent changes have been merged and published in downstream modules

.github/workflows/CI.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
check_analyzers:
13+
name: Check analyzers for {{package_full_name}}
14+
uses: ./.github/workflows/check_{{package_name}}.yml
15+
check_examples:
16+
name: Check analyzers for examples
17+
uses: ./.github/workflows/check_examples.yml
18+
check_docs:
19+
name: Check docs for {{package_full_name}}
20+
uses: ./.github/workflows/check_docs.yml
21+
run_unit_tests:
22+
strategy:
23+
matrix:
24+
os: [windows-latest, ubuntu-latest]
25+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
26+
name: Run unit tests
27+
uses: ./.github/workflows/run_unit_tests.yml
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
os: ${{ matrix.os }}

.github/workflows/PR.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
9+
jobs:
10+
check_analyzers:
11+
name: Check analyzers for {{package_full_name}}
12+
uses: ./.github/workflows/check_{{package_name}}.yml
13+
check_examples:
14+
name: Check analyzers for examples
15+
uses: ./.github/workflows/check_examples.yml
16+
check_docs:
17+
name: Check docs for {{package_full_name}}
18+
uses: ./.github/workflows/check_docs.yml
19+
run_unit_tests:
20+
strategy:
21+
matrix:
22+
os: [windows-latest, ubuntu-latest]
23+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
24+
name: Run unit tests
25+
uses: ./.github/workflows/run_unit_tests.yml
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
os: ${{ matrix.os }}

.github/workflows/check_docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check docs
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
check_docs:
9+
name: Check docs for {{package_full_name}}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out repo
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
14+
with:
15+
submodules: true
16+
- name: Set up Python
17+
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
18+
with:
19+
python-version: 3.13
20+
- name: Set up Poetry
21+
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
22+
- name: Install dependencies
23+
run: poetry install --with=docs
24+
- name: Build documentation
25+
run: |
26+
cd docs
27+
poetry run sphinx-build -b html . _build/html -W
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check examples
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
check_examples:
9+
name: Check analyzers for examples
10+
strategy:
11+
matrix:
12+
os: [windows-latest, ubuntu-latest, macos-latest]
13+
python-version: [3.9, 3.13]
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
with:
19+
submodules: true
20+
- name: Set up Python
21+
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Set up Poetry
25+
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
26+
- name: Install dependencies
27+
run: poetry install --with=dev,lint
28+
- name: Check examples formatting
29+
run: poetry run black --check examples/
30+
- name: Type check examples
31+
run: poetry run mypy examples/
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check analyzers
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
check_analyzers:
9+
name: Check analyzers for {{package_full_name}}
10+
strategy:
11+
matrix:
12+
os: [windows-latest, ubuntu-latest, macos-latest]
13+
python-version: [3.9, 3.13]
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
with:
19+
submodules: true
20+
- name: Set up Python
21+
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Set up Poetry
25+
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
26+
- name: Analyze Python Project
27+
uses: ni/python-actions/analyze-project@f42e2f27a585f5d47efcab79b608ec0ec97191c9
28+
- name: Bandit security checks
29+
run: poetry run bandit -c pyproject.toml -r src/

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish to PyPI
10+
runs-on: ubuntu-latest
11+
environment: publish
12+
permissions:
13+
id-token: write
14+
steps:
15+
- name: Check out repo
16+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
- name: Set up Python
18+
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
19+
with:
20+
python-version: 3.13
21+
- name: Set up Poetry
22+
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
23+
- name: Build package
24+
run: poetry build
25+
- name: Publish to PyPI
26+
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Run unit tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
os:
10+
required: true
11+
type: string
12+
workflow_dispatch:
13+
inputs:
14+
python-version:
15+
required: true
16+
type: string
17+
default: "3.13"
18+
os:
19+
required: true
20+
type: string
21+
default: "ubuntu-latest"
22+
23+
jobs:
24+
run_unit_tests:
25+
name: Run unit tests (Python ${{ inputs.python-version }}, ${{ inputs.os }})
26+
runs-on: ${{ inputs.os }}
27+
steps:
28+
- name: Check out repo
29+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
with:
31+
submodules: true
32+
- name: Set up Python
33+
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
34+
with:
35+
python-version: ${{ inputs.python-version }}
36+
- name: Set up Poetry
37+
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
38+
- name: Install dependencies
39+
run: poetry install --with=test
40+
- name: Run unit tests
41+
run: poetry run pytest tests/ --cov={{package_namespace}}.{{package_name}} --cov-report=xml --cov-report=html
42+
- name: Upload coverage reports to Codecov
43+
uses: codecov/codecov-action@v4
44+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'

0 commit comments

Comments
 (0)