Skip to content

Commit

Permalink
Switch to pyproject.toml and hatchling build backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Aug 23, 2024
1 parent 0bdcf65 commit e4a56cf
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 87 deletions.
11 changes: 4 additions & 7 deletions .github/utils/check_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import os
import sys
from importlib.util import find_spec
import tomllib
from pathlib import Path

from setuptools.config.expand import StaticModule


package = 'flask_multipass'
sys.path.insert(0, os.getcwd())
version = StaticModule(package, find_spec(package)).__version__
data = tomllib.loads(Path('pyproject.toml').read_text())
version = data['project']['version']
tag_version = sys.argv[1]

if tag_version != version:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ htmlcov/
.coverage

example/example.cfg
.python-version
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version 0.5.5
-------------

- Ensure only valid schemas (http and https) can be used when validating the ``next`` URL
- Deprecate the ``flask_multipass.__version__`` attribute

Version 0.5.4
-------------
Expand Down
17 changes: 16 additions & 1 deletion flask_multipass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@
from .identity import IdentityProvider


__version__ = '0.5.5'
__all__ = ('Multipass', 'AuthProvider', 'IdentityProvider', 'AuthInfo', 'IdentityInfo', 'Group', 'MultipassException',
'AuthenticationFailed', 'IdentityRetrievalFailed', 'GroupRetrievalFailed', 'NoSuchUser',
'InvalidCredentials')


def __getattr__(name):
if name == '__version__':
import importlib.metadata
import warnings

warnings.warn(
'The `__version__` attribute is deprecated. Use feature detection or'
" `importlib.metadata.version('flask-multipass')` instead.",
DeprecationWarning,
stacklevel=2,
)
return importlib.metadata.version('flask-multipass')

raise AttributeError(name)
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[project]
name = 'Flask-Multipass'
version = '0.5.5'
description = 'A pluggable solution for multi-backend authentication with Flask'
readme = 'README.rst'
license = 'BSD-3-Clause'
authors = [{ name = 'Indico Team', email = 'indico-team@cern.ch' }]
classifiers = [
'Environment :: Web Environment',
'Framework :: Flask',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
requires-python = '~=3.8'
dependencies = ['flask', 'blinker']

[project.optional-dependencies]
dev = ['pytest', 'pytest-cov', 'pytest-mock']
authlib = ['authlib>=0.14.1', 'requests']
ldap = ['flask-wtf', 'python-ldap>=3.3.1,<4.0']
saml = ['python3-saml>=1.10.1,<1.11']
sqlalchemy = ['sqlalchemy', 'flask-wtf']

[project.urls]
GitHub = 'https://github.com/indico/flask-multipass'

[project.entry-points.'flask_multipass.auth_providers']
ldap = 'flask_multipass.providers.ldap:LDAPAuthProvider'
authlib = 'flask_multipass.providers.authlib:AuthlibAuthProvider'
saml = 'flask_multipass.providers.saml:SAMLAuthProvider'
shibboleth = 'flask_multipass.providers.shibboleth:ShibbolethAuthProvider'
static = 'flask_multipass.providers.static:StaticAuthProvider'

[project.entry-points.'flask_multipass.identity_providers']
ldap = 'flask_multipass.providers.ldap:LDAPIdentityProvider'
ldap_or_authinfo = 'flask_multipass.providers.ldap:AuthFallbackLDAPIdentityProvider'
authlib = 'flask_multipass.providers.authlib:AuthlibIdentityProvider'
saml = 'flask_multipass.providers.saml:SAMLIdentityProvider'
shibboleth = 'flask_multipass.providers.shibboleth:ShibbolethIdentityProvider'
static = 'flask_multipass.providers.static:StaticIdentityProvider'

[build-system]
requires = ['hatchling==1.25.0']
build-backend = 'hatchling.build'

[tool.hatch.build]
exclude = ['docs/_build', '.github', '.python-version']
66 changes: 0 additions & 66 deletions setup.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ extras =
[testenv:style]
skip_install = true
deps = flake8
commands = flake8 setup.py example flask_multipass
commands = flake8 example flask_multipass

0 comments on commit e4a56cf

Please sign in to comment.