Skip to content

Commit aeaa7d3

Browse files
authored
Refactor packaging (#131)
* Repackage using metadata in setup.cfg * Use bump2version * Add towncrier support * Move tasks to tox * Fix code formatting * Add more tests to travis * Add pull request template * Update contribution guide
1 parent e0e8ac0 commit aeaa7d3

File tree

14 files changed

+287
-146
lines changed

14 files changed

+287
-146
lines changed

.github/pull_request_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Description
2+
3+
Describe:
4+
5+
* Content of the pull request
6+
* Feature added / Problem fixed
7+
8+
## References
9+
10+
Provide any github issue fixed (as in ``Fix #XYZ``)
11+
12+
# Checklist
13+
14+
* [ ] I have read the [contribution guide](https://django-app-helper.readthedocs.io/en/latest/contributing.html)
15+
* [ ] Code lint checked via `inv lint`
16+
* [ ] ``changes`` file included (see [docs](https://django-app-helper.readthedocs.io/en/latest/contributing.html#pull-request-guidelines))
17+
* [ ] Usage documentation added in case of new features
18+
* [ ] Tests added

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ python:
1212
env:
1313
matrix:
1414
- TOXENV='docs'
15+
- TOXENV='pypi-description'
1516
- TOXENV='pep8'
1617
- TOXENV='isort'
1718
- TOXENV='black'
@@ -27,26 +28,24 @@ env:
2728
- DJANGO='django111' CMS='cms35'
2829
- DJANGO='django111' CMS='cms34'
2930

30-
before_install:
31-
- pip install codecov
3231
after_success:
3332
- codecov
3433
- coveralls
3534

36-
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
3735
install:
38-
- pip install -U setuptools tox>=1.8 coveralls
36+
- pip install -U setuptools tox>=1.8 coveralls codecov
3937
- "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export PYVER=py27; fi"
4038
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PYVER=py35; fi"
4139
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PYVER=py36; fi"
4240
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PYVER=py37; fi"
4341
- "if [[ ${DJANGO}z != 'z' ]]; then export TOXENV=$PYVER-$DJANGO-$CMS; fi"
4442

45-
# command to run tests, e.g. python setup.py test
4643
script: COMMAND='coverage run' tox -e$TOXENV
4744

4845
matrix:
4946
exclude:
47+
- python: 2.7
48+
env: TOXENV='pypi-description'
5049
- python: 2.7
5150
env: TOXENV='docs'
5251
- python: 2.7
@@ -55,6 +54,8 @@ matrix:
5554
env: TOXENV='isort'
5655
- python: 2.7
5756
env: TOXENV='black'
57+
- python: 3.6
58+
env: TOXENV='pypi-description'
5859
- python: 3.6
5960
env: TOXENV='docs'
6061
- python: 3.6
@@ -63,6 +64,8 @@ matrix:
6364
env: TOXENV='isort'
6465
- python: 3.6
6566
env: TOXENV='black'
67+
- python: 3.5
68+
env: TOXENV='pypi-description'
6669
- python: 3.5
6770
env: TOXENV='docs'
6871
- python: 3.5

AUTHORS renamed to AUTHORS.rst

File renamed without changes.

CONTRIBUTING.rst

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Ready to contribute? Here's how to set up ``django-app-helper`` for local develo
6767

6868
$ mkvirtualenv django-app-helper
6969
$ cd django-app-helper/
70-
$ python setup.py develop
70+
$ pip install -r requirements-test.txt
7171

7272
4. Create a branch for local development::
7373

@@ -78,11 +78,9 @@ Now you can make your changes locally.
7878
5. When you're done making changes, check that your changes pass flake8 and the
7979
tests, including testing other Python versions with tox::
8080

81-
$ make lint
82-
$ python setup.py test
8381
$ tox
8482

85-
To get tox, just pip install them into your virtualenv.
83+
To get tox, pip install them into your virtualenv.
8684

8785
6. Commit your changes and push your branch to GitHub::
8886

@@ -98,9 +96,26 @@ Pull Request Guidelines
9896
Before you submit a pull request, check that it meets these guidelines:
9997

10098
1. The pull request should include tests.
101-
2. If the pull request adds functionality, the docs should be updated. Put
102-
your new functionality into a function with a docstring, and add the
103-
feature to the list in README.rst.
104-
3. The pull request should work for all python versions declared in tox.ini.
105-
Check https://travis-ci.org/nephila/django-app-helper/pull_requests
106-
and make sure that the tests pass for all supported Python versions.
99+
2. If the pull request adds functionality, the docs should be updated.
100+
Documentation must be added in ``docs`` directory, and must include usage
101+
information for the end user.
102+
In case of public API method, add extended docstrings with full parameters
103+
description and usage example.
104+
3. Add a changes file in ``changes`` directory describing the contribution in
105+
one line. It will be added automatically to the history file upon release.
106+
File must be named as ``<issue-number>.<type>`` with type being:
107+
108+
* ``.feature``: For new features.
109+
* ``.bugfix``: For bug fixes.
110+
* ``.doc``: For documentation improvement.
111+
* ``.removal``: For deprecation or removal of public API.
112+
* ``.misc``: For general issues.
113+
114+
Check `towncrier`_ documentation for more details.
115+
116+
4. The pull request should work for all python / django / django CMS versions
117+
declared in tox.ini.
118+
Check the CI and make sure that the tests pass for all supported versions.
119+
120+
121+
.. _towncrier: https://pypi.org/project/towncrier/#news-fragments

HISTORY.rst

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,110 +9,112 @@ History
99

1010
* Improved pytest compatibility
1111

12+
.. towncrier release notes start
13+
1214
2.1.0 (2019-12-27)
1315
==================
1416

15-
* Reformatted code with black and improved flake8 configuration
16-
* Added pytest-compatible runner
17+
* Reformat code with black and improve flake8 configuration
18+
* Add pytest-compatible runner
1719

1820
2.0.1 (2019-12-22)
1921
==================
2022

21-
* Added Django 3.0 preliminary support
23+
* Add Django 3.0 preliminary support
2224

2325
2.0.0 (2019-10-13)
2426
==================
2527

26-
* Renamed application to django-app-helper
28+
* Rename application to django-app-helper
2729

2830
1.2.5 (2019-08-16)
2931
==================
3032

31-
* Added django CMS 3.7
32-
* Added Django 2.2
33+
* Add django CMS 3.7
34+
* Add Django 2.2
3335

3436
1.2.4 (2019-08-08)
3537
==================
3638

37-
* Fixed regression introduced by #116
39+
* Fix regression introduced by #116
3840

3941
1.2.3 (2019-08-05)
4042
==================
4143

42-
* Moved pyflakes to extras_require
43-
* Fixed error in get_request / post_request not preserving current_page
44+
* Move pyflakes to extras_require
45+
* Fix error in get_request / post_request not preserving current_page
4446

4547
1.2.2 (2019-07-05)
4648
==================
4749

48-
* Improved request generation by adding a more generic request method
50+
* Improve request generation by adding a more generic request method
4951

5052
1.2.1 (2019-07-04)
5153
==================
5254

53-
* Fixed error when creating users with non-writable email attribute
55+
* Fix error when creating users with non-writable email attribute
5456

5557
1.2.0 (2019-03-22)
5658
==================
5759

58-
* Dropped compatiblity with Django <1.11, Python 3.4
59-
* Added django CMS 3.6
60-
* Added django 2.0, 2.1
60+
* Drop compatiblity with Django <1.11, Python 3.4
61+
* Add django CMS 3.6
62+
* Add django 2.0, 2.1
6163

6264
1.1.1 (2019-07-03)
6365
==================
6466

65-
* Fixed error when creating users with non-writable email attribute
67+
* Fix error when creating users with non-writable email attribute
6668

6769
1.1.0 (2018-02-20)
6870
==================
6971

70-
* Removed Django <1.8, Python 2.6, 3.3 from setup.py
71-
* Added Django 1.11, Python 3.6
72-
* Switched to new-style middlewares for Django 1.10+
73-
* Created static methods to generate images
74-
* Fixed persistent option behavior with arbitrary commands
75-
* Added minimal changes to allow third party application to run test on django 2.0
76-
* Fixed options for channels runserver
77-
* Removed support for django-nose test runner
72+
* Remove Django <1.8, Python 2.6, 3.3 from setup.py
73+
* Add Django 1.11, Python 3.6
74+
* Switch to new-style middlewares for Django 1.10+
75+
* Create static methods to generate images
76+
* Fix persistent option behavior with arbitrary commands
77+
* Add minimal changes to allow third party application to run test on django 2.0
78+
* Fix options for channels runserver
79+
* Remove support for django-nose test runner
7880

7981
1.0.0 (2017-07-25)
8082
==================
8183

82-
* Added ApphookReloadMiddleware in server mode
83-
* Added a default for FILE_UPLOAD_TEMP_DIR
84-
* Added fix for django CMS 3.4.4 render_plugin
84+
* Add ApphookReloadMiddleware in server mode
85+
* Add a default for FILE_UPLOAD_TEMP_DIR
86+
* Add fix for django CMS 3.4.4 render_plugin
8587

8688
0.9.8 (2017-03-04)
8789
==================
8890

89-
* Fixed compatibility with newer channels releases
91+
* Fix compatibility with newer channels releases
9092

9193
0.9.7 (2016-12-03)
9294
==================
9395

94-
* Added support for django-sekizai 0.10
95-
* Fixed mock dependency in setup.py
96-
* Fixed issue with server command in Django 1.10
97-
* Fixed issue with urls.py in Django 1.10
98-
* Fixed issue in tests with django CMS 3.4
96+
* Add support for django-sekizai 0.10
97+
* Fix mock dependency in setup.py
98+
* Fix issue with server command in Django 1.10
99+
* Fix issue with urls.py in Django 1.10
100+
* Fix issue in tests with django CMS 3.4
99101

100102
0.9.6 (2016-08-25)
101103
==================
102104

103-
* Added support for channels runserver.
104-
* Added verbosity level to server command.
105-
* Added support for Django 1.10.
106-
* Added support for django CMS 3.4.
105+
* Add support for channels runserver.
106+
* Add verbosity level to server command.
107+
* Add support for Django 1.10.
108+
* Add support for django CMS 3.4.
107109

108110
0.9.5 (2016-06-06)
109111
==================
110112

111-
* Fixed issue with mocked session storage
112-
* Added verbosity level to tests
113-
* Fixed user creation
114-
* Added option to allow parametrizing auto-created user
115-
* Fixed extra_applications
113+
* Fix issue with mocked session storage
114+
* Add verbosity level to tests
115+
* Fix user creation
116+
* Add option to allow parametrizing auto-created user
117+
* Fix extra_applications
116118

117119
0.9.4 (2016-01-20)
118120
==================

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
include AUTHORS
1+
include AUTHORS.rst
22
include LICENSE
33
include README.rst
44
include CONTRIBUTING.rst
55
include HISTORY.rst
66
include requirements.txt
7+
include requirements-docs.txt
78
include requirements-tests.txt
89
recursive-include app_helper *.html *.png *.gif *js *jpg *jpeg *svg *py *mo *po

Makefile

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
.PHONY: clean-pyc clean-build docs
1+
.PHONY: clean-pyc clean-build docs bump-dev
22

33
help:
4-
@echo "clean-build - remove build artifacts"
5-
@echo "clean-pyc - remove Python file artifacts"
6-
@echo "lint - check style with flake8"
7-
@echo "test - run tests quickly with the default Python"
8-
@echo "test-all - run tests on every Python version with tox"
9-
@echo "coverage - check code coverage quickly with the default Python"
10-
@echo "release - package and upload a release"
11-
@echo "sdist - package"
4+
@echo "clean - Cleanup all artifacts"
5+
@echo "clean-build - Remove build artifacts"
6+
@echo "clean-pyc - Remove Python file artifacts"
7+
@echo "lint - Check code style"
8+
@echo "test - Run tests in current environment"
9+
@echo "test-all - Run tests on every environment version with tox"
10+
@echo "coverage - Check code coverage in current environment"
11+
@echo "tag-dev - Create dev release"
1212

1313
clean: clean-build clean-pyc
1414

1515
clean-build:
1616
python setup.py clean --all
1717
rm -fr build/
1818
rm -fr dist/
19-
rm -fr *.egg-info
19+
rm -fr *.egg*
2020

2121
clean-pyc:
2222
find . -name '*.pyc' -exec rm -f {} +
@@ -37,10 +37,5 @@ coverage:
3737
coverage run setup.py test
3838
coverage report -m
3939

40-
release: clean
41-
python setup.py clean --all sdist bdist_wheel
42-
twine upload dist/*
43-
44-
sdist: clean
45-
python setup.py sdist
46-
ls -l dist
40+
tag-dev:
41+
bumpversion --list patch --message="Bump develop version [ci skip]" --no-tag

app_helper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import, print_function, unicode_literals
33

4-
__version__ = "2.1.2.dev1"
4+
__version__ = "2.2.0.dev1"
55
__author__ = "Iacopo Spalletti <[email protected]>"
66
__all__ = ["runner"]
77

changes/.directory

Whitespace-only changes.

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
[build-system]
2+
requires = ["setuptools>=40.6.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
15
[tool.black]
26
line-length = 119
37
target-version = ["py27"]
48
include = 'app_helper/*py'
9+
10+
[tool.towncrier]
11+
directory = "changes"
12+
filename = "HISTORY.rst"
13+
title_format = "{version} ({project_date})"

requirements-test.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
coverage<5.0
33
coveralls
44
wheel
5+
pep517
56
tox>=1.8
67
aldryn-boilerplates
78
https://github.com/divio/django-filer/archive/develop.zip
89
pyflakes<2.1
910
pytest
1011
pytest-django
12+
bump2version
13+
https://github.com/hawkowl/towncrier/archive/master.zip

0 commit comments

Comments
 (0)