Skip to content

Commit 5c0f733

Browse files
committed
Update package build tools
1 parent 0f96fb3 commit 5c0f733

File tree

10 files changed

+101
-104
lines changed

10 files changed

+101
-104
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ charset = utf-8
1111
end_of_line = lf
1212
max_line_length = 88
1313

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

1717
[LICENSE]

.github/workflows/ci.yml

+10-14
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/setup-python@v3
15-
- run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
1615
- uses: actions/checkout@v3
17-
- run: python setup.py sdist bdist_wheel
16+
- run: python -m pip install --upgrade pip build wheel twine
17+
- run: python -m build --sdist --wheel
1818
- run: python -m twine check dist/*
1919

2020
standardjs:
@@ -66,13 +66,11 @@ jobs:
6666
strategy:
6767
matrix:
6868
python-version:
69-
- "3.7"
70-
- "3.8"
7169
- "3.9"
70+
- "3.10"
7271
django-version:
73-
- "2.2"
74-
- "3.1"
7572
- "3.2"
73+
- "4.0"
7674
steps:
7775
- uses: actions/checkout@v3
7876
- name: Set up Python ${{ matrix.python-version }}
@@ -89,12 +87,10 @@ jobs:
8987
mkdir bin
9088
curl -qO "https://chromedriver.storage.googleapis.com/$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip"
9189
unzip chromedriver_linux64.zip -d bin
92-
- name: Upgrade Python setuptools
93-
run: python -m pip install --upgrade pip setuptools wheel codecov
94-
- name: Install Django version ${{ matrix.django-version }}
95-
run: python -m pip install django~=${{ matrix.django-version }}
96-
- name: Run tests
97-
run: PATH=$PATH:$(pwd)/bin python setup.py test
98-
- run: codecov
90+
91+
- run: python -m pip install .[test] codecov
92+
- run: python -m pip install django~=${{ matrix.django-version }}
93+
- run: python -m pytest
9994
env:
100-
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
95+
PATH: $PATH:$(pwd)/bin
96+
- run: codecov

.github/workflows/release.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v3
1313
- uses: actions/setup-python@v3
14-
- name: Install Python dependencies
15-
run: python -m pip install --upgrade pip setuptools wheel twine
14+
- run: python -m pip install --upgrade pip build wheel twine
1615
- uses: actions/setup-node@v3
1716
- name: Install Node dependencies
1817
run: npm ci
1918
- name: Minify JavaScript files
20-
run: npm run-script minify
21-
- name: Build dist packages
22-
run: python setup.py sdist bdist_wheel
23-
- name: Upload packages
24-
run: python -m twine upload dist/*
19+
run: npm run minify
20+
- run: python -m build --sdist --wheel
21+
- run: python -m twine upload dist/*
2522
env:
2623
TWINE_USERNAME: __token__
2724
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var/
2222
*.egg-info/
2323
.installed.cfg
2424
*.egg
25+
_version.py
2526

2627
# PyInstaller
2728
# Usually these files are written by a python script from a template

linter-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ bandit==1.7.4
22
black==22.1.0
33
flake8==4.0.1
44
isort==5.10.1
5-
pydocstyle==6.1.1
5+
pydocstyle[toml]==6.1.1

pyproject.toml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[build-system]
2+
requires = ["flit_core>=3.2", "flit_scm", "wheel"]
3+
build-backend = "flit_scm:buildapi"
4+
5+
[project]
6+
name = "django-s3file"
7+
authors = [
8+
{ name = "Johannes Maron", email = "[email protected]" }
9+
]
10+
readme = "README.rst"
11+
license = { file = "LICENSE" }
12+
dynamic = ["version", "description"]
13+
classifiers = [
14+
"Development Status :: 6 - Mature",
15+
"Environment :: Web Environment",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python",
20+
"Programming Language :: JavaScript",
21+
"Topic :: Software Development",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3 :: Only",
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+
]
30+
requires-python = ">=3.9"
31+
dependencies = [
32+
"django>=2.0",
33+
"django-storages",
34+
"boto3",
35+
]
36+
37+
[project.optional-dependencies]
38+
test = [
39+
"pytest >=2.7.3",
40+
"pytest-cov",
41+
"pytest-django",
42+
"selenium",
43+
]
44+
45+
[project.urls]
46+
Project-URL = "https://github.com/codingjoe/django-s3file"
47+
48+
[tool.flit.module]
49+
name = "s3file"
50+
51+
[tool.setuptools_scm]
52+
write_to = "s3file/_version.py"
53+
54+
[tool.pytest.ini_options]
55+
minversion = "6.0"
56+
addopts = "--cov=s3file --tb=short -rxs"
57+
testpaths = [
58+
"tests",
59+
]
60+
DJANGO_SETTINGS_MODULE = "tests.testapp.settings"
61+
62+
[tool.isort]
63+
atomic = true
64+
line_length = 88
65+
known_first_party = "s3file, tests"
66+
include_trailing_comma = true
67+
default_section = "THIRDPARTY"
68+
combine_as_imports = true
69+
70+
[tool.pydocstyle]
71+
add_ignore = "D1"

s3file/__init__.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
default_app_config = "s3file.apps.S3FileConfig"
1+
"""A lightweight file uploader input for Django and Amazon S3."""
2+
3+
import django
4+
5+
from . import _version
6+
7+
__version__ = _version.version
8+
VERSION = _version.version_tuple
9+
10+
if django.VERSION < (4, 0):
11+
default_app_config = "s3file.apps.S3FileConfig"

setup.cfg

-74
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,4 @@
1-
[metadata]
2-
name = django-s3file
3-
author = Johannes Hoppe
4-
author_email = [email protected]
5-
description = A lightweight file uploader input for Django and Amazon S3
6-
long_description = file: README.rst
7-
long_description_content_type = text/x-rst
8-
url = https://github.com/codingjoe/django-s3file
9-
license = MIT
10-
license_files = LICENSE
11-
classifier =
12-
Development Status :: 6 - Mature
13-
Environment :: Web Environment
14-
Framework :: Django
15-
Intended Audience :: Developers
16-
License :: OSI Approved :: MIT License
17-
Operating System :: OS Independent
18-
Programming Language :: Python
19-
Programming Language :: JavaScript
20-
Topic :: Software Development
21-
Programming Language :: Python :: 3
22-
Programming Language :: Python :: 3 :: Only
23-
Programming Language :: Python :: 3.6
24-
Programming Language :: Python :: 3.7
25-
Programming Language :: Python :: 3.8
26-
Programming Language :: Python :: 3.9
27-
Framework :: Django
28-
Framework :: Django :: 2.2
29-
Framework :: Django :: 3.1
30-
31-
[options]
32-
include_package_data = True
33-
packages = find:
34-
install_requires =
35-
django>=2.0
36-
django-storages
37-
boto3
38-
setup_requires =
39-
setuptools_scm
40-
pytest-runner
41-
tests_require =
42-
pytest
43-
pytest-cov
44-
pytest-django
45-
selenium
46-
47-
[options.package_data]
48-
* = *.txt, *.rst, *.html, *.po
49-
50-
[options.packages.find]
51-
exclude =
52-
tests
53-
54-
[bdist_wheel]
55-
universal = 1
56-
57-
[aliases]
58-
test = pytest
59-
60-
[tool:pytest]
61-
addopts = --cov=s3file --cov-report xml --tb=short -rxs
62-
DJANGO_SETTINGS_MODULE=tests.testapp.settings
63-
641
[flake8]
652
max-line-length=88
663
select = C,E,F,W,B,B950
674
ignore = E203, E501, W503, E731
68-
69-
[pydocstyle]
70-
add_ignore = D1
71-
72-
[isort]
73-
atomic = true
74-
line_length = 88
75-
known_first_party = s3file, tests
76-
include_trailing_comma = True
77-
default_section=THIRDPARTY
78-
combine_as_imports = true

setup.py

-4
This file was deleted.

tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
from django.core.files.base import ContentFile
6-
from django.utils.encoding import force_text
6+
from django.utils.encoding import force_str
77
from selenium import webdriver
88
from selenium.common.exceptions import WebDriverException
99

@@ -15,7 +15,7 @@ def driver():
1515
try:
1616
b = webdriver.Chrome(options=chrome_options)
1717
except WebDriverException as e:
18-
pytest.skip(force_text(e))
18+
pytest.skip(force_str(e))
1919
else:
2020
yield b
2121
b.quit()

0 commit comments

Comments
 (0)