Skip to content

Commit

Permalink
Merge pull request #20 from infogrid-io/update
Browse files Browse the repository at this point in the history
Fix deprecation warnings, update tooling
  • Loading branch information
jorgenader authored Sep 21, 2022
2 parents 74427f5 + b348277 commit aad130b
Show file tree
Hide file tree
Showing 33 changed files with 2,223 additions and 331 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
branch = True
source =
tg_utils/

[html]
directory = htmlcov

40 changes: 40 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Add poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.1.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install
- name: Test with tox
run: |
poetry run make test-all
37 changes: 37 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Add poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.1.13"
- name: Install dependencies
run: poetry install
- name: Build and publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
86 changes: 86 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
uses:
- django

ignore-paths:
- docs

ignore-patterns:
- htmlcov/

pycodestyle:
enable:
# This is the current list of error and warning codes from:
# https://github.com/PyCQA/pep8-naming
# https://pep8.readthedocs.io/en/latest/intro.html?highlight=E731

# code sample message

# Note some are not needed when using black e.g:
# E1/W1 - indentation
# E2/W2 - whitespace
# E3/W3 - blank line
# E5/W5 - line length/breaks

# E4 Import
# Not applicable when using isort
# - E401 # multiple imports on one line

# handled by pylint: wrong-import-position
# - E402 # module level import not at top of file

# E7 Statement

# Not applicable with black:
# - E701 # multiple statements on one line (colon)
# - E702 # multiple statements on one line (semicolon)
# - E703 # statement ends with a semicolon
# - E704 # (*) multiple statements on one line (def)

- E711 # (^) comparison to None should be ‘if cond is None:’
- E712 # (^) comparison to True should be ‘if cond is True:’ or ‘if cond:’
- E713 # test for membership should be ‘not in’
- E714 # test for object identity should be ‘is not’
- E721 # (^) do not compare types, use ‘isinstance()’
- E722 # do not use bare except, specify exception instead
- E731 # do not assign a lambda expression, use a def
- E741 # do not use variables named ‘l’, ‘O’, or ‘I’
- E742 # do not define classes named ‘l’, ‘O’, or ‘I’
- E743 # do not define functions named ‘l’, ‘O’, or ‘I’

# E9 Runtime
- E901 # SyntaxError or IndentationError
- E902 # IOError

# W6 Deprecation warning
- W601 # .has_key() is deprecated, use ‘in’
- W602 # deprecated form of raising exception
- W603 # ‘<>’ is deprecated, use ‘!=’
- W604 # backticks are deprecated, use ‘repr()’
- W605 # invalid escape sequence ‘x’
- W606 # ‘async’ and ‘await’ are reserved keywords starting with Python 3.7

# N8 PEP-8 Naming Conventions
- N801 # class names should use CapWords convention
- N802 # function name should be lowercase
- N803 # argument name should be lowercase
- N804 # first argument of a classmethod should be named 'cls'
- N805 # first argument of a method should be named 'self'
- N806 # variable in function should be lowercase
- N807 # function name should not start or end with '__'

- N811 # constant imported as non constant
- N812 # lowercase imported as non lowercase
- N813 # camelcase imported as lowercase
- N814 # camelcase imported as constant
- N815 # mixedCase variable in class scope
- N816 # mixedCase variable in global scope
options:
max-line-length: 140

pylint:
disable:
- unused-argument
- raise-missing-from
options:
max-line-length: 140
django-settings-module: test.django_settings
59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.

62 changes: 40 additions & 22 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,31 @@ Ready to contribute? Here's how to set up `tg-utils` for local development.

$ git clone [email protected]:your_name_here/tg-utils.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
3. [Install poetry](https://python-poetry.org/docs/#installation)

$ mkvirtualenv tg-utils
$ cd tg-utils/
$ python setup.py develop
4. Install dependencies::

4. Create a branch for local development::
$ poetry install

$ git checkout -b name-of-your-bugfix-or-feature
5. Create a branch for local development::

Now you can make your changes locally.
$ git checkout -b name-of-your-bugfix-or-feature

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
Now you can make your changes locally.

$ flake8 tg_utils tests
$ python setup.py test
$ tox
6. When you're done making changes, check that your changes pass linters and the tests, including testing other Python versions with tox::

To get flake8 and tox, just pip install them into your virtualenv.
$ poetry run make lint
$ poetry run make test
$ poetry run make test-all

6. Commit your changes and push your branch to GitHub::
7. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.
8. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------
Expand All @@ -100,14 +98,34 @@ Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.4, 3.5, 3.6 and 3.7 and for PyPy. Check
https://travis-ci.org/thorgate/tg-utils/pull_requests
and make sure that the tests pass for all supported Python versions.
feature to the list in README.rst. You should also update the documentation
source files via::

poetry run make docs

3. If the pull request modifies/adds translations don't forget to run::

poetry run make update-messages

4. The pull request should work for Python 3.7, 3.8, 3.9 and 3.10. Check
https://github.com/thorgate/tg-utils/actions and make sure that the tests
pass for all supported Python versions.

Tips
----

Run full test suite via tox (all python and django version combinations)::

poetry run make test-all

To run a subset of tests::

$ python -m unittest tests.test_tg_utils
poetry run pytest tests.test_tg_utils

Update documentation source files and generate it::

poetry run make docs

To see all make commands::

poetry run make help
20 changes: 20 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
History
=======

1.0.0 (2022-07-??)
------------------

* Drop support for Django < 2.2
* Drop support for Python < 3.7
* Add support for Django 3.1, 3.2, and 4.0
* Add support for Python 3.8, 3.9, and 3.10
* Replace Travis CI with GitHub Actions
* Replace Setuptools with Poetry
* Remove support for universal wheels
* Fix deprecation warning for `ugettext_lazy()`
* Fix deprecation warning for `default_app_config`
* Fix deprecation warning for `Signal.providing_args`
* Remove deprecated `YuglifyCssFilter` and `YuglifyJsFilter` compression filters
* Replace `django.conf.urls.url()` with `django.urls.path()`
* Remove obsolete encoding magic comment
* Remove obsolete unicode string prefix
* Remove obsolete inheritance from `object`
* Make use of f-strings in place of `str.format()` and `%`-formatting

0.7.7 (2020-05-20)
------------------

Expand Down
Loading

0 comments on commit aad130b

Please sign in to comment.