From 25fb37889624e93d67cc72b5d81ab58fc5f5ff55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 4 Apr 2022 11:05:53 +0200 Subject: [PATCH 1/2] Use poetry for package management. --- .github/workflows/release.yml | 16 +++++------ .github/workflows/test.yml | 4 +-- MANIFEST.in | 4 --- pyproject.toml | 52 +++++++++++++++++++++++++++++++++++ requirements.txt | 8 ------ setup.py | 33 ---------------------- tox.ini | 35 ++++++++++++++--------- 7 files changed, 83 insertions(+), 69 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c52985f..9f9792b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,16 +23,14 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install -U poetry + - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel - twine check dist/* + poetry build + - name: Upload packages to Jazzband if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: jazzband - password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository_url: https://jazzband.co/projects/django-invitations/upload + run: | + poetry config repositories.jazzband https://jazzband.co/projects/django-invitations/upload + poetry config http-basic.jazzband jazzband ${{ secrets.JAZZBAND_RELEASE_KEY }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4af9b97..f97dd66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Get pip cache dir id: pip-cache run: | @@ -38,7 +37,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade tox tox-gh-actions + python -m pip install pytest coverage + python -m pip install tox tox-gh-actions - name: Tox tests run: tox -v diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 5e73c45..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include LICENSE ChangeLog README.md requirements.txt manage.py tox.ini -recursive-include invitations/templates * -include test_*.py -recursive-include tests *.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e65ebdf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[tool.poetry] +name = "django-invitations" +version = "1.9.3" +description = "Generic invitations app with support for django-allauth" +authors = ["bee-keeper "] +license = "GPL-3.0-only" +maintainers = ["JazzBand "] +readme = "README.md" +keywords=['django', 'invitation', 'django-allauth', 'invite'] +classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "Environment :: Web Environment", + "Topic :: Internet", + "Framework :: Django", + "Framework :: Django:: 3.2", + "Framework :: Django:: 4.0", + "Programming Language :: Python", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: GPL-3.0-only", +] +packages = [ + { include= "invitations"}, + { include= "invitations/management/**/*.py"}, +] + +[tool.poetry.dependencies] +python = "^3.7" +django = ">=3.2,<4.1" + +[tool.poetry.dev-dependencies] +coverage = "^6.3.2" +flake8 = "^8.4.0" +freezegun = "^1.2.1" +pytest = "^7.1.1" +pytest-django = "^4.5.2" +pytest-cov = "^3.0.0" +tox = "3.14.0" +black = "^22.1.0" + +[tool.black] +line-length = 88 +target-version = ["py310"] +extend-exclude = "/migrations/" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index af8cb7f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -Django>=3.2.* -coverage==6.3.2 -flake8==4.0.1 -freezegun==1.2. -pytest==7.1.1 -pytest-django==4.5.2 -pytest-cov==3.0.0 -tox==3.24.5 diff --git a/setup.py b/setup.py deleted file mode 100644 index b9cff5e..0000000 --- a/setup.py +++ /dev/null @@ -1,33 +0,0 @@ -from setuptools import find_packages -from setuptools import setup - -setup( - name="django-invitations", - packages=find_packages(), - package_data={"invitations": ["templates/*.*"]}, - include_package_data=True, - zip_safe=False, - version="1.9.3", - description="Generic invitations app with support for django-allauth", - author="https://github.com/bee-keeper", - author_email="none@none.com", - url="https://github.com/jazzband/django-invitations.git", - keywords=["django", "invitation", "django-allauth", "invite"], - license="GPL-3.0-only", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - "Environment :: Web Environment", - "Topic :: Internet", - "Framework :: Django", - "Framework :: Django:: 3.2", - "Framework :: Django:: 4.0", - "Programming Language :: Python", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: GPL-3.0-only", - ], -) diff --git a/tox.ini b/tox.ini index 70ac05e..212d4c3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,11 @@ +[tox] +envlist = + py{37,38,39,310}-django{32}-backend{Basic,Allauth} + py{38,39,310}-django{40}-backend{Basic,Allauth} + flake8 +skipsdist = True +usedevelop = True + [gh-actions] python = 3.7: py37 @@ -5,17 +13,11 @@ python = 3.9: py39 3.10: py310 -[gh-actions:env] +[gh-actions:testenv] DJANGO = 3.2: django32 4.0: django40 -[tox] -envlist = - py{37,38,39,310}-django{32}-backend{Basic,Allauth} - py{38,39,310}-django{40}-backend{Basic,Allauth} - flake8 - [pytest] python_files = tests.py test_*.py @@ -23,16 +25,23 @@ python_files = tests.py test_*.py description = Unit tests setenv = PYTHONWARNINGS = all +commands = + python -V + backendBasic: pytest --cov-report term --cov=invitations --ignore=tests/allauth/ --ds=test_settings tests + backendAllauth: pytest --cov-report term --cov=invitations --ignore=tests/basic/ --ds=test_allauth_settings tests + coverage report deps = - -r requirements.txt django32: Django>=3.2,<3.3 django40: Django>=4.0,<4.1 backendAllauth: django-allauth -commands = - python -V - backendBasic: py.test --cov-report term --cov=invitations --ignore=tests/allauth/ --ds=test_settings tests - backendAllauth: py.test --cov-report term --cov=invitations --ignore=tests/basic/ --ds=test_allauth_settings tests - coverage report + coverage + pytest + pytest-django + pytest-cov + freezegun +whitelist_externals= + pytest + coverage [testenv:flake8] description = Static code analysis and code style checker From 64f063a28b5425159171da78d6f3d729beea920f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 4 Apr 2022 15:08:22 +0200 Subject: [PATCH 2/2] Remove flake8 from testing - we have pre-commit.ci for this. --- tox.ini | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tox.ini b/tox.ini index 212d4c3..7978c14 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,6 @@ envlist = py{37,38,39,310}-django{32}-backend{Basic,Allauth} py{38,39,310}-django{40}-backend{Basic,Allauth} - flake8 skipsdist = True usedevelop = True @@ -42,9 +41,3 @@ deps = whitelist_externals= pytest coverage - -[testenv:flake8] -description = Static code analysis and code style checker -skip_install = True -deps=flake8 -commands=flake8 invitations --exclude=migrations