mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-25 11:42:54 +03:00
Set up setup.py commands for auto formatting and linting
This commit is contained in:
parent
eb2d166dbe
commit
4ee1a5f487
104
setup.py
104
setup.py
@ -1,5 +1,5 @@
|
|||||||
import os
|
|
||||||
import distutils.cmd
|
import distutils.cmd
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
@ -28,9 +28,12 @@ def create_command(text, commands):
|
|||||||
return CustomCommand
|
return CustomCommand
|
||||||
|
|
||||||
|
|
||||||
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as readme:
|
with open(
|
||||||
|
os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
|
||||||
|
) as readme:
|
||||||
README = readme.read()
|
README = readme.read()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-localized-fields',
|
name='django-localized-fields',
|
||||||
version='6.0b1',
|
version='6.0b1',
|
||||||
@ -43,26 +46,89 @@ setup(
|
|||||||
author='Sector Labs',
|
author='Sector Labs',
|
||||||
author_email='open-source@sectorlabs.ro',
|
author_email='open-source@sectorlabs.ro',
|
||||||
keywords=['django', 'localized', 'language', 'models', 'fields'],
|
keywords=['django', 'localized', 'language', 'models', 'fields'],
|
||||||
install_requires=[
|
|
||||||
'django-postgres-extra>=2.0a7',
|
|
||||||
'Django>=2.0',
|
|
||||||
'deprecation==2.0.7'
|
|
||||||
],
|
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Environment :: Web Environment',
|
"Environment :: Web Environment",
|
||||||
'Framework :: Django',
|
"Framework :: Django",
|
||||||
'Intended Audience :: Developers',
|
"Intended Audience :: Developers",
|
||||||
'License :: OSI Approved :: MIT License',
|
"License :: OSI Approved :: MIT License",
|
||||||
'Operating System :: OS Independent',
|
"Operating System :: OS Independent",
|
||||||
'Programming Language :: Python',
|
"Programming Language :: Python",
|
||||||
'Programming Language :: Python :: 3.5',
|
"Programming Language :: Python :: 3.5",
|
||||||
'Topic :: Internet :: WWW/HTTP',
|
"Topic :: Internet :: WWW/HTTP",
|
||||||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
||||||
],
|
],
|
||||||
cmdclass={
|
cmdclass={
|
||||||
'lint': create_command(
|
"lint": create_command(
|
||||||
'Lints the code',
|
"Lints the code",
|
||||||
[['flake8', 'setup.py', 'localized_fields', 'tests']],
|
[
|
||||||
|
["flake8", "setup.py", "localized_fields", "tests"],
|
||||||
|
["pycodestyle", "setup.py", "localized_fields", "tests"],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"lint_fix": create_command(
|
||||||
|
"Lints the code",
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"autoflake",
|
||||||
|
"--remove-all-unused-imports",
|
||||||
|
"-i",
|
||||||
|
"-r",
|
||||||
|
"setup.py",
|
||||||
|
"localized_fields",
|
||||||
|
"tests",
|
||||||
|
],
|
||||||
|
["autopep8", "-i", "-r", "setup.py", "localized_fields", "tests"],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"format": create_command(
|
||||||
|
"Formats the code", [["black", "setup.py", "localized_fields", "tests"]]
|
||||||
|
),
|
||||||
|
"format_verify": create_command(
|
||||||
|
"Checks if the code is auto-formatted",
|
||||||
|
[["black", "--check", "setup.py", "localized_fields", "tests"]],
|
||||||
|
),
|
||||||
|
"format_docstrings": create_command(
|
||||||
|
"Auto-formats doc strings", [["docformatter", "-r", "-i", "."]]
|
||||||
|
),
|
||||||
|
"format_docstrings_verify": create_command(
|
||||||
|
"Verifies that doc strings are properly formatted",
|
||||||
|
[["docformatter", "-r", "-c", "."]],
|
||||||
|
),
|
||||||
|
"sort_imports": create_command(
|
||||||
|
"Automatically sorts imports",
|
||||||
|
[
|
||||||
|
["isort", "setup.py"],
|
||||||
|
["isort", "-rc", "localized_fields"],
|
||||||
|
["isort", "-rc", "tests"],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"sort_imports_verify": create_command(
|
||||||
|
"Verifies all imports are properly sorted.",
|
||||||
|
[
|
||||||
|
["isort", "-c", "setup.py"],
|
||||||
|
["isort", "-c", "-rc", "localized_fields"],
|
||||||
|
["isort", "-c", "-rc", "tests"],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"fix": create_command(
|
||||||
|
"Automatically format code and fix linting errors",
|
||||||
|
[
|
||||||
|
["python", "setup.py", "format"],
|
||||||
|
["python", "setup.py", "format_docstrings"],
|
||||||
|
["python", "setup.py", "sort_imports"],
|
||||||
|
["python", "setup.py", "lint_fix"],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
"verify": create_command(
|
||||||
|
"Verifies whether the code is auto-formatted and has no linting errors",
|
||||||
|
[
|
||||||
|
[
|
||||||
|
["python", "setup.py", "format_verify"],
|
||||||
|
["python", "setup.py", "format_docstrings_verify"],
|
||||||
|
["python", "setup.py", "sort_imports_verify"],
|
||||||
|
["python", "setup.py", "lint"],
|
||||||
|
]
|
||||||
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user