Skip to content

Support Python 3.12 and 3.13. #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true

- name: Install nox
run: |
Expand All @@ -53,10 +56,10 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ docs/_build/
*.pyc
*.egg-info
.coverage
.coverage.py*
coverage.xml
nosetests.xml
19 changes: 14 additions & 5 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
repoze.who Changelog
====================

3.0.0b2 (unreleased)
--------------------

- Skip testing the crypt module if it does not exist, like on Python 3.13.

- Require ``legacy-cgi`` on Python 3.13 or higher so ``WebOb`` works.

- Add support for Python 3.12 and 3.13.

3.0.0b1 (2023-01-16)
--------------------

Expand Down Expand Up @@ -106,7 +115,7 @@ repoze.who Changelog
2.0b1 (2011-05-24)
------------------

- Enabled standard use of logging module's configuration mechanism.
- Enabled standard use of logging module's configuration mechanism.
See http://docs.python.org/dev/howto/logging.html#configuring-logging-for-a-library
Thanks to jgoldsmith for the patch: http://bugs.repoze.org/issue178

Expand Down Expand Up @@ -180,7 +189,7 @@ repoze.who Changelog
- Added ``repoze.who.config:make_api_factory_with_config``, a convenience
method for applications which want to set up their own API Factory from
a configuration file.

- Fixed example call to ``repoze.who.config:make_middleware_with_config``
(added missing ``global_config`` argument). See
http://bugs.repoze.org/issue114
Expand Down Expand Up @@ -248,7 +257,7 @@ Backward Incompatibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~

- The middleware used to allow identifier plugins to "pre-authenticate"
an identity. This feature is no longer supported: the ``auth_tkt``
an identity. This feature is no longer supported: the ``auth_tkt``
plugin, which used to use the feature, is now configured to work as
an authenticator plugin (as well as an identifier).

Expand All @@ -263,7 +272,7 @@ Backward Incompatibilities

- The following (non-API) functions moved from ``repoze.who.middleware`` to
``repoze.who.api``:

- ``make_registries``
- ``match_classification``
- ``verify``
Expand All @@ -274,7 +283,7 @@ Backward Incompatibilities
-------------------

- Issue #104: AuthTkt plugin was passing an invalid cookie value in
headers from ``forget``, and was not setting the ``Max-Age`` and
headers from ``forget``, and was not setting the ``Max-Age`` and
``Expires`` attributes of those cookies.


Expand Down
3 changes: 3 additions & 0 deletions repoze/who/plugins/htpasswd.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def _same_string(x, y):
return len(mismatches) == 0

def crypt_check(password, hashed):
# Note: the crypt module is deprecated since Python 3.11
# and will be removed in Python 3.13.
# win32 does not have a crypt library at all.
from crypt import crypt
salt = hashed[:2]
return _same_string(hashed, crypt(password, salt))
Expand Down
17 changes: 10 additions & 7 deletions repoze/who/plugins/tests/test_htpasswd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import unittest


try:
from crypt import crypt
except ImportError:
# The crypt module is deprecated since Python 3.11
# and will be removed in Python 3.13.
# win32 does not have a crypt library at all.
crypt = None


class TestHTPasswdPlugin(unittest.TestCase):

def _getTargetClass(self):
Expand Down Expand Up @@ -106,14 +115,8 @@ def warn(self, msg):
self.assertEqual(len(logger.warnings), 1)
self.assertTrue('could not open htpasswd' in logger.warnings[0])

@unittest.skipIf(crypt is None, "crypt module not available")
def test_crypt_check(self):
import sys
# win32 does not have a crypt library, don't
# fail here
if "win32" == sys.platform: # pragma: no cover
return

from crypt import crypt
salt = '123'
hashed = crypt('password', salt)
from repoze.who.plugins.htpasswd import crypt_check
Expand Down
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def _read_file(filename):

README = _read_file('README.rst')
CHANGES = _read_file('CHANGES.rst')
tests_require = ['WebOb', 'zope.interface']
docs_extras = tests_require + ['Sphinx', 'repoze.sphinx.autointerface']

setup(name='repoze.who',
version='3.0.0b1',
Expand All @@ -43,6 +41,8 @@ def _read_file(filename):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
Expand All @@ -59,8 +59,12 @@ def _read_file(filename):
include_package_data=True,
namespace_packages=['repoze', 'repoze.who', 'repoze.who.plugins'],
zip_safe=False,
tests_require = tests_require,
install_requires=['WebOb', 'zope.interface', 'setuptools'],
install_requires=[
'WebOb',
'zope.interface',
'setuptools',
'legacy-cgi; python_version > "3.12"', # WebOb uses the cgi module
],
test_suite="repoze.who",
entry_points = """\
[paste.filter_app_factory]
Expand All @@ -70,6 +74,6 @@ def _read_file(filename):
authenticated = repoze.who.restrict:make_authenticated_restriction
""",
extras_require = {
'docs': docs_extras,
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
)
12 changes: 5 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[tox]
envlist =
py37,py38,py39,py310,py311,pypy3,cover,docs
envlist =
py37,py38,py39,py310,py311,py312,py313,pypy3,cover,docs

[testenv]
commands =
commands =
python -m pytest --cov=repoze.who --cov-append --cov-report= {toxinidir}/repoze/who/tests/ {toxinidir}/repoze/who/plugins/tests/
usedevelop=true
deps =
zope.interface
WebOb
virtualenv
pytest
pytest-cov
Expand All @@ -19,7 +17,7 @@ setenv =
skip_install = true
basepython =
python3.10
commands =
commands =
coverage combine
coverage report --fail-under=100 --show-missing
coverage xml
Expand All @@ -31,7 +29,7 @@ setenv =
[testenv:docs]
basepython =
python3.10
commands =
commands =
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
deps =
Expand Down
Loading