PALs 0.3.3__tar.gz → 0.3.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PALs
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Easy distributed locking using PostgreSQL Advisory Locks.
5
5
  Home-page: https://github.com/level12/pals
6
6
  Author: Randy Syring
@@ -180,6 +180,14 @@ See Also
180
180
  Changelog
181
181
  =========
182
182
 
183
+ 0.3.4 released 2023-03-06
184
+ -------------------------
185
+
186
+ - support SQLAlchemy 2.0 (6879081_)
187
+
188
+ .. _6879081: https://github.com/level12/pals/commit/6879081
189
+
190
+
183
191
  0.3.3 released 2023-01-06
184
192
  -------------------------
185
193
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PALs
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Easy distributed locking using PostgreSQL Advisory Locks.
5
5
  Home-page: https://github.com/level12/pals
6
6
  Author: Randy Syring
@@ -180,6 +180,14 @@ See Also
180
180
  Changelog
181
181
  =========
182
182
 
183
+ 0.3.4 released 2023-03-06
184
+ -------------------------
185
+
186
+ - support SQLAlchemy 2.0 (6879081_)
187
+
188
+ .. _6879081: https://github.com/level12/pals/commit/6879081
189
+
190
+
183
191
  0.3.3 released 2023-01-06
184
192
  -------------------------
185
193
 
@@ -1,6 +1,14 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.3.4 released 2023-03-06
5
+ -------------------------
6
+
7
+ - support SQLAlchemy 2.0 (6879081_)
8
+
9
+ .. _6879081: https://github.com/level12/pals/commit/6879081
10
+
11
+
4
12
  0.3.3 released 2023-01-06
5
13
  -------------------------
6
14
 
@@ -84,7 +84,7 @@ class Locker:
84
84
  name = self._lock_name(name)
85
85
  kwargs.setdefault('blocking', self.blocking_default)
86
86
  kwargs.setdefault('acquire_timeout', self.acquire_timeout_default)
87
- return Lock(self.engine.connect(), lock_num, name, **kwargs)
87
+ return Lock(self.engine, lock_num, name, **kwargs)
88
88
 
89
89
 
90
90
  class Lock:
@@ -106,14 +106,16 @@ class Lock:
106
106
 
107
107
  if blocking:
108
108
  timeout_sql = sa.text('set lock_timeout = :timeout')
109
- self.conn.execute(timeout_sql, timeout=acquire_timeout)
109
+ with self.conn.begin():
110
+ self.conn.execute(timeout_sql, {'timeout': acquire_timeout})
110
111
 
111
112
  lock_sql = sa.text(f'select pg_advisory_lock{self.shared_suffix}(:lock_num)')
112
113
  else:
113
114
  lock_sql = sa.text(f'select pg_try_advisory_lock{self.shared_suffix}(:lock_num)')
114
115
 
115
116
  try:
116
- result = self.conn.execute(lock_sql, lock_num=self.lock_num)
117
+ with self.conn.begin():
118
+ result = self.conn.execute(lock_sql, {'lock_num': self.lock_num})
117
119
  retval = result.scalar()
118
120
  log.debug('Lock result was: %r', retval)
119
121
  # At least on PG 10.6, pg_advisory_lock() returns an empty string
@@ -140,7 +142,8 @@ class Lock:
140
142
  return False
141
143
 
142
144
  sql = sa.text(f'select pg_advisory_unlock{self.shared_suffix}(:lock_num)')
143
- result = self.conn.execute(sql, lock_num=self.lock_num)
145
+ with self.conn.begin():
146
+ result = self.conn.execute(sql, {'lock_num': self.lock_num})
144
147
  self.conn.close()
145
148
  self.conn = None
146
149
  return result.scalar()
@@ -0,0 +1 @@
1
+ VERSION = '0.3.4'
@@ -1,6 +1,10 @@
1
1
  [tox]
2
- envlist = py37,py{38,39,310}-{base,stable},project
3
-
2
+ envlist =
3
+ py37
4
+ py{38,39,310}-{base,stable}
5
+ py37-{lowest}
6
+ py310-{lowest}
7
+ project
4
8
 
5
9
  [testenv]
6
10
  # Ignore all "not installed in testenv" warnings.
@@ -10,10 +14,12 @@ passenv = PALS_DB_URL
10
14
  skip_install = true
11
15
 
12
16
  recreate = true
17
+ deps =
18
+ -e .[tests]
19
+ stable: -r stable-requirements.txt
20
+ lowest: sqlalchemy<2
13
21
  commands =
14
22
  pip --version
15
- pip install --progress-bar off -e .[tests]
16
- stable: pip install --progress-bar off -r ./stable-requirements.txt
17
23
  # Output installed versions to compare with previous test runs in case a dependency's change
18
24
  # breaks things for our build.
19
25
  pip freeze
@@ -22,7 +28,7 @@ commands =
22
28
  -c .ci/pytest.ini \
23
29
  -ra \
24
30
  --tb native \
25
- --strict \
31
+ --strict-markers \
26
32
  --cov pals \
27
33
  --cov-config .coveragerc \
28
34
  --cov-report xml \
@@ -1 +0,0 @@
1
- VERSION = '0.3.3'
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