Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ _tasks:
REQUIRED_APPROVING_REVIEW_COUNT="{{ required_approving_review_count }}"
REQUIRE_LAST_PUSH_APPROVAL="{{ require_last_push_approval | lower }}"
REQUIRE_CONVERSATION_RESOLUTION="{{ require_conversation_resolution | lower }}"
./copier_scripts/run_tasks.sh

#./copier_scripts/run_tasks.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a need for this commented line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn I forgot about that :D


# Questions to ask the user
_message_before_copy: |
Expand Down Expand Up @@ -85,8 +86,8 @@ repository_slug:
is_public_repo:
type: bool
help: "Not prompted. This is computed for re-use."
default: "{{ repository_visibility == 'public' }}"
when: false
default: false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading this incorrect? It seems to say is_public_repo is false on default if repository_visibility is public?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that means :

If the user sets repository_visibility to "public", then is_public_repo will be available (and its value will be false unless overridden)

so this boolian variable will only be available if the user sets the repo to public otherwise by default it will be set to false :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be causing issues with PIRR.md / codeql.yml

when: "{{ repository_visibility == 'public' }}"

module_name:
type: str
Expand Down
8 changes: 4 additions & 4 deletions project_template/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Python RAP Development",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"features": {
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
"ghcr.io/devcontainers-extra/features/pre-commit:2": {}
},
"customizations": {
"vscode": {
Expand All @@ -25,11 +25,11 @@
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "always",
"source.organizeImports": "always"
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
"editor.defaultFormatter": "ms-python.python"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions project_template/.github/CODEOWNERS.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@${{ code_owners }}
1 change: 0 additions & 1 deletion project_template/.github/CODEOWNERS.njk

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ updates:
- package-ecosystem: pip

# When set to 0, version updates are disabled.
open-pull-requests-limit: ${{ values.dependabot_open_pull_requests_limit }}
open-pull-requests-limit: ${{ dependabot_open_pull_requests_limit }}

# Look for a pyproject.toml/requirements.txt/Pipfile.lock in the root directory
directory: /
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
{% if values.is_public_repo -%}
{% if is_public_repo -%}
"ignorePatterns": [],
{%- else -%}
"ignorePatterns": [
{
"pattern": "${{ values.repository_owner }}/${{ values.repository_name }}"
"pattern": "${{ repository_owner }}/${{ repository_name }}"
}
],
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI

on: # yamllint disable-line rule:truthy
push:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]
pull_request:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]

concurrency:
{% raw %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Type Check

on: # yamllint disable-line rule:truthy
push:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]
pull_request:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]

concurrency:
{% raw %}
Expand Down Expand Up @@ -33,4 +33,4 @@ jobs:
run: make install-dev

- name: Run MyPy
run: poetry run mypy ${{ values.module_name }}
run: poetry run mypy ${{ module_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Security Scan

on: # yamllint disable-line rule:truthy
push:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]
pull_request:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]

concurrency:
{% raw %}
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like codeql.yml isn't being generated when the repo is set to Public

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ name: CodeQL

on: # yamllint disable-line rule:truthy
push:
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]
pull_request:
# The branches below must be a subset of the branches above
branches: [${{ values.default_branch }}]
branches: [${{ default_branch }}]

schedule:
# Run on a daily interval at 12pm UTC
Expand Down
2 changes: 0 additions & 2 deletions project_template/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ cython_debug/
# Bandit
.bandit

# Copier helpers
copier_scripts/

# DS_Store files
.DS_Store
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Policy Compliance Checklist

This document verifies compliance with ONS policies for the ${{ values.repository_name }} project.
This document verifies compliance with ONS policies for the ${{ repository_name }} project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the $ signs are not necessary in jinja... in the generated repo this displays as 'This document verifies compliance with ONS policies for the $test-repo project.' unfortunately it looks like there are a lot of $ signs, not sure if it's worth removing them


## GitHub Usage Policy Compliance

Expand All @@ -15,12 +15,12 @@ This document verifies compliance with ONS policies for the ${{ values.repositor
- **Configuration**:
- Security updates: Always enabled
- Version updates: Configurable via template options
- Open PR limit: {{ values.dependabot_open_pull_requests_limit or 10 }}
- Open PR limit: {{ dependabot_open_pull_requests_limit or 10 }}

### ✅ CODEOWNERS File
- **Status**: Generated automatically
- **Location**: `.github/CODEOWNERS`
- **Owners**: {{ values.code_owners }}
- **Owners**: {{ code_owners }}

### ✅ README File
- **Status**: Generated with comprehensive documentation
Expand All @@ -33,7 +33,7 @@ This document verifies compliance with ONS policies for the ${{ values.repositor
- **Badge**: License badge included in README

### ✅ Branching Strategy
- **Default Branch**: {{ values.default_branch }}
- **Default Branch**: {{ default_branch }}
- **Protection Rules**: Configured via Backstage template
- **Reviews Required**: Minimum 1 approving review
- **Status Checks**: CI/CD workflows must pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ lint: ## Run all linters (ruff).

.PHONY: security-scan
security-scan: ## Run security scan using Bandit.
poetry run bandit -r ${{ values.module_name }}
poetry run bandit -r ${{ module_name }}

.PHONY: test
test: ## Run all the tests and check coverage.
poetry run pytest -n auto --cov=${{ values.module_name }} --cov-report term-missing --cov-fail-under=50 tests/
poetry run pytest -n auto --cov=${{ module_name }} --cov-report term-missing --cov-fail-under=50 tests/

.PHONY: test-unit
test-unit: ## Run the unit tests and check coverage.
poetry run pytest -n auto --cov=${{ values.module_name }} --cov-report term-missing --cov-fail-under=50 tests/unit
poetry run pytest -n auto --cov=${{ module_name }} --cov-report term-missing --cov-fail-under=50 tests/unit

.PHONY: test-e2e
test-e2e: ## Run the end-to-end tests.
Expand Down
24 changes: 12 additions & 12 deletions project_template/README.md.njk → project_template/README.md.jinja
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ${{ values.repository_name }}
# ${{ repository_name }}

[![Build Status](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/ci.yml/badge.svg)](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/ci.yml)
[![Build Status](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/security-scan.yml/badge.svg)](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/security-scan.yml)
{%- if values.is_public_repo %}
[![Build Status](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/codeql.yml/badge.svg)](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions/workflows/codeql.yml)
[![Build Status](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/ci.yml/badge.svg)](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/ci.yml)
[![Build Status](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/security-scan.yml/badge.svg)](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/security-scan.yml)
{%- if is_public_repo %}
[![Build Status](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/codeql.yml/badge.svg)](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions/workflows/codeql.yml)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again the $ signs show up in the resulting url

{%- endif %}
[![Linting: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![poetry-managed](https://img.shields.io/badge/poetry-managed-blue)](https://python-poetry.org/)
[![License - MIT](https://img.shields.io/badge/licence%20-MIT-1ac403.svg)](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/blob/main/LICENSE)
[![License - MIT](https://img.shields.io/badge/licence%20-MIT-1ac403.svg)](https://github.com/${{ repository_owner }}/${{ repository_name }}/blob/main/LICENSE)

${{ values.repository_description }}
${{ repository_description }}

This project follows the Reproducible Analytical Pipeline (RAP) methodology, providing a modular ETL (Extract, Transform, Load) framework for data processing workflows.

Expand Down Expand Up @@ -72,7 +72,7 @@ Ensure you have the following installed:
1. Clone the repository and install the required dependencies.

```bash
git clone https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}.git
git clone https://github.com/${{ repository_owner }}/${{ repository_name }}.git
```

2. Install dependencies
Expand Down Expand Up @@ -106,7 +106,7 @@ make run

```bash
# Extract data
poetry run python -c "from ${{ values.module_name }}.extract import extract_from_source; print(extract_from_source('example_data.csv'))"
poetry run python -c "from ${{ module_name }}.extract import extract_from_source; print(extract_from_source('example_data.csv'))"

# Run full pipeline with custom parameters
poetry run python run_etl.py
Expand All @@ -115,7 +115,7 @@ poetry run python run_etl.py
3. **Programmatic usage:**

```python
from ${{ values.module_name }} import ETLPipeline
from ${{ module_name }} import ETLPipeline

pipeline = ETLPipeline()
success = pipeline.run_pipeline(
Expand Down Expand Up @@ -194,12 +194,12 @@ make security-scan
To run type checking, run:

```bash
poetry run mypy ${{ values.module_name }}
poetry run mypy ${{ module_name }}
```

### GitHub actions

Linting/formatting and Security Scanning GitHub actions are enabled by default on template repositories. If you go to the `Actions` tab on your [repository](https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}/actions), you can view all the workflows for the repository. If an action has failed, it will show a red circle with a cross in it.
Linting/formatting and Security Scanning GitHub actions are enabled by default on template repositories. If you go to the `Actions` tab on your [repository](https://github.com/${{ repository_owner }}/${{ repository_name }}/actions), you can view all the workflows for the repository. If an action has failed, it will show a red circle with a cross in it.

To find out more details about why it failed:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: ${{ values.repository_name }}
description: ${{ values.repository_description | dump }}
name: {{ repository_name }}
description: {{ repository_description }}
tags:
- python
- etl
annotations:
backstage.io/techdocs-ref: dir:.
github.com/project-slug: ${{ values.repository_owner }}/${{ values.repository_name }}
github.com/project-slug: {{ repository_owner }}/{{ repository_name }}
backstage.io/source-template: "python-etl-template"
links:
- url: https://codespaces.new/${{ values.repository_owner }}/${{ values.repository_name }}
- url: https://codespaces.new/{{ repository_owner }}/{{ repository_name }}
title: Open Development Environment
icon: scaffolder
- url: https://officenationalstatistics.sharepoint.com/sites/ONS_DDaT_Communities/SitePages/SE%20-%20Principles,%20Policies,%20Guidelines%20&%20more.aspx?csf=1&web=1&share=EQI8qpmdcZ1MvVA__6yKAtgBkWCMhU-pty-SBeAs1KVAEQ&e=jlgchY
Expand All @@ -20,13 +20,13 @@ metadata:
- url: https://app.pluralsight.com/channels/details/c4f16af4-8278-440c-9ae8-fc9e95f1f34d
title: Learning Pathway
icon: help
- url: vscode://vscode.git/clone?url=https://github.com/${{ values.repository_owner }}/${{ values.repository_name }}.git
- url: vscode://vscode.git/clone?url=https://github.com/{{ repository_owner }}/{{ repository_name }}.git
title: Open in Local Visual Studio Code
icon: scaffolder
spec:
type: module
lifecycle: experimental
owner: ${{ values.catalog_owner | dump }}
{%- if values.catalog_system %}
system: ${{ values.catalog_system | dump }}
owner: {{ catalog_owner }}
{%- if catalog_system %}
system: {{ catalog_system }}
{%- endif %}
Loading
Loading