-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 🐛 default_app_config warnings for django>=3.2
- move `setup.py` metadata to `setup.cfg`. - this means the `__version__` string is no longer available. To use the installed versions, you may use `importlib.metadata.version['django_flag_app']` - add `pyproject.toml`. - add `pre-commit`. - add some useful bash scripts. - remove release workflow(I have trust issues with Github). - reduce package size by removing tests, documentation and other potentially unnecessary stuff.
- Loading branch information
1 parent
509b3d5
commit e160921
Showing
12 changed files
with
151 additions
and
140 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: debug-statements | ||
- repo: https://github.com/mgedmin/check-manifest | ||
rev: "0.46" | ||
hooks: | ||
- id: check-manifest | ||
args: [--no-build-isolation] | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 3.8.4 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.7.0 | ||
hooks: | ||
- id: rst-backticks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/bash | ||
set -euxo pipefail | ||
|
||
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u abhiabhi94 -p django-flag-app | ||
pandoc -o CHANGELOG.rst CHANGELOG.md | ||
rm CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
echo "----------Releasing $(python setup.py --version) --------------" | ||
|
||
echo -e "\n------------- Upgrading dependecies ---------------------\n" | ||
python -m pip install -U pip | ||
python -m pip install -U setuptools twine wheel | ||
|
||
echo -e "\n------------- Building Package -----------------------\n" | ||
python setup.py sdist bdist_wheel | ||
|
||
echo -e "\n------------- Verifying Package ----------------------\n" | ||
twine check dist/* | ||
|
||
echo -e "\n------------- Publishing Package ----------------------\n" | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
recursive-include flag *.py | ||
recursive-include flag/static * | ||
recursive-include flag/templates * | ||
recursive-include docs * | ||
global-exclude *.py[cod] | ||
prune __pycache__ | ||
include LICENSE | ||
include README.rst | ||
include tox.ini manage.py | ||
recursive-include tests *.py | ||
include pyproject.toml | ||
include CHANGELOG.rst | ||
recursive-include flag/locale * | ||
recursive-include flag/templates * | ||
recursive-include flag/static * | ||
prune testapp | ||
prune tests | ||
prune docs | ||
prune .scripts | ||
exclude tox.ini | ||
exclude .pre-commit-config.yaml | ||
exclude codecov.yml | ||
exclude manage.py | ||
exclude CONTRIBUTING.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
VERSION = (1, 1, 0) | ||
import django | ||
|
||
|
||
def _get_version(version): | ||
if len(version) > 2: | ||
str_version = "%s.%s.%s" % version[:3] | ||
else: | ||
str_version = "%s.%s" % version[:2] | ||
|
||
return str_version | ||
|
||
|
||
__version__ = _get_version(VERSION) | ||
|
||
|
||
default_app_config = 'flag.apps.FlagConfig' | ||
if django.VERSION < (3, 2): | ||
default_app_config = 'flag.apps.FlagConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,2 @@ | ||
import codecs | ||
import os | ||
import setuptools | ||
import importlib | ||
|
||
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
def get_version(): | ||
return importlib.import_module('flag').__version__ | ||
|
||
|
||
def read(rel_path): | ||
here = os.path.abspath(os.path.dirname(__file__)) | ||
# intentionally *not* adding an encoding option to open, See: | ||
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 | ||
with codecs.open(os.path.join(here, rel_path), 'r') as fp: | ||
return fp.read() | ||
|
||
|
||
setuptools.setup( | ||
name='django-flag-app', | ||
version=get_version(), | ||
author='Abhyudai', | ||
author_email='', | ||
description='A pluggable django application that adds the ability for users to flag(or report) your models', | ||
long_description=read('README.rst'), | ||
url='https://github.com/abhiabhi94/django-flag-app', | ||
project_urls={ | ||
'Documentation': 'https://django-flag-app.readthedocs.io', | ||
'Source Code': 'https://github.com/abhiabhi94/django-flag-app', | ||
}, | ||
packages=setuptools.find_packages(exclude=['docs', 'test*']), | ||
include_package_data=True, | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: 2.1', | ||
'Framework :: Django :: 2.2', | ||
'Framework :: Django :: 3.0', | ||
'Framework :: Django :: 3.1', | ||
'Framework :: Django :: 3.2', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
], | ||
python_requires='>=3.6', | ||
install_requires=['django'], | ||
keywords='django flag report moderate', | ||
zip_safe=False, | ||
) | ||
from setuptools import setup | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""This module aims to test the compatibility of the project with different django versions""" | ||
import django | ||
import pytest | ||
|
||
import flag | ||
|
||
|
||
class TestDefaultAppConfigDefinition: | ||
@pytest.mark.skipif(django.VERSION < (3, 2), reason='app config is automatically defined by django') | ||
def test_app_config_not_defined(self): | ||
assert hasattr(flag, 'default_app_config') is False | ||
|
||
@pytest.mark.skipif(django.VERSION >= (3, 2), reason='app config is not automatically defined by django') | ||
def test_app_config_defined(self): | ||
assert hasattr(flag, 'default_app_config') is True |
This file was deleted.
Oops, something went wrong.