Skip to content

Commit 15790a3

Browse files
committed
Update packaging to pyproject.toml
1 parent 10d5e8d commit 15790a3

File tree

10 files changed

+105
-95
lines changed

10 files changed

+105
-95
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ insert_final_newline = true
1010
charset = utf-8
1111
end_of_line = lf
1212

13-
[*.{json,yml,yaml,js,jsx}]
13+
[*.{json,yml,yaml,js,jsx,toml}]
1414
indent_size = 2
1515

1616
[LICENSE]

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- uses: actions/setup-python@v4
3535
with:
3636
python-version: "3.x"
37-
- run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
38-
- run: python setup.py sdist bdist_wheel
37+
- run: python -m pip install --upgrade pip build wheel twine readme-renderer
38+
- run: python -m build --sdist --wheel
3939
- run: python -m twine check dist/*
4040

4141
standardjs:

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- uses: actions/setup-python@v4
2929
with:
3030
python-version: "3.x"
31+
- run: python -m pip install --upgrade setuptools_scm
3132
- run: python set_version.py
3233
- name: Upload packages
3334
run: npm publish

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ ghostdriver.log
2323
coverage.xml
2424
.eggs/
2525
db.sqlite3
26+
27+
_version.py

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Johannes Hoppe
3+
Copyright (c) 2022 Johannes Maron
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

django_select2/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@
99
"""
1010
from django import get_version
1111

12+
from . import _version
13+
14+
__version__ = _version.version
15+
VERSION = _version.version_tuple
16+
1217
if get_version() < "3.2":
1318
default_app_config = "django_select2.apps.Select2AppConfig"

pyproject.toml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[build-system]
2+
requires = ["flit_core>=3.2", "flit_scm", "wheel"]
3+
build-backend = "flit_scm:buildapi"
4+
5+
[project]
6+
name = "django-select2"
7+
authors = [
8+
{ name = "Johannes Maron", email = "johannes@maron.family" },
9+
]
10+
readme = "README.rst"
11+
license = { file = "LICENSE" }
12+
keywords = ["Django", "select2", "autocomplete", "typeahead"]
13+
dynamic = ["version", "description"]
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"License :: OSI Approved :: MIT License",
17+
"Intended Audience :: Developers",
18+
"Environment :: Web Environment",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Framework :: Django",
27+
"Framework :: Django :: 3.2",
28+
"Framework :: Django :: 4.0",
29+
"Framework :: Django :: 4.1",
30+
"Topic :: Software Development",
31+
]
32+
requires-python = ">=3.8"
33+
dependencies = [
34+
"django>=3.2",
35+
"django-appconf>=0.6.0"
36+
]
37+
38+
[project.optional-dependencies]
39+
test = [
40+
"pytest",
41+
"pytest-cov",
42+
"pytest-django",
43+
"selenium",
44+
]
45+
selenium = [
46+
"selenium",
47+
]
48+
docs = [
49+
"sphinx",
50+
]
51+
52+
[project.urls]
53+
Project-URL = "https://github.com/codingjoe/django-select2"
54+
Changelog = "https://github.com/codingjoe/django-select2/releases"
55+
Source = "https://github.com/codingjoe/django-select2"
56+
Documentation = "https://django-select2.rtfd.io/"
57+
Issue-Tracker = "https://github.com/codingjoe/django-select2/issues"
58+
59+
[tool.flit.module]
60+
name = "django_select2"
61+
62+
[tool.setuptools_scm]
63+
write_to = "django_select2/_version.py"
64+
65+
[tool.pytest.ini_options]
66+
minversion = "6.0"
67+
addopts = "--cov --tb=short -rxs"
68+
testpaths = ["tests"]
69+
DJANGO_SETTINGS_MODULE = "tests.testapp.settings"
70+
71+
[tool.coverage.run]
72+
source = ["django_select2"]
73+
74+
[tool.coverage.report]
75+
show_missing = true
76+
77+
[tool.isort]
78+
atomic = true
79+
line_length = 88
80+
multi_line_output = 3
81+
include_trailing_comma = true
82+
force_grid_wrap = 0
83+
use_parentheses = true
84+
known_first_party = "django_select2, tests"
85+
default_section = "THIRDPARTY"
86+
combine_as_imports = true
87+
88+
[tool.pydocstyle]
89+
add_ignore = "D1"

set_version.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env python3
22
"""Set the version in NPM's package.json to match the git tag."""
33
import json
4-
import os
4+
5+
from setuptools_scm import get_version
56

67
if __name__ == "__main__":
78
with open("package.json", "r+") as f:
89
data = json.load(f)
910
f.seek(0)
10-
data["version"] = os.environ["GITHUB_REF"].rsplit("/")[-1]
11+
data["version"] = get_version(root=".", relative_to=__file__)
1112
json.dump(data, f)
1213
f.truncate()

setup.cfg

+1-84
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,4 @@
1-
[metadata]
2-
name = django-select2
3-
author = Johannes Hoppe
4-
author_email = info@johanneshoppe.com
5-
description = Select2 option fields for Django
6-
long_description = file: README.rst
7-
url = https://github.com/codingjoe/django-select2
8-
license = MIT
9-
license_file = LICENSE
10-
classifier =
11-
Development Status :: 5 - Production/Stable
12-
Environment :: Web Environment
13-
Intended Audience :: Developers
14-
License :: OSI Approved :: Apache Software License
15-
Operating System :: OS Independent
16-
Programming Language :: Python
17-
Programming Language :: Python :: 3
18-
Programming Language :: Python :: 3 :: Only
19-
Programming Language :: Python :: 3.8
20-
Programming Language :: Python :: 3.9
21-
Programming Language :: Python :: 3.10
22-
Framework :: Django
23-
Framework :: Django :: 3.2
24-
Framework :: Django :: 4.0
25-
Framework :: Django :: 4.1
26-
27-
[options]
28-
include_package_data = True
29-
packages = django_select2
30-
install_requires =
31-
django>=3.2
32-
django-appconf>=0.6.0
33-
setup_requires =
34-
setuptools_scm
35-
36-
[options.extras_require]
37-
test =
38-
pytest
39-
pytest-cov
40-
pytest-django
41-
selenium
42-
selenium =
43-
selenium
44-
docs =
45-
sphinx
46-
47-
[bdist_wheel]
48-
universal = 1
49-
50-
[bdist_rpm]
51-
requires =
52-
python-django-appconf >= 2.0
53-
54-
[aliases]
55-
test = pytest
56-
57-
[build_sphinx]
58-
source-dir = docs
59-
build-dir = docs/_build
60-
61-
[tool:pytest]
62-
addopts =
63-
tests
64-
--doctest-glob='*.rst'
65-
--doctest-modules
66-
--cov=django_select2
67-
DJANGO_SETTINGS_MODULE=tests.testapp.settings
68-
691
[flake8]
702
max-line-length=88
713
select = C,E,F,W,B,B950
72-
ignore = E203, E501, W503
73-
exclude = venv,.tox,.eggs
74-
75-
[pydocstyle]
76-
add-ignore = D1
77-
78-
[isort]
79-
atomic = true
80-
line_length = 88
81-
multi_line_output = 3
82-
include_trailing_comma = True
83-
force_grid_wrap = 0
84-
use_parentheses = True
85-
known_first_party = django_select2, tests
86-
default_section = THIRDPARTY
87-
combine_as_imports = true
4+
ignore = E203, E501, W503, E731

setup.py

-5
This file was deleted.

0 commit comments

Comments
 (0)