Skip to content

Commit

Permalink
Updates 241111 (#12)
Browse files Browse the repository at this point in the history
* Update Python to 3.13 and replace Black/Flake8 with Ruff

Upgraded Python version to 3.13 across pre-commit, pyproject.toml, and GitHub workflows. Replaced Black and Flake8 with Ruff and Ruff-format for linting and formatting in the pre-commit configuration. Updated GitHub workflows and dependencies to support Python 3.13.

* Trigger Build

* Remove unnecessary blank lines and fix docstrings

This commit eliminates redundant blank lines and corrects the formatting of docstrings in various files for consistency. These changes help in maintaining clean and readable code, improving overall code quality without altering functionality.
  • Loading branch information
rh0dium authored Nov 11, 2024
1 parent 12c176f commit e6f2c8c
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 27 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'

- name: Install dependencies
Expand All @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'

- name: Install dependencies
Expand All @@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'

- name: Install dependencies
Expand All @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'

- name: Install dependencies
Expand All @@ -94,7 +94,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'

- name: Install dependencies
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
matrix:
db: [ sqlite, mariadb ]
django-version: [ "~=5.0" ]
python-version: [ "3.12" ]
python-version: ["3.12", "3.13" ]

services:
mariadb:
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Install dependencies
run: |
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install dependencies
run: |
pip install git+https://${{ secrets.ORGANIZATIONAL_REPO_TOKEN }}@github.com/pivotal-energy-solutions/tensor-infrastructure@master#egg=infrastructure
Expand Down
21 changes: 10 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.10
python: python3.13
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand All @@ -20,13 +20,12 @@ repos:
- id: mixed-line-ending
exclude: .idea/.*
- id: check-json
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
language_version: python3.10
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.3
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions appsearch/ormutils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""ormutils.py: ORM Utils"""

from functools import reduce

from django.core.exceptions import FieldDoesNotExist
Expand Down
6 changes: 3 additions & 3 deletions appsearch/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ def get_searchable_field_choices(self, include_types=False): # noqa: E731
choices = map(lambda c: c + (self.get_field_classification(c[0]),), choices)

# Perform a sha hash on the ORM path to get something unique and obscured for the frontend
encode_value = lambda pair: ( # noqa: E731
(sha((",".join(pair[0])).encode("utf-8")).hexdigest(),) + tuple(pair[1:])
)
def encode_value(pair):
return (sha(",".join(pair[0]).encode("utf-8")).hexdigest(),) + tuple(pair[1:])

return map(encode_value, choices)

def reverse_field_hash(self, hash):
Expand Down
1 change: 1 addition & 0 deletions appsearch/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Replace this with more appropriate tests for your application.
"""

import re
from urllib.parse import urlencode

Expand Down
1 change: 0 additions & 1 deletion demo_app/company/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
"""search.py: Django company"""


from appsearch.registry import ModelSearch, search

from .models import Company
Expand Down
3 changes: 1 addition & 2 deletions demo_app/users/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""search.py: Django """

"""search.py: Django"""

import logging

Expand Down
3 changes: 1 addition & 2 deletions demo_app/users/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""views.py.py: """

"""views.py.py:"""

from django.contrib.auth import get_user_model

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Utilities",
]
dependencies = [
Expand Down

0 comments on commit e6f2c8c

Please sign in to comment.