Skip to content

Commit

Permalink
Update package build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Mar 19, 2022
1 parent 0f96fb3 commit e23fbfe
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ charset = utf-8
end_of_line = lf
max_line_length = 88

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

[LICENSE]
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v3
- run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer
- uses: actions/checkout@v3
- run: python setup.py sdist bdist_wheel
- run: python -m pip install --upgrade pip build wheel twine
- run: python -m build --sdist --wheel
- run: python -m twine check dist/*

standardjs:
Expand Down Expand Up @@ -66,13 +66,11 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
django-version:
- "2.2"
- "3.1"
- "3.2"
- "4.0"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -89,12 +87,10 @@ jobs:
mkdir bin
curl -qO "https://chromedriver.storage.googleapis.com/$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip -d bin
- name: Upgrade Python setuptools
run: python -m pip install --upgrade pip setuptools wheel codecov
- name: Install Django version ${{ matrix.django-version }}
run: python -m pip install django~=${{ matrix.django-version }}
- name: Run tests
run: PATH=$PATH:$(pwd)/bin python setup.py test
- run: codecov
- run: python -m pip install .[test]
- run: python -m pip install django~=${{ matrix.django-version }}
- run: python -m pyteset
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
PATH: $PATH:$(pwd)/bin
- run: codecov
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel twine
- run: python -m pip install --upgrade pip build wheel twine
- uses: actions/setup-node@v3
- name: Install Node dependencies
run: npm ci
- name: Minify JavaScript files
run: npm run-script minify
- name: Build dist packages
run: python setup.py sdist bdist_wheel
- name: Upload packages
run: python -m twine upload dist/*
run: npm run minify
- run: python -m build --sdist --wheel
- run: python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
2 changes: 1 addition & 1 deletion linter-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bandit==1.7.4
black==22.1.0
flake8==4.0.1
isort==5.10.1
pydocstyle==6.1.1
pydocstyle[toml]==6.1.1
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[build-system]
requires = ["flit_core>=3.2", "flit_scm", "wheel"]
build-backend = "flit_scm:buildapi"

[project]
name = "django-s3file"
authors = [
{ name = "Johannes Maron", email = "[email protected]" }
]
readme = "README.rst"
license = { file = "LICENSE" }
dynamic = ["version", "description"]
classifiers = [
"Development Status :: 6 - Mature",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: JavaScript",
"Topic :: Software Development",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
]
requires-python = ">=3.9"
dependencies = [
"django>=2.0",
"django-storages",
"boto3",
]

[project.optional-dependencies]
test = [
"pytest >=2.7.3",
"pytest-cov",
"pytest-django",
"selenium",
]

[project.urls]
Project-URL = "https://github.com/codingjoe/django-s3file"

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

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

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

[tool.isort]
atomic = true
line_length = 88
known_first_party = "s3file, tests"
include_trailing_comma = true
default_section = "THIRDPARTY"
combine_as_imports = true

[tool.pydocstyle]
add_ignore = "D1"
12 changes: 11 additions & 1 deletion s3file/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
default_app_config = "s3file.apps.S3FileConfig"
"""A lightweight file uploader input for Django and Amazon S3."""

import django

from . import _version

__version__ = _version.version
VERSION = _version.version_tuple

if django.VERSION < (4, 0):
default_app_config = "s3file.apps.S3FileConfig"
74 changes: 2 additions & 72 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,78 +1,8 @@
[metadata]
name = django-s3file
author = Johannes Hoppe
author_email = [email protected]
description = A lightweight file uploader input for Django and Amazon S3
long_description = file: README.rst
long_description_content_type = text/x-rst
url = https://github.com/codingjoe/django-s3file
license = MIT
license_files = LICENSE
classifier =
Development Status :: 6 - Mature
Environment :: Web Environment
Framework :: Django
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: JavaScript
Topic :: Software Development
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.1

[options]
include_package_data = True
packages = find:
install_requires =
django>=2.0
django-storages
boto3
setup_requires =
setuptools_scm
pytest-runner
tests_require =
pytest
pytest-cov
pytest-django
selenium

[options.package_data]
* = *.txt, *.rst, *.html, *.po

[options.packages.find]
exclude =
tests

[bdist_wheel]
universal = 1

[aliases]
test = pytest

[tool:pytest]
addopts = --cov=s3file --cov-report xml --tb=short -rxs
DJANGO_SETTINGS_MODULE=tests.testapp.settings

[flake8]
max-line-length=88
select = C,E,F,W,B,B950
ignore = E203, E501, W503, E731

[pydocstyle]
add_ignore = D1

[isort]
atomic = true
line_length = 88
known_first_party = s3file, tests
include_trailing_comma = True
default_section=THIRDPARTY
combine_as_imports = true


4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
from django.core.files.base import ContentFile
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from selenium import webdriver
from selenium.common.exceptions import WebDriverException

Expand All @@ -15,7 +15,7 @@ def driver():
try:
b = webdriver.Chrome(options=chrome_options)
except WebDriverException as e:
pytest.skip(force_text(e))
pytest.skip(force_str(e))
else:
yield b
b.quit()
Expand Down

0 comments on commit e23fbfe

Please sign in to comment.