libres 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {libres-1.2.0 → libres-1.3.0}/HISTORY.rst +14 -0
  2. {libres-1.2.0/src/libres.egg-info → libres-1.3.0}/PKG-INFO +19 -4
  3. {libres-1.2.0 → libres-1.3.0}/README.rst +1 -1
  4. {libres-1.2.0 → libres-1.3.0}/pyproject.toml +21 -15
  5. {libres-1.2.0 → libres-1.3.0}/src/libres/__init__.py +1 -1
  6. {libres-1.2.0 → libres-1.3.0}/src/libres/context/core.py +2 -2
  7. {libres-1.2.0 → libres-1.3.0}/src/libres/context/registry.py +2 -2
  8. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/allocation.py +1 -1
  9. {libres-1.2.0 → libres-1.3.0}/src/libres/db/scheduler.py +5 -1
  10. {libres-1.2.0 → libres-1.3.0/src/libres.egg-info}/PKG-INFO +19 -4
  11. {libres-1.2.0 → libres-1.3.0}/src/libres.egg-info/requires.txt +1 -0
  12. {libres-1.2.0 → libres-1.3.0}/tests/test_scheduler.py +4 -0
  13. {libres-1.2.0 → libres-1.3.0}/LICENSE +0 -0
  14. {libres-1.2.0 → libres-1.3.0}/MANIFEST.in +0 -0
  15. {libres-1.2.0 → libres-1.3.0}/docs/Makefile +0 -0
  16. {libres-1.2.0 → libres-1.3.0}/docs/_static/custom.css +0 -0
  17. {libres-1.2.0 → libres-1.3.0}/docs/_static/favicon.ico +0 -0
  18. {libres-1.2.0 → libres-1.3.0}/docs/_static/logo.svg +0 -0
  19. {libres-1.2.0 → libres-1.3.0}/docs/api.rst +0 -0
  20. {libres-1.2.0 → libres-1.3.0}/docs/concepts.rst +0 -0
  21. {libres-1.2.0 → libres-1.3.0}/docs/conf.py +0 -0
  22. {libres-1.2.0 → libres-1.3.0}/docs/customizations.rst +0 -0
  23. {libres-1.2.0 → libres-1.3.0}/docs/faq.rst +0 -0
  24. {libres-1.2.0 → libres-1.3.0}/docs/index.rst +0 -0
  25. {libres-1.2.0 → libres-1.3.0}/docs/requirements.txt +0 -0
  26. {libres-1.2.0 → libres-1.3.0}/docs/under_the_hood.rst +0 -0
  27. {libres-1.2.0 → libres-1.3.0}/setup.cfg +0 -0
  28. {libres-1.2.0 → libres-1.3.0}/setup.py +0 -0
  29. {libres-1.2.0 → libres-1.3.0}/src/libres/.gitignore +0 -0
  30. {libres-1.2.0 → libres-1.3.0}/src/libres/context/__init__.py +0 -0
  31. {libres-1.2.0 → libres-1.3.0}/src/libres/context/exposure.py +0 -0
  32. {libres-1.2.0 → libres-1.3.0}/src/libres/context/session.py +0 -0
  33. {libres-1.2.0 → libres-1.3.0}/src/libres/context/settings.py +0 -0
  34. {libres-1.2.0 → libres-1.3.0}/src/libres/db/__init__.py +0 -0
  35. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/__init__.py +0 -0
  36. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/base.py +0 -0
  37. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/blocker.py +0 -0
  38. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/other.py +0 -0
  39. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/reservation.py +0 -0
  40. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/reserved_slot.py +0 -0
  41. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/timespan.py +0 -0
  42. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/timestamp.py +0 -0
  43. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/types/__init__.py +0 -0
  44. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/types/json_type.py +0 -0
  45. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/types/utcdatetime.py +0 -0
  46. {libres-1.2.0 → libres-1.3.0}/src/libres/db/models/types/uuid_type.py +0 -0
  47. {libres-1.2.0 → libres-1.3.0}/src/libres/db/queries.py +0 -0
  48. {libres-1.2.0 → libres-1.3.0}/src/libres/modules/__init__.py +0 -0
  49. {libres-1.2.0 → libres-1.3.0}/src/libres/modules/errors.py +0 -0
  50. {libres-1.2.0 → libres-1.3.0}/src/libres/modules/events.py +0 -0
  51. {libres-1.2.0 → libres-1.3.0}/src/libres/modules/rasterizer.py +0 -0
  52. {libres-1.2.0 → libres-1.3.0}/src/libres/modules/utils.py +0 -0
  53. {libres-1.2.0 → libres-1.3.0}/src/libres/py.typed +0 -0
  54. {libres-1.2.0 → libres-1.3.0}/src/libres.egg-info/SOURCES.txt +0 -0
  55. {libres-1.2.0 → libres-1.3.0}/src/libres.egg-info/dependency_links.txt +0 -0
  56. {libres-1.2.0 → libres-1.3.0}/src/libres.egg-info/top_level.txt +0 -0
  57. {libres-1.2.0 → libres-1.3.0}/tests/test_allocation.py +0 -0
  58. {libres-1.2.0 → libres-1.3.0}/tests/test_registry.py +0 -0
  59. {libres-1.2.0 → libres-1.3.0}/tests/test_reservation.py +0 -0
  60. {libres-1.2.0 → libres-1.3.0}/tests/test_reserved_slot.py +0 -0
  61. {libres-1.2.0 → libres-1.3.0}/tests/test_scheduler_blockers.py +0 -0
  62. {libres-1.2.0 → libres-1.3.0}/tests/test_session.py +0 -0
  63. {libres-1.2.0 → libres-1.3.0}/tests/test_test.py +0 -0
  64. {libres-1.2.0 → libres-1.3.0}/tests/test_types.py +0 -0
  65. {libres-1.2.0 → libres-1.3.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,20 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
+ 1.3.0 (15.10.2026)
5
+ ~~~~~~~~~~~~~~~~~~~
6
+
7
+ - Adds Python 3.15 support
8
+ [Daverball]
9
+
10
+ - Drops Python 3.10 support
11
+ [Daverball]
12
+
13
+ - Fixes `ZeroDivisionError` in `Scheduler.availability` if there
14
+ are blocking resources, but there are no allocations in the
15
+ specified time period.
16
+ [Daverball]
17
+
4
18
  1.2.0 (13.08.2026)
5
19
  ~~~~~~~~~~~~~~~~~~~
6
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libres
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: A library to reserve things
5
5
  Author-email: Denis Krienbühl <denis@href.ch>
6
6
  Maintainer-email: Seantis GmbH <info@seantis.ch>
@@ -12,16 +12,17 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
19
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
- Requires-Python: >=3.10
22
+ Requires-Python: >=3.11
23
23
  Description-Content-Type: text/x-rst
24
24
  License-File: LICENSE
25
+ Requires-Dist: jsonpickle<5
25
26
  Requires-Dist: python-dateutil
26
27
  Requires-Dist: pytz
27
28
  Requires-Dist: sedate>=1.0.0
@@ -32,7 +33,7 @@ Libres
32
33
  ======
33
34
 
34
35
  Libres is a reservations management library to reserve things like tables at
35
- a restaurant or tickets at an event. It works with Python 3.10+
36
+ a restaurant or tickets at an event. It works with Python 3.11+
36
37
  and requires Postgresql 9.2+.
37
38
 
38
39
  `Documentation <http://libres.readthedocs.org/en/latest/>`_ | `Source <http://github.com/seantis/libres/>`_ | `Bugs <http://github.com/seantis/libres/issues>`_
@@ -116,6 +117,20 @@ After this, create a new release on Github.
116
117
  Changelog
117
118
  ---------
118
119
 
120
+ 1.3.0 (15.10.2026)
121
+ ~~~~~~~~~~~~~~~~~~~
122
+
123
+ - Adds Python 3.15 support
124
+ [Daverball]
125
+
126
+ - Drops Python 3.10 support
127
+ [Daverball]
128
+
129
+ - Fixes `ZeroDivisionError` in `Scheduler.availability` if there
130
+ are blocking resources, but there are no allocations in the
131
+ specified time period.
132
+ [Daverball]
133
+
119
134
  1.2.0 (13.08.2026)
120
135
  ~~~~~~~~~~~~~~~~~~~
121
136
 
@@ -2,7 +2,7 @@ Libres
2
2
  ======
3
3
 
4
4
  Libres is a reservations management library to reserve things like tables at
5
- a restaurant or tickets at an event. It works with Python 3.10+
5
+ a restaurant or tickets at an event. It works with Python 3.11+
6
6
  and requires Postgresql 9.2+.
7
7
 
8
8
  `Documentation <http://libres.readthedocs.org/en/latest/>`_ | `Source <http://github.com/seantis/libres/>`_ | `Bugs <http://github.com/seantis/libres/issues>`_
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "libres"
7
7
  dynamic = ["version", "readme"]
8
8
  description = "A library to reserve things"
9
- requires-python = ">=3.10"
9
+ requires-python = ">=3.11"
10
10
  authors = [
11
11
  { name = "Denis Krienbühl", email = "denis@href.ch" },
12
12
  ]
@@ -22,15 +22,17 @@ classifiers = [
22
22
  "Operating System :: OS Independent",
23
23
  "Programming Language :: Python",
24
24
  "Programming Language :: Python :: 3",
25
- "Programming Language :: Python :: 3.10",
26
25
  "Programming Language :: Python :: 3.11",
27
26
  "Programming Language :: Python :: 3.12",
28
27
  "Programming Language :: Python :: 3.13",
29
28
  "Programming Language :: Python :: 3.14",
29
+ "Programming Language :: Python :: 3.15",
30
30
  "Programming Language :: Python :: Implementation :: CPython",
31
31
  "Programming Language :: Python :: Implementation :: PyPy",
32
32
  ]
33
33
  dependencies = [
34
+ # FIXME: Remove this pin after upgrading to SQLAlchemy 2.1
35
+ "jsonpickle < 5",
34
36
  "python-dateutil",
35
37
  "pytz",
36
38
  "sedate >= 1.0.0",
@@ -94,13 +96,17 @@ dev = [
94
96
  [tool.pytest.ini_options]
95
97
  log_level = "INFO"
96
98
  testpaths = ["tests"]
99
+ filterwarnings = [
100
+ # FIXME: Remove after upgrading to SQLAlchemy 2.1
101
+ '''ignore:keys will default to True in jsonpickle 5\.0\.0:DeprecationWarning''',
102
+ ]
97
103
 
98
104
  [tool.coverage.run]
99
105
  branch = true
100
106
  source = ["src"]
101
107
 
102
108
  [tool.bumpversion]
103
- current_version = "1.2.0"
109
+ current_version = "1.3.0"
104
110
  commit = true
105
111
  message = "Release {new_version}"
106
112
  tag = true
@@ -124,7 +130,7 @@ replace = """
124
130
  """
125
131
 
126
132
  [tool.mypy]
127
- python_version = "3.10"
133
+ python_version = "3.11"
128
134
  namespace_packages = true
129
135
  explicit_package_bases = true
130
136
  strict = true
@@ -192,7 +198,7 @@ include = [
192
198
  ]
193
199
  line-length = 79
194
200
  indent-width = 4
195
- target-version = "py310"
201
+ target-version = "py311"
196
202
 
197
203
  [tool.ruff.lint]
198
204
  select = [
@@ -326,11 +332,11 @@ docstring-code-line-length = "dynamic"
326
332
  [tool.tox]
327
333
  requires = ["tox>=4.21"]
328
334
  envlist = [
329
- "3.10",
330
335
  "3.11",
331
336
  "3.12",
332
337
  "3.13",
333
338
  "3.14",
339
+ "3.15",
334
340
  "flake8",
335
341
  "ruff",
336
342
  "bandit",
@@ -339,11 +345,11 @@ envlist = [
339
345
  ]
340
346
 
341
347
  [tool.tox.gh.python]
342
- "3.10" = ["3.10"]
343
- "3.11" = ["3.11", "flake8", "bandit", "ruff", "mypy"]
344
- "3.12" = ["3.12"]
348
+ "3.11" = ["3.11"]
349
+ "3.12" = ["3.12", "flake8", "bandit", "ruff", "mypy"]
345
350
  "3.13" = ["3.13"]
346
351
  "3.14" = ["3.14"]
352
+ "3.15" = ["3.15"]
347
353
 
348
354
  [tool.tox.env_run_base]
349
355
  use_develop = true
@@ -359,37 +365,37 @@ commands = [
359
365
  ],
360
366
  ]
361
367
  [tool.tox.env.ruff]
362
- base_python = ["python3.11"]
368
+ base_python = ["python3.12"]
363
369
  skip_install = true
364
370
  dependency_groups = ["ruff"]
365
371
  commands = [["ruff", "check"]]
366
372
 
367
373
  [tool.tox.env.flake8]
368
- base_python = ["python3.11"]
374
+ base_python = ["python3.12"]
369
375
  skip_install = true
370
376
  dependency_groups = ["flake8"]
371
377
  commands = [["flake8", "src{/}", "tests{/}"]]
372
378
 
373
379
  [tool.tox.env.bandit]
374
- base_python = ["python3.11"]
380
+ base_python = ["python3.12"]
375
381
  skip_install = true
376
382
  dependency_groups = ["bandit"]
377
383
  commands = [["bandit", "-q", "-c", "pyproject.toml", "-r", "src"]]
378
384
 
379
385
  [tool.tox.env.mypy]
380
- base_python = ["python3.11"]
386
+ base_python = ["python3.12"]
381
387
  skip_install = true
382
388
  dependency_groups = ["mypy"]
383
389
  commands = [
384
- ["mypy", "-p", "libres", "--python-version", "3.10"],
385
390
  ["mypy", "-p", "libres", "--python-version", "3.11"],
386
391
  ["mypy", "-p", "libres", "--python-version", "3.12"],
387
392
  ["mypy", "-p", "libres", "--python-version", "3.13"],
388
393
  ["mypy", "-p", "libres", "--python-version", "3.14"],
394
+ ["mypy", "-p", "libres", "--python-version", "3.15"],
389
395
  ]
390
396
 
391
397
  [tool.tox.env.report]
392
- base_python = ["python3.11"]
398
+ base_python = ["python3.12"]
393
399
  skip_install = true
394
400
  ignore_errors = true
395
401
  ignore_outcome = true
@@ -5,7 +5,7 @@ from libres.db import new_scheduler
5
5
 
6
6
  registry = create_default_registry() # ruff: ignore[non-empty-init-module]
7
7
 
8
- __version__ = '1.2.0'
8
+ __version__ = '1.3.0'
9
9
  __all__ = (
10
10
  'new_scheduler',
11
11
  'registry'
@@ -14,7 +14,7 @@ from typing import Literal
14
14
  from typing import TYPE_CHECKING
15
15
  if TYPE_CHECKING:
16
16
  from collections.abc import Callable
17
- from collections.abc import Iterator
17
+ from collections.abc import Generator
18
18
  from sqlalchemy.orm import Session
19
19
  from sqlalchemy.orm.session import SessionTransaction
20
20
  from typing import TypeAlias
@@ -164,7 +164,7 @@ class Context:
164
164
  return f"<Libres Context(name='{self.name}')>"
165
165
 
166
166
  @contextmanager
167
- def as_current_context(self) -> Iterator[None]:
167
+ def as_current_context(self) -> Generator[None]:
168
168
  with self.registry.context(self.name):
169
169
  yield
170
170
 
@@ -11,7 +11,7 @@ from libres.context.core import Context
11
11
  from typing import TYPE_CHECKING
12
12
  if TYPE_CHECKING:
13
13
  from collections.abc import Callable
14
- from collections.abc import Iterator
14
+ from collections.abc import Generator
15
15
  from uuid import UUID
16
16
 
17
17
 
@@ -143,7 +143,7 @@ class Registry:
143
143
  self.local.current_context = self.get_context(name)
144
144
 
145
145
  @contextmanager
146
- def context(self, name: str) -> Iterator[Context]:
146
+ def context(self, name: str) -> Generator[Context]:
147
147
  previous = self.current_context.name
148
148
  self.switch_context(name)
149
149
  try:
@@ -36,7 +36,7 @@ if TYPE_CHECKING:
36
36
  from sedate.types import TzInfoOrName
37
37
  from sqlalchemy.orm import Query
38
38
  from typing import NamedTuple
39
- from typing_extensions import Self
39
+ from typing import Self
40
40
 
41
41
  from libres.db.models import ReservedSlot
42
42
  from libres.modules.rasterizer import Raster
@@ -35,8 +35,10 @@ if TYPE_CHECKING:
35
35
  from collections.abc import Iterator
36
36
  from sedate.types import DateLike
37
37
  from sqlalchemy.orm import Query
38
+ from typing import NotRequired
38
39
  from typing import TypeAlias
39
- from typing_extensions import NotRequired, Self, TypedDict
40
+ from typing import TypedDict
41
+ from typing import Self
40
42
 
41
43
  from libres.context.core import Context
42
44
  from libres.modules.rasterizer import Raster
@@ -861,6 +863,8 @@ class Scheduler(ContextServicesMixin):
861
863
  for allocation, availability, _ in allocations:
862
864
  total += availability
863
865
  count += allocation.quota
866
+ if not count:
867
+ return 0.0
864
868
  return total / count
865
869
 
866
870
  def move_allocation(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libres
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: A library to reserve things
5
5
  Author-email: Denis Krienbühl <denis@href.ch>
6
6
  Maintainer-email: Seantis GmbH <info@seantis.ch>
@@ -12,16 +12,17 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
19
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
- Requires-Python: >=3.10
22
+ Requires-Python: >=3.11
23
23
  Description-Content-Type: text/x-rst
24
24
  License-File: LICENSE
25
+ Requires-Dist: jsonpickle<5
25
26
  Requires-Dist: python-dateutil
26
27
  Requires-Dist: pytz
27
28
  Requires-Dist: sedate>=1.0.0
@@ -32,7 +33,7 @@ Libres
32
33
  ======
33
34
 
34
35
  Libres is a reservations management library to reserve things like tables at
35
- a restaurant or tickets at an event. It works with Python 3.10+
36
+ a restaurant or tickets at an event. It works with Python 3.11+
36
37
  and requires Postgresql 9.2+.
37
38
 
38
39
  `Documentation <http://libres.readthedocs.org/en/latest/>`_ | `Source <http://github.com/seantis/libres/>`_ | `Bugs <http://github.com/seantis/libres/issues>`_
@@ -116,6 +117,20 @@ After this, create a new release on Github.
116
117
  Changelog
117
118
  ---------
118
119
 
120
+ 1.3.0 (15.10.2026)
121
+ ~~~~~~~~~~~~~~~~~~~
122
+
123
+ - Adds Python 3.15 support
124
+ [Daverball]
125
+
126
+ - Drops Python 3.10 support
127
+ [Daverball]
128
+
129
+ - Fixes `ZeroDivisionError` in `Scheduler.availability` if there
130
+ are blocking resources, but there are no allocations in the
131
+ specified time period.
132
+ [Daverball]
133
+
119
134
  1.2.0 (13.08.2026)
120
135
  ~~~~~~~~~~~~~~~~~~~
121
136
 
@@ -1,3 +1,4 @@
1
+ jsonpickle<5
1
2
  python-dateutil
2
3
  pytz
3
4
  sedate>=1.0.0
@@ -433,6 +433,7 @@ def test_reserve_blocking_resources(
433
433
  blocked_scheduler: Scheduler
434
434
  ) -> None:
435
435
 
436
+ assert blocked_scheduler.availability() == 0.0
436
437
  assert scheduler.resource in blocked_scheduler.blocking_resources
437
438
 
438
439
  # create an allocation on the blocking scheduler
@@ -484,6 +485,7 @@ def test_reserve_blocking_resources(
484
485
  (25.0, True),
485
486
  (50.0, False),
486
487
  ]
488
+ assert blocked_scheduler.availability() == 75.0
487
489
 
488
490
  # reserving a slot that's partially blocked will fail
489
491
  with pytest.raises(errors.AlreadyReservedError):
@@ -520,6 +522,7 @@ def test_reserve_blocking_resources(
520
522
  (25.0, False),
521
523
  (75.0, True),
522
524
  ]
525
+ assert blocked_scheduler.availability() == 25.0
523
526
 
524
527
 
525
528
  def test_change_email(scheduler: Scheduler) -> None:
@@ -1906,6 +1909,7 @@ def test_quota_changes_advanced(scheduler: Scheduler) -> None:
1906
1909
  def test_availability(scheduler: Scheduler) -> None:
1907
1910
  start = datetime(2011, 1, 1, 15, 0)
1908
1911
  end = datetime(2011, 1, 1, 16, 0)
1912
+ assert not scheduler.availability()
1909
1913
 
1910
1914
  a = scheduler.allocate(
1911
1915
  (start, end), raster=15, partly_available=True)[0]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes