Skip to content

Commit

Permalink
Updates via ambient-package-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
GitRon committed Jul 15, 2024
1 parent b4c8d25 commit 32fe98f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 30 deletions.
7 changes: 5 additions & 2 deletions .ambient-package-update/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ambient_package_update.metadata.maintainer import PackageMaintainer
from ambient_package_update.metadata.package import PackageMetadata
from ambient_package_update.metadata.readme import ReadmeContent
from ambient_package_update.metadata.ruff_ignored_inspection import RuffIgnoredInspection

METADATA = PackageMetadata(
package_name="django_migration_zero",
Expand All @@ -26,12 +27,14 @@
has_migrations=True,
readme_content=ReadmeContent(uses_internationalisation=True),
dependencies=[
"Django>=3.2",
f"Django>={SUPPORTED_DJANGO_VERSIONS[0]}",
],
supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
optional_dependencies={
"dev": [*DEV_DEPENDENCIES, "unittest-parametrize~=1.3"],
},
ruff_ignore_list=[],
ruff_ignore_list=[
RuffIgnoredInspection(key="TRY003", comment="Avoid specifying long messages outside the exception class"),
],
)
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', ]
python-version: ['3.9', '3.10', '3.11', '3.12', ]
django-version: ['42', '50', ]

exclude:
- python-version: '3.8'
django-version: 50
- python-version: '3.9'
django-version: 50

Expand Down Expand Up @@ -88,7 +86,7 @@ jobs:
with:
name: coverage-data

- name: Combine coverage and fail if it's <100%
- name: Combine coverage and fail if it's <100.0%
run: |
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100.0
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
rev: v3.16.0
hooks:
- id: pyupgrade
args: [ --py38-plus ]
args: [ --py39-plus ]
stages: [ push ]

- repo: https://github.com/adamchainz/django-upgrade
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* *master* (unreleased)
* Use ORM to reset `django_migrations` table
* Dropped Python 3.8 support
* Added multiple ruff linters

* *2.1.0* (2024-07-09)
* Discover apps in nested directories
Expand Down
5 changes: 2 additions & 3 deletions django_migration_zero/helpers/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
from os.path import isdir
from pathlib import Path
from typing import List

from django.apps import apps
from django.apps.config import AppConfig
Expand All @@ -20,7 +19,7 @@ def build_migration_directory_path(*, app_path: Path) -> Path:
return app_path / "migrations"


def get_local_django_apps() -> List[AppConfig]:
def get_local_django_apps() -> list[AppConfig]:
"""
Iterate all installed Django apps and detect local ones.
"""
Expand All @@ -46,7 +45,7 @@ def has_migration_directory(*, app_path: Path) -> bool:
return True if isdir(possible_migration_dir) else False


def get_migration_files(*, app_label: str, app_path: Path, exclude_initials: bool = False) -> List[str]:
def get_migration_files(*, app_label: str, app_path: Path, exclude_initials: bool = False) -> list[str]:
"""
Returns a list of all migration files detected in the given Django app.
"""
Expand Down
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"
html_theme_options = {
"display_version": False,
Expand Down
42 changes: 24 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["flit_core>=3.4"]
build-backend = "flit_core.buildapi"

[project]
name = "django-migration-zero"
name = "django_migration_zero"
authors = [
{'name' = 'Ambient Digital', 'email' = '[email protected]'},
]
Expand All @@ -20,7 +20,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -30,7 +29,7 @@ classifiers = [
dynamic = ["version", "description"]
license = {"file" = "LICENSE.md"}
dependencies = [
'Django>=3.2',
'Django>=4.2',
]


Expand All @@ -41,14 +40,15 @@ dev = [
'pytest-django~=4.7',
'pytest-mock~=3.12',
'coverage~=7.3',
'pre-commit~=3.5',
'ruff~=0.1.7',
'pre-commit~=3.7',
'ruff~=0.4',
'sphinx~=7.1',
'sphinx-rtd-theme~=2.0',
'm2r2==0.3.3.post2',
'mistune<2.0.0',
'flit~=3.9',
'ambient-package-update~=24.6.4',
'keyring~=25.2',
'ambient-package-update~=24.7.3',
'unittest-parametrize~=1.3',
]

Expand All @@ -74,18 +74,24 @@ lint.select = [
"DTZ", # flake8-datetimez
"DJ", # flake8-django
"TD", # flake8-to-do
"RUF100", # Removes unnecessary "#noqa" comments
"RUF", # Ruff-specific rules
"YTT", # Avoid non-future-prove usages of "sys"
# "FBT", # Protects you from the "boolean trap bug"
"C4", # Checks for unnecessary conversions
"PIE", # Bunch of useful rules
# "SIM", # Simplifies your code
"INT", # Validates your gettext translation strings
"PERF", # PerfLint
"PGH", # No all-purpose "# noqa" and eval validation
"PL", # PyLint
"LOG", # flake8-logging
"TID", # flake8-tidy-imports
"PLR2004", # Magic numbers
"BLE", # Checks for except clauses that catch all exceptions
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
"TRY", # Clean try/except
"ERA", # Commented out code
]
lint.ignore = [
'TRY003', # Avoid specifying long messages outside the exception class
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
Expand All @@ -100,16 +106,21 @@ lint.fixable = [
"DTZ", # flake8-datetimez
"DJ", # flake8-django
"TD", # flake8-to-do
"RUF100", # Removes unnecessary "#noqa" comments
"RUF", # Ruff-specific rules
"YTT", # Avoid non-future-prove usages of "sys"
# "FBT", # Protects you from the "boolean trap bug"
"C4", # Checks for unnecessary conversions
"PIE", # Bunch of useful rules
# "SIM", # Simplifies your code
"INT", # Validates your gettext translation strings
"PERF", # PerfLint
"PGH", # No all-purpose "# noqa" and eval validation
"PL", # PyLint
"LOG", # flake8-logging
"TID", # flake8-tidy-imports
"PLR2004", # Magic numbers
"BLE", # Checks for except clauses that catch all exceptions
"ANN401", # Checks that function arguments are annotated with a more specific type than Any
"TRY", # Clean try/except
"ERA", # Commented out code
]
lint.unfixable = []

Expand Down Expand Up @@ -141,7 +152,7 @@ exclude = [
line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.12
target-version = "py312"
Expand All @@ -161,10 +172,6 @@ line-ending = "auto"

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{38,39,310,311}-django{32,41,42}
isolated_build = True
[testenv]
# Django deprecation overview: https://www.djangoproject.com/download/
deps =
Expand All @@ -176,7 +183,6 @@ commands =
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
Expand Down

0 comments on commit 32fe98f

Please sign in to comment.