Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on: [push, pull_request, workflow_dispatch]

permissions: {}

env:
FORCE_COLOR: 1
RUFF_OUTPUT_FORMAT: github

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- uses: j178/prek-action@v1
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repos:
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.29.1
hooks:
- id: django-upgrade
args: [--target-version=4.2]
Copy link
Member Author

Choose a reason for hiding this comment

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

The tool looks for the Django version in pyproject.toml. We don't have one, so defaults to 2.2. So let's specify it here, and remember to update when also bumping the Django version in base-requirements.txt.

https://django-upgrade.readthedocs.io/en/latest/options.html#cmdoption-target-version

Copy link
Member

Choose a reason for hiding this comment

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

remember to update when also bumping

😬


- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-yaml
- id: debug-statements

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.34.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
hooks:
- id: actionlint

- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

ci:
autoupdate_schedule: quarterly
Comment on lines +33 to +34
Copy link
Member Author

Choose a reason for hiding this comment

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

In case we want to enable https://pre-commit.ci/ ? Be less spammy than the default weekly.

Choose a reason for hiding this comment

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

pre-commit.ci would also replace your github action and run faster. It's quite optimized

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's also useful to have it in GitHub Actions, to be able to already catch things in forks.

6 changes: 3 additions & 3 deletions pydotorg/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
path('', views.IndexView.as_view(), name='home'),
re_path(r'^_health/?', views.health, name='health'),
path('authenticated', views.AuthenticatedView.as_view(), name='authenticated'),
re_path(r'^humans.txt$', TemplateView.as_view(template_name='humans.txt', content_type='text/plain')),
re_path(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
re_path(r'^funding.json$', views.serve_funding_json, name='funding_json'),
path('humans.txt', TemplateView.as_view(template_name='humans.txt', content_type='text/plain')),
path('robots.txt', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
path('funding.json', views.serve_funding_json, name='funding_json'),
path('shell/', TemplateView.as_view(template_name="python/shell.html"), name='shell'),

# python section landing pages
Expand Down
2 changes: 1 addition & 1 deletion sponsors/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def get_prepopulated_fields(self, request, obj=None):
return {'slug': ['name']}
return {}

@admin.display(description="Revenue split")
def get_benefit_split(self, obj: SponsorshipPackage) -> str:
colors = [
"#ffde57", # Python Gold
Expand All @@ -223,7 +224,6 @@ def get_benefit_split(self, obj: SponsorshipPackage) -> str:
html = f"<div style='{style}'>{''.join(spans)}</div>"
return mark_safe(html)

get_benefit_split.short_description = "Revenue split"


class SponsorContactInline(admin.TabularInline):
Expand Down
2 changes: 1 addition & 1 deletion successstories/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_draft(self):
def test_featured(self):
featured_stories = Story.objects.featured()
expected_repr = [f'<Story: {self.story3.name}>']
self.assertQuerysetEqual(featured_stories, expected_repr, transform=repr)
self.assertQuerySetEqual(featured_stories, expected_repr, transform=repr)

def test_get_admin_url(self):
self.assertEqual(self.story1.get_admin_url(),
Expand Down