libres 0.10.0__tar.gz → 0.10.2__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 (66) hide show
  1. {libres-0.10.0 → libres-0.10.2}/HISTORY.rst +28 -0
  2. {libres-0.10.0/src/libres.egg-info → libres-0.10.2}/PKG-INFO +29 -1
  3. {libres-0.10.0 → libres-0.10.2}/pyproject.toml +1 -1
  4. {libres-0.10.0 → libres-0.10.2}/src/libres/__init__.py +1 -1
  5. {libres-0.10.0 → libres-0.10.2}/src/libres/context/session.py +9 -8
  6. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/allocation.py +2 -2
  7. libres-0.10.2/src/libres/db/models/base.py +11 -0
  8. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/reservation.py +3 -2
  9. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/json_type.py +1 -0
  10. {libres-0.10.0 → libres-0.10.2/src/libres.egg-info}/PKG-INFO +29 -1
  11. libres-0.10.0/src/libres/db/models/base.py +0 -5
  12. {libres-0.10.0 → libres-0.10.2}/LICENSE +0 -0
  13. {libres-0.10.0 → libres-0.10.2}/MANIFEST.in +0 -0
  14. {libres-0.10.0 → libres-0.10.2}/README.rst +0 -0
  15. {libres-0.10.0 → libres-0.10.2}/docs/Makefile +0 -0
  16. {libres-0.10.0 → libres-0.10.2}/docs/_static/custom.css +0 -0
  17. {libres-0.10.0 → libres-0.10.2}/docs/_static/favicon.ico +0 -0
  18. {libres-0.10.0 → libres-0.10.2}/docs/_static/logo.svg +0 -0
  19. {libres-0.10.0 → libres-0.10.2}/docs/api.rst +0 -0
  20. {libres-0.10.0 → libres-0.10.2}/docs/concepts.rst +0 -0
  21. {libres-0.10.0 → libres-0.10.2}/docs/conf.py +0 -0
  22. {libres-0.10.0 → libres-0.10.2}/docs/customizations.rst +0 -0
  23. {libres-0.10.0 → libres-0.10.2}/docs/faq.rst +0 -0
  24. {libres-0.10.0 → libres-0.10.2}/docs/index.rst +0 -0
  25. {libres-0.10.0 → libres-0.10.2}/docs/requirements.txt +0 -0
  26. {libres-0.10.0 → libres-0.10.2}/docs/under_the_hood.rst +0 -0
  27. {libres-0.10.0 → libres-0.10.2}/setup.cfg +0 -0
  28. {libres-0.10.0 → libres-0.10.2}/src/libres/.gitignore +0 -0
  29. {libres-0.10.0 → libres-0.10.2}/src/libres/context/__init__.py +0 -0
  30. {libres-0.10.0 → libres-0.10.2}/src/libres/context/core.py +0 -0
  31. {libres-0.10.0 → libres-0.10.2}/src/libres/context/exposure.py +0 -0
  32. {libres-0.10.0 → libres-0.10.2}/src/libres/context/registry.py +0 -0
  33. {libres-0.10.0 → libres-0.10.2}/src/libres/context/settings.py +0 -0
  34. {libres-0.10.0 → libres-0.10.2}/src/libres/db/__init__.py +0 -0
  35. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/__init__.py +0 -0
  36. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/blocker.py +0 -0
  37. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/other.py +0 -0
  38. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/reserved_slot.py +0 -0
  39. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/timespan.py +0 -0
  40. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/timestamp.py +0 -0
  41. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/__init__.py +0 -0
  42. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/utcdatetime.py +0 -0
  43. {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/uuid_type.py +0 -0
  44. {libres-0.10.0 → libres-0.10.2}/src/libres/db/queries.py +0 -0
  45. {libres-0.10.0 → libres-0.10.2}/src/libres/db/scheduler.py +0 -0
  46. {libres-0.10.0 → libres-0.10.2}/src/libres/modules/__init__.py +0 -0
  47. {libres-0.10.0 → libres-0.10.2}/src/libres/modules/errors.py +0 -0
  48. {libres-0.10.0 → libres-0.10.2}/src/libres/modules/events.py +0 -0
  49. {libres-0.10.0 → libres-0.10.2}/src/libres/modules/rasterizer.py +0 -0
  50. {libres-0.10.0 → libres-0.10.2}/src/libres/modules/utils.py +0 -0
  51. {libres-0.10.0 → libres-0.10.2}/src/libres/py.typed +0 -0
  52. {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/SOURCES.txt +0 -0
  53. {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/dependency_links.txt +0 -0
  54. {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/not-zip-safe +0 -0
  55. {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/requires.txt +0 -0
  56. {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/top_level.txt +0 -0
  57. {libres-0.10.0 → libres-0.10.2}/tests/test_allocation.py +0 -0
  58. {libres-0.10.0 → libres-0.10.2}/tests/test_registry.py +0 -0
  59. {libres-0.10.0 → libres-0.10.2}/tests/test_reservation.py +0 -0
  60. {libres-0.10.0 → libres-0.10.2}/tests/test_reserved_slot.py +0 -0
  61. {libres-0.10.0 → libres-0.10.2}/tests/test_scheduler.py +0 -0
  62. {libres-0.10.0 → libres-0.10.2}/tests/test_scheduler_blockers.py +0 -0
  63. {libres-0.10.0 → libres-0.10.2}/tests/test_session.py +0 -0
  64. {libres-0.10.0 → libres-0.10.2}/tests/test_test.py +0 -0
  65. {libres-0.10.0 → libres-0.10.2}/tests/test_types.py +0 -0
  66. {libres-0.10.0 → libres-0.10.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,34 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
+ 0.10.2 (05.02.2026)
5
+ ~~~~~~~~~~~~~~~~~~~
6
+
7
+ - Prepares for SQLAlchemy 2.0 support
8
+ [Daverball]
9
+
10
+ 0.10.1 (21.01.2026)
11
+ ~~~~~~~~~~~~~~~~~~~
12
+
13
+ - Adds proper support for SQLAlchemy 1.4. As a result of this
14
+ `Allocation.type` and `Reservation.type` are no longer nullable
15
+ and have a default value of 'generic', you may use the following
16
+ recipe using an alembic `Operations` object to migrate existing
17
+ databases::
18
+
19
+ context.operations.execute("""
20
+ UPDATE allocations
21
+ SET type = 'generic'
22
+ WHERE type IS NULL;
23
+ """)
24
+ context.operations.alter_column('allocations', 'type', nullable=False)
25
+ context.operations.execute("""
26
+ UPDATE reservations
27
+ SET type = 'generic'
28
+ WHERE type IS NULL;
29
+ """)
30
+ context.operations.alter_column('reservations', 'type', nullable=False)
31
+
4
32
  0.10.0 (15.01.2026)
5
33
  ~~~~~~~~~~~~~~~~~~~
6
34
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libres
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: A library to reserve things
5
5
  Home-page: http://github.com/seantis/libres/
6
6
  Author: Denis Krienbühl
@@ -142,6 +142,34 @@ After this, create a new release on Github.
142
142
  Changelog
143
143
  ---------
144
144
 
145
+ 0.10.2 (05.02.2026)
146
+ ~~~~~~~~~~~~~~~~~~~
147
+
148
+ - Prepares for SQLAlchemy 2.0 support
149
+ [Daverball]
150
+
151
+ 0.10.1 (21.01.2026)
152
+ ~~~~~~~~~~~~~~~~~~~
153
+
154
+ - Adds proper support for SQLAlchemy 1.4. As a result of this
155
+ `Allocation.type` and `Reservation.type` are no longer nullable
156
+ and have a default value of 'generic', you may use the following
157
+ recipe using an alembic `Operations` object to migrate existing
158
+ databases::
159
+
160
+ context.operations.execute("""
161
+ UPDATE allocations
162
+ SET type = 'generic'
163
+ WHERE type IS NULL;
164
+ """)
165
+ context.operations.alter_column('allocations', 'type', nullable=False)
166
+ context.operations.execute("""
167
+ UPDATE reservations
168
+ SET type = 'generic'
169
+ WHERE type IS NULL;
170
+ """)
171
+ context.operations.alter_column('reservations', 'type', nullable=False)
172
+
145
173
  0.10.0 (15.01.2026)
146
174
  ~~~~~~~~~~~~~~~~~~~
147
175
 
@@ -11,7 +11,7 @@ branch = true
11
11
  source = ["src"]
12
12
 
13
13
  [tool.bumpversion]
14
- current_version = "0.10.0"
14
+ current_version = "0.10.2"
15
15
  commit = true
16
16
  message = "Release {new_version}"
17
17
  tag = true
@@ -5,7 +5,7 @@ from libres.db import new_scheduler
5
5
 
6
6
  registry = create_default_registry() # noqa: RUF067
7
7
 
8
- __version__ = '0.10.0'
8
+ __version__ = '0.10.2'
9
9
  __all__ = (
10
10
  'new_scheduler',
11
11
  'registry'
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from sqlalchemy import create_engine
3
+ from sqlalchemy import create_engine, text
4
4
  from sqlalchemy.pool import QueuePool
5
5
  from sqlalchemy.orm import scoped_session, sessionmaker
6
6
 
@@ -34,12 +34,12 @@ class SessionProvider(StoppableService):
34
34
 
35
35
  self.engine = create_engine(
36
36
  dsn, poolclass=QueuePool, pool_size=5, max_overflow=5,
37
- isolation_level=SERIALIZABLE,
37
+ isolation_level=SERIALIZABLE, future=True,
38
38
  **(engine_config or {})
39
39
  )
40
40
 
41
41
  self.session = scoped_session(sessionmaker(
42
- bind=self.engine, **(session_config or {})
42
+ bind=self.engine, future=True, **(session_config or {}),
43
43
  ))
44
44
 
45
45
  def stop_service(self) -> None:
@@ -58,20 +58,21 @@ class SessionProvider(StoppableService):
58
58
  def get_postgres_version(self, dsn: str) -> tuple[str, int]:
59
59
  """ Returns the postgres version as a tuple (string, integer).
60
60
 
61
- Uses it's own connection to be independent from any session.
61
+ Uses its own connection to be independent from any session.
62
62
 
63
63
  """
64
64
  assert 'postgres' in dsn, 'Not a postgres database'
65
65
 
66
- query = """
66
+ query = text("""
67
67
  SELECT current_setting('server_version'),
68
68
  current_setting('server_version_num')
69
- """
69
+ """)
70
70
 
71
- engine = create_engine(dsn)
71
+ engine = create_engine(dsn, future=True)
72
72
 
73
73
  try:
74
- result = engine.execute(query).first()
74
+ with engine.connect() as conn:
75
+ result = conn.execute(query).first()
75
76
  assert result is not None
76
77
  version, number = result
77
78
  return version, int(number)
@@ -84,7 +84,7 @@ class Allocation(TimestampMixin, ORMBase, OtherModels):
84
84
  resource: Column[uuid.UUID] = Column(UUID(), nullable=False)
85
85
 
86
86
  #: the polymorphic type of the allocation
87
- type: Column[str | None] = Column(types.Text(), nullable=True)
87
+ type: Column[str] = Column(types.Text(), nullable=False, default='generic')
88
88
 
89
89
  #: resource of which this allocation is a mirror. If the mirror_of
90
90
  #: attribute equals the resource, this is a real resource
@@ -153,7 +153,7 @@ class Allocation(TimestampMixin, ORMBase, OtherModels):
153
153
  )
154
154
 
155
155
  __mapper_args__ = {
156
- 'polymorphic_identity': None,
156
+ 'polymorphic_identity': 'generic',
157
157
  'polymorphic_on': type
158
158
  }
159
159
 
@@ -0,0 +1,11 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ from typing import TYPE_CHECKING
5
+ if TYPE_CHECKING:
6
+ from sqlalchemy.ext.declarative import declarative_base
7
+ else:
8
+ # FIXME: Move this import out when dropping 1.4 support
9
+ from sqlalchemy.orm import declarative_base
10
+
11
+ ORMBase = declarative_base()
@@ -60,7 +60,8 @@ class Reservation(TimestampMixin, ORMBase, OtherModels):
60
60
 
61
61
  type: Column[str | None] = Column(
62
62
  types.Text(),
63
- nullable=True
63
+ nullable=False,
64
+ default='generic'
64
65
  )
65
66
 
66
67
  resource: Column[uuid.UUID] = Column(
@@ -117,7 +118,7 @@ class Reservation(TimestampMixin, ORMBase, OtherModels):
117
118
  )
118
119
 
119
120
  __mapper_args__ = {
120
- 'polymorphic_identity': None,
121
+ 'polymorphic_identity': 'generic',
121
122
  'polymorphic_on': type
122
123
  }
123
124
 
@@ -25,6 +25,7 @@ class JSON(_Base):
25
25
  """
26
26
 
27
27
  impl = JSONB
28
+ cache_ok = True
28
29
 
29
30
  def process_bind_param( # type:ignore[override]
30
31
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libres
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: A library to reserve things
5
5
  Home-page: http://github.com/seantis/libres/
6
6
  Author: Denis Krienbühl
@@ -142,6 +142,34 @@ After this, create a new release on Github.
142
142
  Changelog
143
143
  ---------
144
144
 
145
+ 0.10.2 (05.02.2026)
146
+ ~~~~~~~~~~~~~~~~~~~
147
+
148
+ - Prepares for SQLAlchemy 2.0 support
149
+ [Daverball]
150
+
151
+ 0.10.1 (21.01.2026)
152
+ ~~~~~~~~~~~~~~~~~~~
153
+
154
+ - Adds proper support for SQLAlchemy 1.4. As a result of this
155
+ `Allocation.type` and `Reservation.type` are no longer nullable
156
+ and have a default value of 'generic', you may use the following
157
+ recipe using an alembic `Operations` object to migrate existing
158
+ databases::
159
+
160
+ context.operations.execute("""
161
+ UPDATE allocations
162
+ SET type = 'generic'
163
+ WHERE type IS NULL;
164
+ """)
165
+ context.operations.alter_column('allocations', 'type', nullable=False)
166
+ context.operations.execute("""
167
+ UPDATE reservations
168
+ SET type = 'generic'
169
+ WHERE type IS NULL;
170
+ """)
171
+ context.operations.alter_column('reservations', 'type', nullable=False)
172
+
145
173
  0.10.0 (15.01.2026)
146
174
  ~~~~~~~~~~~~~~~~~~~
147
175
 
@@ -1,5 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from sqlalchemy.ext import declarative
4
-
5
- ORMBase = declarative.declarative_base()
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