diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f62161..544314d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 5.x.y + +Miscellaneous: + +- Migrated from `setup.py` and `setup.cfg` to `pyproject.toml` + ## 5.0.0 - **Breaking change**: stop silently ignoring when the internal `sqlmigrate` call fails and the linter cannot analyse the migration. diff --git a/MANIFEST.in b/MANIFEST.in index 729b632..479dad1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,8 @@ +prune tests include README.md include LICENSE include CHANGELOG.md include MANIFEST.in recursive-include docs * include tox.ini +include pyproject.toml diff --git a/docs/internals/publishing.md b/docs/internals/publishing.md index 5cac5db..b5d63a0 100644 --- a/docs/internals/publishing.md +++ b/docs/internals/publishing.md @@ -2,7 +2,8 @@ A small note on how the linter is usually published to PyPi: -- `rm -r django_migration_linter.egg-info/` -- `pip install wheel twine` -- `python3 setup.py sdist bdist_wheel --universal` +- `rm -r django_migration_linter.egg-info/ dist/` +- `pip install --upgrade build` +- `python -m build` +- `pip install --upgrade twine` - `twine upload dist/django_migration_linter-X.Y.Z-py3-none-any.whl dist/django-migration-linter-X.Y.Z.tar.gz` diff --git a/docs/usage.md b/docs/usage.md index 26a15c0..6fe0edf 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -92,7 +92,7 @@ You can also ignore backward incompatible migration tests by adding this option `python manage.py lintmigrations --exclude-migration-tests ALTER_COLUMN` -The migration test codes can be found in the [corresponding source code files](../django_migration_linter/sql_analyser/base.py). +The migration test codes can be found in the [corresponding source code files](../src/django_migration_linter/sql_analyser/base.py). ## Production usage example diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..823a1cd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-migration-linter" +version = "5.0.0" +description = "Detect backward incompatible migrations for your django project" +authors = [ + { name="3YOURMIND GmbH", email="fb@3yourmind.com" }, +] +maintainers = [{name = "David Wobrock", email = "david.wobrock@gmail.com"}] +readme = "README.md" +requires-python = ">=3.7" +dependencies = [ + "django>=2.2", + "appdirs>=1.4.3", + "toml>=0.10.2", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +keywords = [ + "django", + "migration", + "lint", + "linter", + "database", + "backward", + "compatibility", +] + + +[project.urls] +Changelog = "https://github.com/3YOURMIND/django-migration-linter/blob/main/CHANGELOG.md" +Repository = "https://github.com/3YOURMIND/django-migration-linter" + +[project.optional-dependencies] +test = [ + "tox>=4.6.3", + "mysqlclient>=2.1.1", + "psycopg2>=2.9.6", + "django_add_default_value>=0.4.0", + "coverage>=7.2.7", +] + +[tool.isort] +multi_line_output = 3 +include_trailing_comma = "True" +force_grid_wrap = 0 +use_parentheses = "True" +ensure_newline_before_comments = "True" +line_length = 88 +add_imports = [ "from __future__ import annotations" ] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9efcc1d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[isort] -multi_line_output = 3 -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -line_length = 88 -add_imports = - from __future__ import annotations - -[flake8] -max-line-length=88 -ignore=E203,W503 diff --git a/setup.py b/setup.py deleted file mode 100644 index 755a7c1..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -from __future__ import annotations - -import ast -import re -from os import path - -from setuptools import find_packages, setup - -PROJECT_DIR = path.abspath(path.dirname(__file__)) - - -def get_version(): - constants = path.join(PROJECT_DIR, "django_migration_linter", "constants.py") - _version_re = re.compile(r"__version__\s+=\s+(?P.*)") - with open(constants) as f: - match = _version_re.search(f.read()) - version = match.group("version") if match is not None else '"unknown"' - return str(ast.literal_eval(version)) - - -with open(path.join(PROJECT_DIR, "README.md")) as f: - long_description = f.read() - - -setup( - name="django-migration-linter", - version=get_version(), - description="Detect backward incompatible migrations for your django project", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/3YOURMIND/django-migration-linter", - author="3YOURMIND GmbH", - author_email="david.wobrock@gmail.com", - license="Apache License 2.0", - packages=find_packages(include=["django_migration_linter*"]), - install_requires=[ - "django>=2.2", - "appdirs>=1.4.3", - "toml>=0.10.2", - ], - extras_require={ - "test": [ - "tox>=4.6.3", - "mysqlclient>=2.1.1", - "psycopg2>=2.9.6", - "django_add_default_value>=0.4.0", - "coverage>=7.2.7", - ], - }, - keywords="django migration lint linter database backward compatibility", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], -) diff --git a/django_migration_linter/__init__.py b/src/django_migration_linter/__init__.py similarity index 100% rename from django_migration_linter/__init__.py rename to src/django_migration_linter/__init__.py diff --git a/django_migration_linter/cache.py b/src/django_migration_linter/cache.py similarity index 100% rename from django_migration_linter/cache.py rename to src/django_migration_linter/cache.py diff --git a/django_migration_linter/constants.py b/src/django_migration_linter/constants.py similarity index 100% rename from django_migration_linter/constants.py rename to src/django_migration_linter/constants.py diff --git a/django_migration_linter/management/__init__.py b/src/django_migration_linter/management/__init__.py similarity index 100% rename from django_migration_linter/management/__init__.py rename to src/django_migration_linter/management/__init__.py diff --git a/django_migration_linter/management/commands/__init__.py b/src/django_migration_linter/management/commands/__init__.py similarity index 100% rename from django_migration_linter/management/commands/__init__.py rename to src/django_migration_linter/management/commands/__init__.py diff --git a/django_migration_linter/management/commands/lintmigrations.py b/src/django_migration_linter/management/commands/lintmigrations.py similarity index 100% rename from django_migration_linter/management/commands/lintmigrations.py rename to src/django_migration_linter/management/commands/lintmigrations.py diff --git a/django_migration_linter/management/commands/makemigrations.py b/src/django_migration_linter/management/commands/makemigrations.py similarity index 100% rename from django_migration_linter/management/commands/makemigrations.py rename to src/django_migration_linter/management/commands/makemigrations.py diff --git a/django_migration_linter/management/utils.py b/src/django_migration_linter/management/utils.py similarity index 100% rename from django_migration_linter/management/utils.py rename to src/django_migration_linter/management/utils.py diff --git a/django_migration_linter/migration_linter.py b/src/django_migration_linter/migration_linter.py similarity index 100% rename from django_migration_linter/migration_linter.py rename to src/django_migration_linter/migration_linter.py diff --git a/django_migration_linter/operations.py b/src/django_migration_linter/operations.py similarity index 100% rename from django_migration_linter/operations.py rename to src/django_migration_linter/operations.py diff --git a/django_migration_linter/sql_analyser/__init__.py b/src/django_migration_linter/sql_analyser/__init__.py similarity index 100% rename from django_migration_linter/sql_analyser/__init__.py rename to src/django_migration_linter/sql_analyser/__init__.py diff --git a/django_migration_linter/sql_analyser/analyser.py b/src/django_migration_linter/sql_analyser/analyser.py similarity index 100% rename from django_migration_linter/sql_analyser/analyser.py rename to src/django_migration_linter/sql_analyser/analyser.py diff --git a/django_migration_linter/sql_analyser/base.py b/src/django_migration_linter/sql_analyser/base.py similarity index 100% rename from django_migration_linter/sql_analyser/base.py rename to src/django_migration_linter/sql_analyser/base.py diff --git a/django_migration_linter/sql_analyser/mysql.py b/src/django_migration_linter/sql_analyser/mysql.py similarity index 100% rename from django_migration_linter/sql_analyser/mysql.py rename to src/django_migration_linter/sql_analyser/mysql.py diff --git a/django_migration_linter/sql_analyser/postgresql.py b/src/django_migration_linter/sql_analyser/postgresql.py similarity index 100% rename from django_migration_linter/sql_analyser/postgresql.py rename to src/django_migration_linter/sql_analyser/postgresql.py diff --git a/django_migration_linter/sql_analyser/sqlite.py b/src/django_migration_linter/sql_analyser/sqlite.py similarity index 100% rename from django_migration_linter/sql_analyser/sqlite.py rename to src/django_migration_linter/sql_analyser/sqlite.py diff --git a/django_migration_linter/utils.py b/src/django_migration_linter/utils.py similarity index 100% rename from django_migration_linter/utils.py rename to src/django_migration_linter/utils.py diff --git a/tox.ini b/tox.ini index 90491c5..3279926 100644 --- a/tox.ini +++ b/tox.ini @@ -38,3 +38,7 @@ commands = coverage xml -i extras = test pip_pre = true + +[flake8] +max-line-length=88 +ignore=E203,W503