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.
- {libres-0.10.0 → libres-0.10.2}/HISTORY.rst +28 -0
- {libres-0.10.0/src/libres.egg-info → libres-0.10.2}/PKG-INFO +29 -1
- {libres-0.10.0 → libres-0.10.2}/pyproject.toml +1 -1
- {libres-0.10.0 → libres-0.10.2}/src/libres/__init__.py +1 -1
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/session.py +9 -8
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/allocation.py +2 -2
- libres-0.10.2/src/libres/db/models/base.py +11 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/reservation.py +3 -2
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/json_type.py +1 -0
- {libres-0.10.0 → libres-0.10.2/src/libres.egg-info}/PKG-INFO +29 -1
- libres-0.10.0/src/libres/db/models/base.py +0 -5
- {libres-0.10.0 → libres-0.10.2}/LICENSE +0 -0
- {libres-0.10.0 → libres-0.10.2}/MANIFEST.in +0 -0
- {libres-0.10.0 → libres-0.10.2}/README.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/Makefile +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/_static/custom.css +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/_static/favicon.ico +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/_static/logo.svg +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/api.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/concepts.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/conf.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/customizations.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/faq.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/index.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/requirements.txt +0 -0
- {libres-0.10.0 → libres-0.10.2}/docs/under_the_hood.rst +0 -0
- {libres-0.10.0 → libres-0.10.2}/setup.cfg +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/.gitignore +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/__init__.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/core.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/exposure.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/registry.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/context/settings.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/__init__.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/__init__.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/blocker.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/other.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/reserved_slot.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/timespan.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/timestamp.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/__init__.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/utcdatetime.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/models/types/uuid_type.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/queries.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/db/scheduler.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/modules/__init__.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/modules/errors.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/modules/events.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/modules/rasterizer.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/modules/utils.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres/py.typed +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/SOURCES.txt +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/dependency_links.txt +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/not-zip-safe +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/requires.txt +0 -0
- {libres-0.10.0 → libres-0.10.2}/src/libres.egg-info/top_level.txt +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_allocation.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_registry.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_reservation.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_reserved_slot.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_scheduler.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_scheduler_blockers.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_session.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_test.py +0 -0
- {libres-0.10.0 → libres-0.10.2}/tests/test_types.py +0 -0
- {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.
|
|
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,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
|
|
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
|
-
|
|
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
|
|
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':
|
|
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=
|
|
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':
|
|
121
|
+
'polymorphic_identity': 'generic',
|
|
121
122
|
'polymorphic_on': type
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libres
|
|
3
|
-
Version: 0.10.
|
|
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
|
|
|
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
|
|
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
|
|
File without changes
|