Skip to content
Snippets Groups Projects
Commit 629c6ce3 authored by jan.bednarik's avatar jan.bednarik
Browse files

Setup Poetry for development and build

parent 2b8572eb
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ default_language_version:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
exclude: ^.*\.md$
......@@ -15,16 +15,16 @@ repos:
- id: check-merge-conflict
- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.1
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 22.6.0
hooks:
- id: black
3.10.2
3.9.7
3.8.3
......@@ -5,15 +5,10 @@ VENV = .venv
help:
@echo "Setup:"
@echo " venv Setup virtual environment"
@echo " install Install dependencies to venv"
@echo " install-hooks Install pre-commit hooks"
@echo " hooks Run pre-commit hooks manually"
@echo ""
@echo "Database:"
@echo " migrations Generate migrations"
@echo " migrate Run migrations"
@echo ""
@echo "Testing:"
@echo " test Run tests"
@echo ""
......@@ -22,12 +17,8 @@ help:
@echo " relase Publish Python package on PyPI"
@echo ""
venv: .venv/bin/python
.venv/bin/python:
${PYTHON} -m venv ${VENV}
install: venv
${VENV}/bin/pip install -r requirements/base.txt -r requirements/dev.txt
install:
poetry install
install-hooks:
pre-commit install --install-hooks
......@@ -35,21 +26,15 @@ install-hooks:
hooks:
pre-commit run -a
migrations: venv
${VENV}/bin/python manage.py makemigrations
migrate: venv
${VENV}/bin/python manage.py migrate
test:
tox
build: venv
${VENV}/bin/python setup.py sdist bdist_wheel
build:
poetry build
release: venv
${VENV}/bin/twine upload dist/*
release:
poetry publish
.PHONY: help venv install install-hooks hooks migrations migrate test build release
.PHONY: help install install-hooks hooks test build release
# EOF
This diff is collapsed.
[tool.poetry]
name = "pirates"
version = "0.6.0"
description = "Django app for users, teams and groups."
authors = ["Jan Bednařík <jan.bednarik@gmail.com>"]
license = "MIT"
readme = "README.md"
homepage = "https://gitlab.pirati.cz/to/pirates"
repository = "https://gitlab.pirati.cz/to/pirates"
keywords = ["django", "openid", "sso"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: Django",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Topic :: Utilities",
]
packages = [
{ include = "pirates" },
]
[tool.poetry.dependencies]
python = "^3.8"
mozilla-django-oidc = ">=2,<2.1"
[tool.poetry.dev-dependencies]
tox = "^3.25.1"
pytest = "^7.1.2"
pytest-cov = "^3.0.0"
pytest-factoryboy = "^2.5.0"
pytest-django = "^4.5.2"
pytest-mock = "^3.8.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
python_files = "test_*.py"
addopts = "--ds=tests.settings"
[tool.isort]
# config compatible with Black
line_length = 88
multi_line_output = 3
default_section = "THIRDPARTY"
include_trailing_comma = true
known_third_party = ["django", "factory", "faker", "mozilla_django_oidc", "pytest", "pytest_factoryboy"]
[aliases]
# alias `setup.py test` to `setup.py pytest`
test = pytest
[tool:pytest]
python_files = test_*.py
addopts = --ds=tests.settings
[tool:isort]
# config compatible with Black
line_length = 88
multi_line_output = 3
default_sectiont = "THIRDPARTY"
include_trailing_comma = true
known_third_party =django,factory,faker,mozilla_django_oidc,pytest,pytest_factoryboy,setuptools
#!/usr/bin/env python
import codecs
import os
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding="utf-8").read()
setup(
name="pirates",
version="0.6.0",
license="MIT",
description="Django app for users, teamds and groups.",
long_description=read("README.md"),
long_description_content_type="text/markdown",
author="Jan Bednařík",
author_email="jan.bednarik@gmail.com",
url="https://gitlab.pirati.cz/to/pirates",
packages=["pirates"],
include_package_data=True,
classifiers=[
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: Django",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 4.0",
"Topic :: Utilities",
],
project_urls={
# "Documentation": "https://pirates.readthedocs.io/",
# "Changelog": "https://pirates.readthedocs.io/en/latest/changelog.html",
"Issue Tracker": "https://gitlab.pirati.cz/to/pirates/issues",
},
keywords=["django", "openid", "sso"],
python_requires=">=3.8",
install_requires=["mozilla-django-oidc>=2,<2.1"],
)
[tox]
isolated_build = true
envlist =
py{38,39,310}-django{40,31,30}
py{38,39,310}-django{40,32,31,30}
[testenv]
whitelist_externals = poetry
deps =
-r{toxinidir}/tests/requirements.txt
django40: Django>=4.0,<4.1
django32: Django>=3.2,<3.3
django31: Django>=3.1,<3.2
django30: Django>=3.0,<3.1
setenv =
......@@ -13,6 +15,6 @@ setenv =
PYTHONUNBUFFERED = yes
passenv =
*
usedevelop = false
commands =
{posargs:pytest --cov -vv tests}
poetry install
poetry run pytest --cov -vv tests/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment