Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
soratidus999 committed Aug 31, 2024
1 parent 16e8be3 commit 35440c6
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 80 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
# python-version: ['3.9']
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: shogo82148/actions-setup-redis@v1
with:
redis-version: "latest"

- run: redis-cli ping

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: "16"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.11"

- uses: actions/setup-node@v2
with:
Expand Down
119 changes: 109 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,122 @@
# Apply to all files without committing:
# pre-commit run --all-files
# Update this file:
# pre-commit autoupdate

repos:
# Code Upgrades
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.17.0
# hooks:
# - id: pyupgrade
# args: [--py38-plus]
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.20.0
hooks:
- id: django-upgrade
args: [--target-version=4.0]
# Code Logic
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
# Formatting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
# Identify invalid files
- id: check-ast
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-xml
# git checks
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=10000]
- id: detect-private-key
- id: check-case-conflict
# Python checks
# - id: check-docstring-first
- id: debug-statements
# - id: requirements-txt-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: fix-byte-order-marker
# General quality checks
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: |
(?x)(
\.min\.css|
\.min\.js|
\.po|
\.mo|
swagger\.json
)
- id: check-executables-have-shebangs
- id: end-of-file-fixer
exclude: \.min\.css$
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: "v2.0.2"
exclude: |
(?x)(
\.min\.css|
\.min\.js|
\.po|
\.mo|
swagger\.json
)
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.0.3
hooks:
- id: editorconfig-checker
exclude: |
(?x)(
LICENSE|
allianceauth\/static\/allianceauth\/css\/themes\/bootstrap-locals.less|
\.po|
\.mo|
swagger\.json
)
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: autopep8
- id: flake8
additional_dependencies: [Flake8-pyproject]
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
additional_dependencies:
- "[email protected]"
- "@trivago/[email protected]"
- repo: https://github.com/pycqa/isort
rev: 5.12.0
# Infrastructure
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.1
hooks:
- id: isort
name: isort (python)
- id: pyproject-fmt
name: pyproject.toml formatter
description: "Format the pyproject.toml file."
args:
- --indent=4
additional_dependencies:
- tox==4.18.0 # https://github.com/tox-dev/tox/releases/latest

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.19
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: "Validate the pyproject.toml file."
File renamed without changes.
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ buildjs:

package:
cd frontend;yarn install;yarn build;find 'build/' -name '*.js' -exec sed -i -e 's/\/\/# sourceMappingURL=/\/\/# sourceMappingURL=\/static\/reports\/static\/js\//g' {} \;
python setup.py sdist
pip install flit
flit build

devui:
cd frontend;yarn install;yarn start
76 changes: 76 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[build-system]
build-backend = "flit_core.buildapi"

requires = [ "flit-core>=3.2,<4" ]

[project]
name = "allianceauth-auth-stats"
readme = "README.md"
keywords = [
"allianceauth",
"eveonline",
]
license = { file = "LICENSE" }
authors = [
{ name = "AaronKable", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
"Environment :: Web Environment",
"Framework :: Celery",
"Framework :: Django",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]
dynamic = [ "description", "version" ]
dependencies = [
"allianceauth<5,>=3",
"django-ninja>=1.0.1,<2.0.0",
"django-solo>=2.1.0"
]

urls.Homepage = "https://github.com/Solar-Helix-Independent-Transport/allianceauth-auth-stats"
urls.Source = "https://github.com/Solar-Helix-Independent-Transport/allianceauth-auth-stats"
urls.Tracker = "https://github.com/Solar-Helix-Independent-Transport/allianceauth-auth-stats/issues"

[tool.flit.module]
name = "authstats"

[tool.isort]
profile = "django"
sections = [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"DJANGO",
"ALLIANCEAUTH",
"FIRSTPARTY",
"LOCALFOLDER",
]
known_allianceauth = [ "allianceauth", "esi" ]
known_django = [ "django" ]
skip_gitignore = true

[tool.flake8]
exclude = [ ".git", "*migrations*", ".tox", "dist", "htmlcov" ]
max-line-length = 119
select = [ "C", "E", "F", "W", "B", "B950" ]
ignore = [ 'E203', 'E231', 'E501', 'W503', 'W291', 'W293' ]

[tool.djlint]
max_attribute_length = 119
max_line_length = 119
max_blank_lines = 1
39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_settings.py → tests/test_settingsAA3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Alliance Auth Test Suite Django settings.
"""

from allianceauth.project_template.project_name.settings.base import *
from allianceauth.project_template.project_name.settings.base import * # noqa

# Celery configuration
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
Expand Down
54 changes: 54 additions & 0 deletions tests/test_settingsAA4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
Alliance Auth Test Suite Django settings.
"""

from allianceauth.project_template.project_name.settings.base import * # noqa

SITE_URL = "https://example.com"
CSRF_TRUSTED_ORIGINS = [SITE_URL]

# Celery configuration
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing

INSTALLED_APPS += [
'authstats'
]

ROOT_URLCONF = 'tests.urls'

NOSE_ARGS = [
# '--with-coverage',
# '--cover-package=',
# '--exe', # If your tests need this to be found/run, check they py files are not chmodded +x
]


PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]

# LOGGING = None # Comment out to enable logging for debugging

# Register an application at https://developers.eveonline.com for Authentication
# & API Access and fill out these settings. Be sure to set the callback URL
# to https://example.com/sso/callback substituting your domain for example.com
# Logging in to auth requires the publicData scope (can be overridden through the
# LOGIN_TOKEN_SCOPES setting). Other apps may require more (see their docs).
ESI_SSO_CLIENT_ID = '123'
ESI_SSO_CLIENT_SECRET = '123'
ESI_SSO_CALLBACK_URL = '123'

CACHES = {
"default": {
# "BACKEND": "redis_cache.RedisCache",
# "LOCATION": "localhost:6379",
# "OPTIONS": {
# "DB": 1,
# }
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6379/1",
"OPTIONS": {
"COMPRESSOR": "django_redis.compressors.lzma.LzmaCompressor",
}
}
}
Loading

0 comments on commit 35440c6

Please sign in to comment.