Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update packaging to pyproject.toml #167

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.{json,yml,yaml,js,jsx}]
[*.{json,yml,yaml,js,jsx,toml}]
indent_size = 2

[LICENSE]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
- run: python setup.py sdist bdist_wheel
- run: python -m pip install --upgrade pip build wheel twine readme-renderer
- run: python -m build --sdist --wheel
- run: python -m twine check dist/*

standardjs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: python -m pip install --upgrade setuptools_scm
- run: python set_version.py
- name: Upload packages
run: npm publish
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ ghostdriver.log
coverage.xml
.eggs/
db.sqlite3

_version.py
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Johannes Hoppe
Copyright (c) 2022 Johannes Maron

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions django_select2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
"""
from django import get_version

from . import _version

__version__ = _version.version
VERSION = _version.version_tuple

if get_version() < "3.2":
default_app_config = "django_select2.apps.Select2AppConfig"
89 changes: 89 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[build-system]
requires = ["flit_core>=3.2", "flit_scm", "wheel"]
build-backend = "flit_scm:buildapi"

[project]
name = "django-select2"
authors = [
{ name = "Johannes Maron", email = "johannes@maron.family" },
]
readme = "README.rst"
license = { file = "LICENSE" }
keywords = ["Django", "select2", "autocomplete", "typeahead"]
dynamic = ["version", "description"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Environment :: Web Environment",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Topic :: Software Development",
]
requires-python = ">=3.8"
dependencies = [
"django>=3.2",
"django-appconf>=0.6.0"
]

[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
"pytest-django",
"selenium",
]
selenium = [
"selenium",
]
docs = [
"sphinx",
]

[project.urls]
Project-URL = "https://github.com/codingjoe/django-select2"
Changelog = "https://github.com/codingjoe/django-select2/releases"
Source = "https://github.com/codingjoe/django-select2"
Documentation = "https://django-select2.rtfd.io/"
Issue-Tracker = "https://github.com/codingjoe/django-select2/issues"

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

[tool.setuptools_scm]
write_to = "django_select2/_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--cov --tb=short -rxs"
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE = "tests.testapp.settings"

[tool.coverage.run]
source = ["django_select2"]

[tool.coverage.report]
show_missing = true

[tool.isort]
atomic = true
line_length = 88
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
known_first_party = "django_select2, tests"
default_section = "THIRDPARTY"
combine_as_imports = true

[tool.pydocstyle]
add_ignore = "D1"
5 changes: 3 additions & 2 deletions set_version.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
"""Set the version in NPM's package.json to match the git tag."""
import json
import os

from setuptools_scm import get_version

if __name__ == "__main__":
with open("package.json", "r+") as f:
data = json.load(f)
f.seek(0)
data["version"] = os.environ["GITHUB_REF"].rsplit("/")[-1]
data["version"] = get_version(root=".", relative_to=__file__)
json.dump(data, f)
f.truncate()
85 changes: 1 addition & 84 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,87 +1,4 @@
[metadata]
name = django-select2
author = Johannes Hoppe
author_email = info@johanneshoppe.com
description = Select2 option fields for Django
long_description = file: README.rst
url = https://github.com/codingjoe/django-select2
license = MIT
license_file = LICENSE
classifier =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Framework :: Django :: 4.1

[options]
include_package_data = True
packages = django_select2
install_requires =
django>=3.2
django-appconf>=0.6.0
setup_requires =
setuptools_scm

[options.extras_require]
test =
pytest
pytest-cov
pytest-django
selenium
selenium =
selenium
docs =
sphinx

[bdist_wheel]
universal = 1

[bdist_rpm]
requires =
python-django-appconf >= 2.0

[aliases]
test = pytest

[build_sphinx]
source-dir = docs
build-dir = docs/_build

[tool:pytest]
addopts =
tests
--doctest-glob='*.rst'
--doctest-modules
--cov=django_select2
DJANGO_SETTINGS_MODULE=tests.testapp.settings

[flake8]
max-line-length=88
select = C,E,F,W,B,B950
ignore = E203, E501, W503
exclude = venv,.tox,.eggs

[pydocstyle]
add-ignore = D1

[isort]
atomic = true
line_length = 88
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
known_first_party = django_select2, tests
default_section = THIRDPARTY
combine_as_imports = true
ignore = E203, E501, W503, E731
5 changes: 0 additions & 5 deletions setup.py

This file was deleted.