Use poetry instead of setuptools

This commit is contained in:
Éloi Rivard 2022-05-13 11:44:23 +02:00
parent 275f20a5e0
commit ced97aac03
5 changed files with 1871 additions and 128 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python3
import configparser
import datetime
import os
import sys
from unittest import mock
@ -7,6 +7,10 @@ from unittest import mock
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../canaille"))
if sys.version_info[:2] >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata
# Readthedocs does not support C modules, so
# we have to mock them.
@ -21,9 +25,6 @@ class Mock(mock.MagicMock):
MOCK_MODULES = ["ldap"]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
config = configparser.ConfigParser()
config.read("../setup.cfg")
# -- General configuration ------------------------------------------------
@ -41,10 +42,11 @@ templates_path = ["_templates"]
source_suffix = [".rst"]
master_doc = "index"
project = "canaille"
copyright = "2020, Yaal"
author = "Yaal"
year = datetime.datetime.now().strftime("%Y")
copyright = f"{year}, Yaal Coop"
author = "Yaal Coop"
release = config["metadata"]["version"]
release = metadata.version("canaille")
version = "%s.%s" % tuple(map(int, release.split(".")[:2]))
language = None
exclude_patterns = []

View file

@ -1,12 +0,0 @@
authlib
click
email_validator
flask
flask-babel
flask-wtf
mock
sentry-sdk[flask]
sphinx
sphinx-rtd-theme
sphinx-issues
toml

1739
poetry.lock generated Normal file

File diff suppressed because it is too large Load diff

123
pyproject.toml Normal file
View file

@ -0,0 +1,123 @@
[build-system]
requires = ["poetry>=1.0.0"]
build-backend = "poetry.masonry.api"
[tool]
[tool.poetry]
name = "Canaille"
version = "0.0.8"
description = "Minimalistic identity provider"
license = "MIT"
keywords = ["oidc", "oauth", "oauth2", "openid", "identity"]
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"License :: OSI Approved :: MIT License",
"Environment :: Web Environment",
"Programming Language :: Python",
"Operating System :: OS Independent",
"Topic :: System :: Systems Administration :: Authentication/Directory",
"Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP",
]
authors = ["Yaal team <contact@yaal.coop>"]
maintainers = [
"Éloi Rivard <eloi@yaal.coop>",
]
homepage = "https://canaille.readthedocs.io/en/latest/"
documentation = "https://canaille.readthedocs.io/en/latest/"
repository = "https://gitlab.com/yaal/canaille"
readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.7, <4"
authlib = ">1,<2"
click = "<9"
email_validator = "<2"
flask = "<3"
flask-babel = "<3"
flask-themer = "<2"
flask-wtf = "<2"
python-ldap = "<4"
toml = "<1"
wtforms = "<4"
"sentry-sdk" = {version = "<2", optional=true, extras=["flask"]}
[tool.poetry.extras]
sentry = ["sentry-sdk"]
[tool.poetry.dev-dependencies]
"coverage" = "*"
"flask-webtest" = "*"
"freezegun" = "*"
"mock" = "*"
"pdbpp" = "*"
"pre-commit" = "*"
"pyquery" = "*"
"pytest" = "*"
"pytest-coverage" = "*"
"slapd" = "*"
"smtpdfix" = "*"
"sphinx" = "*"
"sphinx-rtd-theme" = "*"
"sphinx-issues" = "*"
[options.entry_points.console_scripts]
console_scripts = { sheraf = "canaille.commands:cli" }
[options.packages.find]
exclude = [
"tests",
"tests.*",
"doc",
"doc.*",
]
[tool.coverage.run]
source = [
"canaille",
"tests",
]
omit = [".tox/*"]
[tool.tox]
legacy_tox_ini = """
[tox]
isolated_build = true
skipsdist = true
envlist =
style
py37
py38
py39
py310
doc
coverage
[testenv]
whitelist_externals = poetry
commands =
poetry install
poetry run pytest --showlocals --full-trace {posargs}
[testenv:style]
commands =
poetry install
poetry run pre-commit run --all-files
[testenv:doc]
commands =
poetry install
poetry run sphinx-build doc build/sphinx/html
[testenv:coverage]
commands =
poetry install
poetry run pytest --cov {posargs}
poetry run coverage html
"""

109
setup.cfg
View file

@ -1,112 +1,3 @@
[metadata]
name = Canaille
version = 0.0.8
url = https://gitlab.com/yaal/canaille
project_urls =
Code = https://gitlab.com/yaal/canaille
Issue Tracker = https://gitlab.com/yaal/canaille/-/issues
license = MIT
license_files = LICENSE.md
maintainer = Yaal Coop
maintainer_email = contact@yaal.coop
description = Simple OAuth2/OpenID Connect server based upon LDAP
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Environment :: Web Environment
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Topic :: System :: Systems Administration :: Authentication/Directory
Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
[options]
packages = find:
include_package_data = true
python_requires = >= 3.7
install_requires =
authlib>1,<2
click<9
email_validator<2
flask<3
flask-babel<3
flask-themer<2
flask-wtf<2
python-ldap<4
sentry-sdk[flask]<2
toml<1
wtforms<4
[options.packages.find]
exclude =
tests
tests.*
doc
doc.*
[options.entry_points]
console_scripts =
canaille = canaille.commands:cli
[tox:tox]
envlist =
style
py37
py38
py39
py310
doc
coverage
skipsdist=True
[testenv]
install_command = pip install {packages}
commands = {envbindir}/pytest --showlocals --full-trace {posargs}
deps =
--editable .
flask-webtest
freezegun
mock
pdbpp
pyquery
pytest
slapd
smtpdfix
[testenv:style]
deps = pre-commit
skip_install = true
commands = pre-commit run --all-files
[testenv:doc]
deps =
--requirement doc/requirements.txt
commands =
sphinx-build doc build/sphinx/html
[testenv:coverage]
skip_install = true
deps =
--editable .
flask-webtest
freezegun
mock
pdbpp
pyquery
pytest
pytest-coverage
slapd
smtpdfix
commands =
{envbindir}/pytest --cov {posargs}
coverage html
[coverage:run]
source =
canaille
tests
[extract_messages]
copyright_holder = Yaal Coop Team
input_paths = canaille