Skip to content

Add governance and licensing pages#695

Merged
AdrianDAlessandro merged 14 commits intomainfrom
feat/governance
Apr 24, 2026
Merged

Add governance and licensing pages#695
AdrianDAlessandro merged 14 commits intomainfrom
feat/governance

Conversation

@davehorsfall
Copy link
Copy Markdown
Collaborator

@davehorsfall davehorsfall commented Apr 17, 2026

Description

This PR adds a governance and licensing page to the website, where content is pulled directly from Github markdown files. Content should be cached for 1 hour.

image

Note: the licensing page on Github doesn't exist yet, and needs to be created. The new page should act as a centralised single point of truth on licensing across the project, and signpost people appropriately to more information as necessary.

Fixes # (issue)

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Technical work (non-breaking, change which is work as part of a new feature)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. mkdocs serve)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

Copilot AI review requested due to automatic review settings April 17, 2026 08:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new “Governance” and “Licensing” policy pages and updates existing policy pages to live under a main/pages/policies/ template structure, wiring the new pages into the site navigation.

Changes:

  • Add GovernancePageView / LicensingPageView that fetch and render Markdown from GitHub.
  • Update Privacy/Terms templates + tests to use new main/pages/policies/* template paths and add “Policies” breadcrumb items.
  • Update footer links and add URL routes for the new pages; add mypy stub packages for requests/markdown.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/main/test_main_views.py Updates template-path assertions for Privacy/Terms views.
pyproject.toml Adds typing stub packages for Markdown/requests to dev extras.
main/views/page_views.py Adds GitHub Markdown-backed base view + governance/licensing views; updates Privacy/Terms template paths.
main/urls.py Adds governance/ and licensing/ routes.
main/templates/main/snippets/footer.html Fixes footer URL names and adds links to the new policy pages.
main/templates/main/pages/policies/terms.html Adds “Policies” breadcrumb item.
main/templates/main/pages/policies/privacy.html Adds “Policies” breadcrumb item and tweaks breadcrumb label.
main/templates/main/pages/policies/licensing.html New template for licensing page rendering remote markdown.
main/templates/main/pages/policies/governance.html New template for governance page rendering remote markdown.
.pre-commit-config.yaml Adds typing stub packages for mypy hook.
Comments suppressed due to low confidence (2)

main/templates/main/pages/policies/privacy.html:9

  • In breadcrumbs, aria-current="page" should only be present on the active/current breadcrumb item. Here it's applied to the non-active "Policies" crumb, which is inconsistent with other templates and is inaccurate for assistive technologies.
    main/templates/main/pages/policies/terms.html:9
  • In breadcrumbs, aria-current="page" should only be present on the active/current breadcrumb item. Here it's applied to the non-active "Policies" crumb, which is inconsistent with other templates and is inaccurate for assistive technologies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment thread main/views/page_views.py Outdated
Comment thread main/views/page_views.py
Comment on lines +267 to +289
class GovernancePageView(GitHubMarkdownPageView):
"""View that renders the governance page from GitHub Markdown."""

template_name = "main/pages/policies/governance.html"
page_heading = "DIRECT Governance"
unavailable_message = "Governance document is temporarily unavailable."

github_raw_url = (
"https://raw.githubusercontent.com/direct-framework/.github/main/GOVERNANCE.md"
)


# @method_decorator(cache_page(60 * 60), name="dispatch") # cache 1 hour
class LicensingPageView(GitHubMarkdownPageView):
"""View that renders the licensing page from GitHub Markdown."""

template_name = "main/pages/policies/licensing.html"
page_heading = "DIRECT Licensing"
unavailable_message = "Licensing document is temporarily unavailable."

github_raw_url = (
"https://raw.githubusercontent.com/direct-framework/.github/main/LICENSING.md"
)
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

New Governance/Licensing views introduce network-fetch + markdown rendering behavior but there are no tests covering these routes (template used, status code, and the failure path when the GitHub fetch errors). Add view tests that mock the HTTP request (e.g., via requests-mock/pytest-mock) to keep the test suite deterministic.

Copilot uses AI. Check for mistakes.
Comment thread main/templates/main/pages/policies/licensing.html Outdated
Comment thread main/templates/main/snippets/footer.html Outdated
Comment thread main/views/page_views.py
Comment thread main/templates/main/pages/policies/governance.html Outdated
Comment thread main/templates/main/pages/policies/governance.html Outdated
Comment thread main/templates/main/pages/policies/licensing.html Outdated
Base automatically changed from 674-footer to main April 17, 2026 13:50
Copy link
Copy Markdown
Contributor

@anenadic anenadic left a comment

Choose a reason for hiding this comment

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

This is looking good to me - thank you @davehorsfall.

When trying to run locally - I noticed that dependencies markdown and requests are missing from requirements.txt so a pip freeze should be done.

@anenadic
Copy link
Copy Markdown
Contributor

anenadic commented Apr 17, 2026

Suggestion for the content of the licence file (to be tweaked, just a starting point):

# LICENSE

The DIRECT project makes all of its content publicly available under open source licenses:

- Images, documentation, data and page content are made available under the [CC BY 4.0 license][cc-by-legal]
- Metadata is made available under the [CC0 1.0 Universal license][cc-0-legal]
- Software is made available under the [BSD 3-Clause License][bsd-3-license].

Check individual repositories under the DIRECT organisation for more details on individual sub-project licensing.

[cc-by-human]: https://creativecommons.org/licenses/by/4.0/
[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode
[cc-0-human]: https://creativecommons.org/publicdomain/zero/1.0/
[cc-0-legal]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
[bsd-3-license]: https://opensource.org/license/bsd-3-clause

Copy link
Copy Markdown
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

This is all really good! I like the approach and how the content is being pulled in and rendered. I have made a number of comments related to best practices and security. We should also have tests for the two new pages (at least rudimentary ones that just inherit TemplateOkMixin like the TestFrameworkOverviewPageView).

Also, the copilot review made some good comments, I have reacted to the ones I think are valuable with a thumbs up emoji. Please have a look at those (some of them are related to comments I made too).

Comment thread main/templates/main/pages/policies/privacy.html Outdated
Comment thread main/templates/main/pages/policies/terms.html Outdated
Comment thread main/templates/main/pages/policies/governance.html Outdated
Comment thread main/urls.py Outdated
Comment thread pyproject.toml
Comment thread main/views/page_views.py
Comment thread main/views/page_views.py Outdated
Comment thread main/views/page_views.py Outdated
@AdrianDAlessandro AdrianDAlessandro linked an issue Apr 20, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main/views/page_views.py 90.56% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@davehorsfall
Copy link
Copy Markdown
Collaborator Author

I think all pending points here are now addressed @AdrianDAlessandro (except the tests).

I've enabled the caching, and sanitised the external content with nh3. I've also fixed the broken test.

@davehorsfall
Copy link
Copy Markdown
Collaborator Author

I've also added @anenadic draft licensing text to LICENSING.md, so there is some initial content. We can tweak and expand on that if necessary.

Copy link
Copy Markdown
Collaborator

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

I've just pushed a couple basic tests for these two pages. Happy to merge

@AdrianDAlessandro AdrianDAlessandro merged commit b7bc48f into main Apr 24, 2026
5 checks passed
@AdrianDAlessandro AdrianDAlessandro deleted the feat/governance branch April 24, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add governance and licensing pages

4 participants