Skip to content

Commit

Permalink
Switch to pyproject.toml
Browse files Browse the repository at this point in the history
Fix/drop a bunch of outdated things
  • Loading branch information
Viicos committed Mar 8, 2024
1 parent 94fbf25 commit 910e40a
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 161 deletions.
18 changes: 0 additions & 18 deletions .bumpversion.cfg

This file was deleted.

7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 88
exclude =
env
.tox
doc
**/migrations/*
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ jobs:
with:
python-version: "3.10"

- name: Build sdist and wheel
- name: Build wheel
run: |
pip install pip setuptools wheel --upgrade
python setup.py sdist bdist_wheel
pip install build --upgrade
python -m build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Admin Index for Django
======================

:Version: 3.1.1
:Download: https://pypi.python.org/pypi/django-admin-index
:Download: https://pypi.org/project/django-admin-index/
:Source: https://github.com/maykinmedia/django-admin-index
:Keywords: django, admin, dashboard

Expand Down
4 changes: 3 additions & 1 deletion django_admin_index/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# :copyright: (c) 2017, Maykin Media BV.
# All rights reserved.
# :license: BSD (3 Clause), see LICENSE for more details.
__version__ = "3.1.1"
from importlib.metadata import version

__version__ = version("django-admin-index")
__author__ = "Joeri Bekker"
2 changes: 1 addition & 1 deletion django_admin_index/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: 3.1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-29 22:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
Expand Down
23 changes: 8 additions & 15 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
#!/usr/bin/env python
from __future__ import absolute_import, unicode_literals

import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.proj.settings")

try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
except ImportError as e:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from e

execute_from_command_line(sys.argv)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 112 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,114 @@
[build-system]
requires = ["setuptools >= 30.3.0"] # version supporting setup.cfg
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "django-admin-index"
version = "3.1.1"
description = "Admin index for Django"
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["Django", "index", "dashboard"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"Operating System :: Unix",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"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",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.8"
dependencies = [
"django>=3.2",
"django-ordered-model>=3.5",
]

[project.urls]
Homepage = "https://github.com/maykinmedia/django-admin-index"
"Bug Tracker" = "https://github.com/maykinmedia/django-admin-index/issues"
"Source Code" = "https://github.com/maykinmedia/django-admin-index"
Changelog = "https://github.com/maykinmedia/django-admin-index/blob/main/CHANGELOG.rst"

[project.optional-dependencies]
tests = [
"pytest",
"pytest-django",
"tox",
"isort",
"black",
"flake8",
]
coverage = [
"pytest-cov",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
]
release = [
"bump-my-version",
]

[tool.setuptools.packages.find]
include = ["django_admin_index*"]
namespaces = false

[tool.isort]
profile = "black"
combine_as_imports = true
known_django = "django"
known_first_party="django_admin_index"
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip = ["env", ".tox", ".history"]

[tool.pytest.ini_options]
testpaths = ["tests/unit"]
python_classes = ["test_*"]
DJANGO_SETTINGS_MODULE = "tests.proj.settings"

[tool.bumpversion]
current_version = "3.1.1"
files = [
{filename = "pyproject.toml"},
{filename = "README.rst"},
{filename = "django_admin_index/locale/nl/LC_MESSAGES/django.po"},
{filename = "package.json"},
{filename = "package-lock.json"},
]

[tool.coverage.run]
branch = true
source = [
"django_admin_index"
]
omit = [
"django_admin_index/migrations/*",
]

[tool.coverage.report]
exclude_also = [
"if (typing\\.)?TYPE_CHECKING:",
"@(typing\\.)?overload",
"class .*\\(.*Protocol.*\\):",
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.",
"pass",
]
omit = [
"django_admin_index/migrations/*",
]

[tool.coverage.html]
directory = "cover"
111 changes: 0 additions & 111 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

9 changes: 7 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ envlist =
py311-django{41,42}
isort
black
flake8
skip_missing_interpreters = true

[gh-actions]
Expand Down Expand Up @@ -34,7 +35,7 @@ deps =
django42: Django~=4.2.0

commands =
py.test -v \
pytest -v \
--cov-report=term \
--cov-report xml:reports/coverage-{envname}.xml \
{posargs}
Expand All @@ -47,5 +48,9 @@ commands = isort --check-only --diff .
[testenv:black]
extras = tests
skipsdist = True
commands = black --check django_admin_index tests setup.py
commands = black --check django_admin_index tests

[testenv:flake8]
extras = tests
skipsdist = True
commands = flake8 .

0 comments on commit 910e40a

Please sign in to comment.