navigator-session 0.6.0rc1__tar.gz → 0.7.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 (38) hide show
  1. navigator_session-0.7.0/Makefile +85 -0
  2. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/PKG-INFO +16 -12
  3. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/requirements-dev.txt +1 -1
  4. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/__init__.py +2 -0
  5. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/data.py +13 -22
  6. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/storages/redis.py +43 -13
  7. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/version.py +6 -4
  8. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session.egg-info/PKG-INFO +16 -12
  9. navigator_session-0.7.0/navigator_session.egg-info/requires.txt +6 -0
  10. navigator_session-0.7.0/pyproject.toml +95 -0
  11. navigator_session-0.7.0/setup.py +7 -0
  12. navigator-session-0.6.0rc1/Makefile +0 -35
  13. navigator-session-0.6.0rc1/navigator_session.egg-info/requires.txt +0 -7
  14. navigator-session-0.6.0rc1/pyproject.toml +0 -68
  15. navigator-session-0.6.0rc1/setup.py +0 -102
  16. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/CHANGES.rst +0 -0
  17. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/LICENSE +0 -0
  18. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/MANIFEST.in +0 -0
  19. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/README.md +0 -0
  20. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/Makefile +0 -0
  21. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/api.rst +0 -0
  22. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/authors.rst +0 -0
  23. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/conf.py +0 -0
  24. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/examples.rst +0 -0
  25. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/index.rst +0 -0
  26. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/make.bat +0 -0
  27. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/docs/requirements.txt +0 -0
  28. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/conf.py +0 -0
  29. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/middleware.py +0 -0
  30. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/session.py +0 -0
  31. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/storages/__init__.py +0 -0
  32. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/storages/abstract.py +0 -0
  33. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session/storages/cookie.py +0 -0
  34. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session.egg-info/SOURCES.txt +0 -0
  35. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session.egg-info/dependency_links.txt +0 -0
  36. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/navigator_session.egg-info/top_level.txt +0 -0
  37. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/setup.cfg +0 -0
  38. {navigator-session-0.6.0rc1 → navigator_session-0.7.0}/tests/__init__.py +0 -0
@@ -0,0 +1,85 @@
1
+ # Navigator-Session Makefile
2
+
3
+ .PHONY: venv install develop release format lint test clean distclean lock sync
4
+
5
+ # Python version to use
6
+ PYTHON_VERSION := 3.11
7
+
8
+ # Auto-detect available tools
9
+ HAS_UV := $(shell command -v uv 2> /dev/null)
10
+
11
+ # Install uv if missing
12
+ install-uv:
13
+ curl -LsSf https://astral.sh/uv/install.sh | sh
14
+ @echo "uv installed! You may need to restart your shell or run 'source ~/.bashrc'"
15
+
16
+ # Create virtual environment
17
+ venv:
18
+ uv venv --python $(PYTHON_VERSION) .venv
19
+ @echo 'run `source .venv/bin/activate` to start develop Navigator-Session'
20
+
21
+ # Install production dependencies using lock file
22
+ install:
23
+ uv sync --frozen --no-dev
24
+ @echo "Production dependencies installed."
25
+
26
+ # Generate lock files
27
+ lock:
28
+ ifdef HAS_UV
29
+ uv lock
30
+ else
31
+ @echo "Lock files require uv. Install with: make install-uv"
32
+ endif
33
+
34
+ # Install all dependencies including dev dependencies
35
+ develop:
36
+ uv sync --frozen --dev
37
+
38
+ # Alternative: install without lock file (faster for development)
39
+ develop-fast:
40
+ uv pip install -e .
41
+ uv pip install -e .[dev]
42
+
43
+ # Build and publish release
44
+ release: lint test clean
45
+ uv build
46
+ uv publish
47
+
48
+ # Format code
49
+ format:
50
+ uv run black navigator_session
51
+
52
+ # Lint code
53
+ lint:
54
+ uv run pylint --rcfile .pylintrc navigator_session/*.py
55
+ uv run black --check navigator_session
56
+
57
+ # Run tests
58
+ test:
59
+ uv run coverage run -m pytest tests
60
+ uv run coverage report
61
+ uv run mypy navigator_session/*.py
62
+
63
+ # Performance tests
64
+ perf:
65
+ uv run python -m unittest -v navigator_session.tests.perf
66
+
67
+ # Clean build artifacts
68
+ clean:
69
+ rm -rf build/
70
+ rm -rf dist/
71
+ rm -rf *.egg-info/
72
+ find . -name "*.pyc" -delete
73
+ find . -name "*.pyo" -delete
74
+ find . -name "*.so" -delete
75
+ find . -type d -name __pycache__ -delete
76
+ @echo "Clean complete."
77
+
78
+ # Remove virtual environment
79
+ distclean:
80
+ rm -rf .venv
81
+ rm -rf uv.lock
82
+
83
+ # Show project info
84
+ info:
85
+ uv tree
@@ -1,18 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: navigator-session
3
- Version: 0.6.0rc1
3
+ Version: 0.7.0
4
4
  Summary: Navigator Session allows us to store user-specific data into session object.
5
- Home-page: https://github.com/phenobarbital/navigator-session
6
- Author: Jesus Lara
7
- Author-email: jesuslarag@gmail.com
8
- License: Apache-2.0
5
+ Author-email: Jesus Lara Gimenez <jesuslarag@gmail.com>
6
+ License: Apache 2.0
7
+ Project-URL: Homepage, https://github.com/phenobarbital/navigator-session
9
8
  Project-URL: Source, https://github.com/phenobarbital/navigator-session
10
9
  Project-URL: Funding, https://paypal.me/phenobarbital
11
- Project-URL: Say Thanks!, https://saythanks.io/to/phenobarbital
12
- Keywords: asyncio,session,aioredis,aiohttp
13
- Platform: POSIX
10
+ Project-URL: Documentation, https://github.com/phenobarbital/navigator-session
14
11
  Classifier: Development Status :: 4 - Beta
15
12
  Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
16
14
  Classifier: Operating System :: POSIX :: Linux
17
15
  Classifier: Environment :: Web Environment
18
16
  Classifier: Topic :: Software Development :: Build Tools
@@ -24,9 +22,17 @@ Classifier: Programming Language :: Python :: 3.11
24
22
  Classifier: Programming Language :: Python :: 3.12
25
23
  Classifier: Framework :: AsyncIO
26
24
  Classifier: Framework :: aiohttp
27
- Requires-Python: >=3.9.16
25
+ Classifier: License :: OSI Approved :: Apache Software License
26
+ Requires-Python: >=3.9.13
28
27
  Description-Content-Type: text/markdown
29
28
  License-File: LICENSE
29
+ Requires-Dist: aiohttp>=3.9.5
30
+ Requires-Dist: asyncio==3.4.3
31
+ Requires-Dist: jsonpickle>=3.0.2
32
+ Requires-Dist: redis>=5.0.4
33
+ Requires-Dist: python-datamodel>=0.7.0
34
+ Requires-Dist: navconfig[default]>=1.7.0
35
+ Dynamic: license-file
30
36
 
31
37
  # Navigator_Session #
32
38
 
@@ -55,5 +61,3 @@ Navigator_Session Allows us to store User-based data into a session Object, this
55
61
  ### License ###
56
62
 
57
63
  Navigator_Session is copyright of Jesus Lara (https://phenobarbital.info) and under Apache 2 license. I am providing code in this repository under an open source license, remember, this is my personal repository; the license that you receive is from me and not from my employeer.
58
-
59
-
@@ -18,4 +18,4 @@ pytest-assume==2.4.3
18
18
  sdist==0.0.0
19
19
  sphinx==6.1.3
20
20
  tox==4.6.4
21
- twine==4.0.2
21
+ twine==5.1.1
@@ -12,6 +12,7 @@ from .conf import (
12
12
  AUTH_SESSION_OBJECT,
13
13
  SESSION_TIMEOUT,
14
14
  SESSION_KEY,
15
+ SESSION_ID,
15
16
  SESSION_REQUEST_KEY,
16
17
  SESSION_URL,
17
18
  SESSION_PREFIX,
@@ -27,6 +28,7 @@ __all__ = (
27
28
  'SESSION_URL',
28
29
  'SESSION_PREFIX',
29
30
  'SESSION_KEY',
31
+ 'SESSION_ID',
30
32
  'SESSION_USER_PROPERTY',
31
33
  )
32
34
 
@@ -1,9 +1,8 @@
1
1
  import uuid
2
2
  import time
3
3
  from typing import Union, Optional, Any
4
- from datetime import datetime
4
+ from datetime import datetime, timezone
5
5
  from collections.abc import Iterator, Mapping, MutableMapping
6
- import pendulum
7
6
  import jsonpickle
8
7
  from jsonpickle.unpickler import loadclass
9
8
  from aiohttp import web
@@ -25,11 +24,7 @@ class ModelHandler(jsonpickle.handlers.BaseHandler):
25
24
  def restore(self, obj):
26
25
  module_and_type = obj['py/object']
27
26
  mdl = loadclass(module_and_type)
28
- if hasattr(mdl, '__new__'):
29
- cls = mdl.__new__(mdl)
30
- else:
31
- cls = object.__new__(mdl)
32
-
27
+ cls = mdl.__new__(mdl) if hasattr(mdl, '__new__') else object.__new__(mdl)
33
28
  cls.__dict__ = self.context.restore(obj['__dict__'], reset=False)
34
29
  return cls
35
30
 
@@ -53,33 +48,29 @@ class SessionData(MutableMapping[str, Any]):
53
48
  self._changed = False
54
49
  self._data = {}
55
50
  # Unique ID:
56
- self._id_ = data.get(SESSION_ID, None) if data else id
57
- if not self._id_:
58
- self._id_ = uuid.uuid4().hex
51
+ self._id_ = (data.get(SESSION_ID, None) if data else id) or uuid.uuid4().hex
59
52
  # Session Identity
60
- self._identity = data.get(SESSION_KEY, None) if data else identity
61
- if not self._identity:
62
- self._identity = self._id_
53
+ self._identity = (
54
+ data.get(SESSION_KEY, None) if data else identity
55
+ ) or self._id_
63
56
  self._new = new if data != {} else True
64
- self._max_age = max_age if max_age else None
57
+ self._max_age = max_age or None
65
58
  created = data.get('created', None) if data else None
66
- self._now = pendulum.now('UTC') # time for this instance creation
59
+ self._now = datetime.now(timezone.utc)
67
60
  self.__created__ = self._now
68
- now = int(self._now.int_timestamp)
61
+ now = int(self._now.timestamp())
69
62
  self._now = now # time for this instance creation
70
63
  age = now - created if created else now
71
64
  if max_age is not None and age > max_age:
72
65
  data = None
73
- if self._new or created is None:
74
- self._created = now
75
- else:
76
- self._created = created
66
+ self._created = now if self._new or created is None else created
77
67
  ## Data updating.
78
68
  if data is not None:
79
69
  self._data.update(data)
80
70
  # Other mark timestamp for this session:
81
- dt = pendulum.now('UTC')
82
- self._dow = dt.day_of_week
71
+ dt = datetime.now(timezone.utc)
72
+ self._dow = dt.weekday()
73
+ self._doy = dt.timetuple().tm_yday
83
74
  self._time = dt.time()
84
75
  self.args = args
85
76
 
@@ -83,20 +83,31 @@ class RedisStorage(AbstractStorage):
83
83
  data = None
84
84
  session_id = request.get(SESSION_ID, None)
85
85
  if session_id:
86
- _id_ = f"user:{session_id}"
86
+ _id_ = f"session:{session_id}"
87
87
  data = await conn.get(_id_)
88
88
  if data is None:
89
89
  # nothing to forgot
90
90
  return True
91
91
  try:
92
92
  # delete the ID of the session
93
- await conn.delete(f"user:{session.session_id}")
93
+ await conn.delete(f"session:{session.session_id}")
94
94
  session.invalidate() # invalidate this session object
95
95
  except Exception as err: # pylint: disable=W0703
96
96
  self._logger.error(err)
97
97
  return False
98
98
  return True
99
99
 
100
+ async def get_session_id(self, conn: aioredis.Redis, identity: str) -> str:
101
+ """Get Session ID from Redis."""
102
+ try:
103
+ session_id = await conn.get(f"user:{identity}")
104
+ except Exception as err:
105
+ self._logger.error(
106
+ f'Redis Storage: Error Getting Session ID: {err!s}'
107
+ )
108
+ session_id = None
109
+ return session_id
110
+
100
111
  async def load_session(
101
112
  self,
102
113
  request: web.Request,
@@ -136,6 +147,12 @@ class RedisStorage(AbstractStorage):
136
147
  session_id = request.get(SESSION_ID, None)
137
148
  if not session_id:
138
149
  session_id = userdata.get(SESSION_ID, None) if userdata else None
150
+ # get session id from redis using identity:
151
+ session_identity = userdata.get(
152
+ SESSION_KEY, None) if userdata else request.get(SESSION_KEY, None)
153
+ if not session_id:
154
+ session_id = await self.get_session_id(conn, session_identity)
155
+ print('SESSION IDENTITY IS:', session_identity, session_id)
139
156
  if session_id is None and new is False:
140
157
  # No Session was found, returning false:
141
158
  return False
@@ -143,10 +160,7 @@ class RedisStorage(AbstractStorage):
143
160
  self._logger.debug(
144
161
  f':::::: LOAD SESSION FOR {session_id} ::::: '
145
162
  )
146
- _id_ = f"user:{session_id}"
147
- session_identity = request.get(SESSION_KEY, None)
148
- if not session_identity:
149
- session_identity = userdata.get(SESSION_KEY, None) if userdata else None
163
+ _id_ = f"session:{session_id}"
150
164
  try:
151
165
  data = await conn.get(_id_)
152
166
  except Exception as err: # pylint: disable=W0703
@@ -219,7 +233,7 @@ class RedisStorage(AbstractStorage):
219
233
  expire = max_age if max_age is not None else 0
220
234
  try:
221
235
  conn = aioredis.Redis(connection_pool=self._redis)
222
- _id_ = f"user:{session_id}"
236
+ _id_ = f"session:{session_id}"
223
237
  await conn.set(
224
238
  _id_, data, expire
225
239
  )
@@ -235,33 +249,49 @@ class RedisStorage(AbstractStorage):
235
249
  ) -> SessionData:
236
250
  """Create a New Session Object for this User."""
237
251
  session_identity = request.get(SESSION_KEY, None)
238
- session_id = request.get(SESSION_ID, None)
252
+ session_id = data.get(SESSION_ID, request.get(SESSION_ID, None))
253
+ try:
254
+ conn = aioredis.Redis(connection_pool=self._redis)
255
+ except Exception as err:
256
+ self._logger.error(
257
+ f'Redis Storage: Error loading Redis Session: {err!s}'
258
+ )
259
+ raise RuntimeError(
260
+ f'Redis Storage: Error loading Redis Session: {err!s}'
261
+ ) from err
262
+ if not session_id:
263
+ session_id = await self.get_session_id(conn, session_identity)
239
264
  if not session_id:
240
265
  try:
241
- session_id = data.get(SESSION_ID)
266
+ session_id = data[SESSION_ID]
242
267
  except KeyError:
243
268
  session_id = self.id_factory()
244
269
  self._logger.debug(
245
- f':::::: START CREATING A NEW SESSION FOR {session_id} ::::: '
270
+ f':::::: CREATING A NEW SESSION FOR {session_id} ::::: '
246
271
  )
247
272
  if not data:
248
273
  data = {}
249
274
  # saving this new session on DB
250
275
  try:
251
- conn = aioredis.Redis(connection_pool=self._redis)
252
276
  t = time.time()
253
277
  data['created'] = t
254
278
  data['last_visit'] = t
255
279
  data[SESSION_KEY] = session_identity
256
280
  data[SESSION_ID] = session_id
257
281
  dt = self._encoder(data)
258
- _id_ = f'user:{session_id}'
282
+ _id_ = f'session:{session_id}'
259
283
  result = await conn.set(
260
284
  _id_, dt, self.max_age
261
285
  )
262
286
  self._logger.debug(
263
287
  f'Session Creation: {result}'
264
288
  )
289
+ # Saving the Session ID on redis:
290
+ await conn.set(
291
+ f"user:{session_identity}",
292
+ session_id,
293
+ self.max_age
294
+ )
265
295
  except Exception as err: # pylint: disable=W0703
266
296
  self._logger.exception(err)
267
297
  return False
@@ -294,8 +324,8 @@ class RedisStorage(AbstractStorage):
294
324
  ## add other options to session:
295
325
  self.session_info(session, request)
296
326
  session[SESSION_KEY] = session_identity
327
+ request[SESSION_ID] = session_id
297
328
  request[SESSION_OBJECT] = session
298
329
  request[SESSION_KEY] = session_identity
299
- request[SESSION_ID] = session_id
300
330
  request[SESSION_REQUEST_KEY] = session
301
331
  return session
@@ -1,11 +1,13 @@
1
1
  """Navigator Session Meta information.
2
2
  Navigator Session allows us to store user-specific data into session object.
3
3
  """
4
-
5
4
  __title__ = 'navigator_session'
6
- __description__ = ('Navigator Session allows us to store user-specific data '
7
- 'into session object.')
8
- __version__ = '0.6.0rc1'
5
+ __description__ = (
6
+ 'Navigator Session allows us to store user-specific data '
7
+ 'into session object.'
8
+ )
9
+ __version__ = '0.7.0'
10
+ __copyright__ = 'Copyright (c) 2023 Jesus Lara'
9
11
  __author__ = 'Jesus Lara'
10
12
  __author_email__ = 'jesuslarag@gmail.com'
11
13
  __license__ = 'Apache-2.0'
@@ -1,18 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: navigator-session
3
- Version: 0.6.0rc1
3
+ Version: 0.7.0
4
4
  Summary: Navigator Session allows us to store user-specific data into session object.
5
- Home-page: https://github.com/phenobarbital/navigator-session
6
- Author: Jesus Lara
7
- Author-email: jesuslarag@gmail.com
8
- License: Apache-2.0
5
+ Author-email: Jesus Lara Gimenez <jesuslarag@gmail.com>
6
+ License: Apache 2.0
7
+ Project-URL: Homepage, https://github.com/phenobarbital/navigator-session
9
8
  Project-URL: Source, https://github.com/phenobarbital/navigator-session
10
9
  Project-URL: Funding, https://paypal.me/phenobarbital
11
- Project-URL: Say Thanks!, https://saythanks.io/to/phenobarbital
12
- Keywords: asyncio,session,aioredis,aiohttp
13
- Platform: POSIX
10
+ Project-URL: Documentation, https://github.com/phenobarbital/navigator-session
14
11
  Classifier: Development Status :: 4 - Beta
15
12
  Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
16
14
  Classifier: Operating System :: POSIX :: Linux
17
15
  Classifier: Environment :: Web Environment
18
16
  Classifier: Topic :: Software Development :: Build Tools
@@ -24,9 +22,17 @@ Classifier: Programming Language :: Python :: 3.11
24
22
  Classifier: Programming Language :: Python :: 3.12
25
23
  Classifier: Framework :: AsyncIO
26
24
  Classifier: Framework :: aiohttp
27
- Requires-Python: >=3.9.16
25
+ Classifier: License :: OSI Approved :: Apache Software License
26
+ Requires-Python: >=3.9.13
28
27
  Description-Content-Type: text/markdown
29
28
  License-File: LICENSE
29
+ Requires-Dist: aiohttp>=3.9.5
30
+ Requires-Dist: asyncio==3.4.3
31
+ Requires-Dist: jsonpickle>=3.0.2
32
+ Requires-Dist: redis>=5.0.4
33
+ Requires-Dist: python-datamodel>=0.7.0
34
+ Requires-Dist: navconfig[default]>=1.7.0
35
+ Dynamic: license-file
30
36
 
31
37
  # Navigator_Session #
32
38
 
@@ -55,5 +61,3 @@ Navigator_Session Allows us to store User-based data into a session Object, this
55
61
  ### License ###
56
62
 
57
63
  Navigator_Session is copyright of Jesus Lara (https://phenobarbital.info) and under Apache 2 license. I am providing code in this repository under an open source license, remember, this is my personal repository; the license that you receive is from me and not from my employeer.
58
-
59
-
@@ -0,0 +1,6 @@
1
+ aiohttp>=3.9.5
2
+ asyncio==3.4.3
3
+ jsonpickle>=3.0.2
4
+ redis>=5.0.4
5
+ python-datamodel>=0.7.0
6
+ navconfig[default]>=1.7.0
@@ -0,0 +1,95 @@
1
+ [build-system]
2
+ requires = [
3
+ 'setuptools>=74.0.0',
4
+ 'Cython>=3.0.11',
5
+ 'wheel>=0.44.0'
6
+ ]
7
+ build-backend = "setuptools.build_meta"
8
+
9
+ [project]
10
+ name = "navigator-session"
11
+ version = "0.7.0"
12
+ description = "Navigator Session allows us to store user-specific data into session object."
13
+ readme = "README.md"
14
+ requires-python = ">=3.9.13"
15
+ license = { text = "Apache 2.0" }
16
+ authors = [
17
+ { name = "Jesus Lara Gimenez", email = "jesuslarag@gmail.com" }
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: System Administrators",
23
+ "Operating System :: POSIX :: Linux",
24
+ "Environment :: Web Environment",
25
+ "Topic :: Software Development :: Build Tools",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Topic :: Database :: Front-Ends",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Framework :: AsyncIO",
33
+ "Framework :: aiohttp",
34
+ "License :: OSI Approved :: Apache Software License",
35
+ ]
36
+ dependencies = [
37
+ "aiohttp>=3.9.5",
38
+ "asyncio==3.4.3",
39
+ "jsonpickle>=3.0.2",
40
+ "redis>=5.0.4",
41
+ "python-datamodel>=0.7.0",
42
+ "navconfig[default]>=1.7.0",
43
+ ]
44
+
45
+ [dependency-groups]
46
+ dev = [
47
+ "pytest",
48
+ "pytest-asyncio",
49
+ "pytest-cov",
50
+ "coverage",
51
+ "mypy",
52
+ "pylint",
53
+ "black",
54
+ "flake8"
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://github.com/phenobarbital/navigator-session"
59
+ Source = "https://github.com/phenobarbital/navigator-session"
60
+ Funding = "https://paypal.me/phenobarbital"
61
+ Documentation = "https://github.com/phenobarbital/navigator-session"
62
+
63
+ [tool.setuptools]
64
+ packages = ["navigator_session"]
65
+
66
+ [tool.pytest.ini_options]
67
+ addopts = [
68
+ "--strict-config",
69
+ "--strict-markers",
70
+ ]
71
+ log_cli = true
72
+ log_cli_level = "DEBUG"
73
+ log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
74
+ log_cli_date_format = "%Y-%m-%d %H:%M:%S"
75
+ filterwarnings = [
76
+ "error",
77
+ 'ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10:DeprecationWarning:asyncio',
78
+ ]
79
+
80
+ [tool.black]
81
+ line-length = 88
82
+ include = '\.pyi?$'
83
+ exclude = '''
84
+ /(
85
+ \.git
86
+ | \.hg
87
+ | \.mypy_cache
88
+ | \.tox
89
+ | \.venv
90
+ | _build
91
+ | buck-out
92
+ | build
93
+ | dist
94
+ )/
95
+ '''
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python
2
+ """Minimal setup.py shim."""
3
+
4
+ from setuptools import setup
5
+
6
+ if __name__ == "__main__":
7
+ setup()
@@ -1,35 +0,0 @@
1
- venv:
2
- python3.10 -m venv .venv
3
- echo 'run `source .venv/bin/activate` to start develop Navigator-Session'
4
-
5
- setup:
6
- pip install wheel==0.42.0
7
- pip install -e .
8
-
9
- develop:
10
- pip install wheel==0.42.0
11
- pip install -e .
12
- pip install -Ur docs/requirements-dev.txt
13
- flit install --symlink
14
-
15
- release:
16
- lint test clean
17
- flit publish
18
-
19
- format:
20
- python -m black navigator_session
21
-
22
- lint:
23
- python -m pylint --rcfile .pylintrc navigator_session/*.py
24
- python -m black --check navigator_session
25
-
26
- test:
27
- python -m coverage run -m navigator_session.tests
28
- python -m coverage report
29
- python -m mypy navigator_session/*.py
30
-
31
- perf:
32
- python -m unittest -v navigator_session.tests.perf
33
-
34
- distclean:
35
- rm -rf .venv
@@ -1,7 +0,0 @@
1
- aiohttp>=3.9.5
2
- asyncio==3.4.3
3
- jsonpickle>=3.0.2
4
- navconfig[default]>=1.6.3
5
- python_datamodel>=0.2.1
6
- redis>=5.0.4
7
- uvloop==0.19.0
@@ -1,68 +0,0 @@
1
- [build-system]
2
- requires = [
3
- 'setuptools==67.6.1',
4
- 'Cython==3.0.9',
5
- 'wheel==0.42.0'
6
- ]
7
-
8
- build-backend = "setuptools.build_meta"
9
-
10
- [tool.flit.metadata]
11
- module = "navigator_session"
12
- author = "Jesus Lara Gimenez"
13
- author-email = "jesuslarag@gmail.com"
14
- home-page = "https://github.com/phenobarbital/navigator-session"
15
- classifiers=[
16
- "Development Status :: 4 - Beta",
17
- "Intended Audience :: Developers",
18
- "Intended Audience :: System Administrators",
19
- "Operating System :: OS Independent",
20
- "Programming Language :: Python :: 3.9",
21
- "Programming Language :: Python :: 3.10",
22
- "Programming Language :: Python :: 3.11",
23
- "Programming Language :: Python :: 3.12",
24
- "Programming Language :: Python",
25
- "Typing :: Typed",
26
- "Environment :: Web Environment",
27
- "Framework :: AsyncIO",
28
- "Framework :: AIOHTTP",
29
- "Topic :: Software Development :: Libraries :: Application Frameworks",
30
- "Topic :: Software Development :: Libraries :: Python Modules",
31
- "Topic :: Software Development :: Build Tools",
32
- "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
33
- "Topic :: Internet :: WWW/HTTP",
34
- "License :: OSI Approved :: BSD License",
35
- ]
36
- description-file = "README.md"
37
- requires-python = ">=3.9.16"
38
-
39
- [tool.pytest.ini_options]
40
- addopts = [
41
- "--strict-config",
42
- "--strict-markers",
43
- ]
44
- log_cli = true
45
- log_cli_level = "DEBUG"
46
- log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
47
- log_cli_date_format = "%Y-%m-%d %H:%M:%S"
48
- filterwarnings = [
49
- "error",
50
- 'ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10:DeprecationWarning:asyncio',
51
- ]
52
-
53
- [tool.black]
54
- line-length = 88
55
- include = '\.pyi?$'
56
- exclude = '''
57
- /(
58
- \.git
59
- | \.hg
60
- | \.mypy_cache
61
- | \.tox
62
- | \.venv
63
- | _build
64
- | buck-out
65
- | build
66
- | dist
67
- )/
68
- '''
@@ -1,102 +0,0 @@
1
- #!/usr/bin/env python
2
- """Navigator-Session.
3
-
4
- Asynchronous library for managing user-specific data into a session object,
5
- used by Navigator.
6
- See:
7
- https://github.com/phenobarbital/navigator-session
8
- """
9
- import ast
10
- from os import path
11
- from setuptools import find_packages, setup
12
-
13
-
14
- def get_path(filename):
15
- return path.join(path.dirname(path.abspath(__file__)), filename)
16
-
17
-
18
- def readme():
19
- with open(get_path('README.md'), 'r', encoding='utf-8') as rd:
20
- return rd.read()
21
-
22
-
23
- version = get_path('navigator_session/version.py')
24
- with open(version, 'r', encoding='utf-8') as meta:
25
- # exec(meta.read())
26
- t = compile(meta.read(), version, 'exec', ast.PyCF_ONLY_AST)
27
- for node in (n for n in t.body if isinstance(n, ast.Assign)):
28
- if len(node.targets) == 1:
29
- name = node.targets[0]
30
- if isinstance(name, ast.Name) and \
31
- name.id in (
32
- '__version__',
33
- '__title__',
34
- '__description__',
35
- '__author__',
36
- '__license__',
37
- '__author_email__'
38
- ):
39
- v = node.value
40
- if name.id == '__version__':
41
- __version__ = v.s
42
- if name.id == '__title__':
43
- __title__ = v.s
44
- if name.id == '__description__':
45
- __description__ = v.s
46
- if name.id == '__license__':
47
- __license__ = v.s
48
- if name.id == '__author__':
49
- __author__ = v.s
50
- if name.id == '__author_email__':
51
- __author_email__ = v.s
52
-
53
-
54
- setup(
55
- name="navigator-session",
56
- version=__version__,
57
- python_requires=">=3.9.16",
58
- url="https://github.com/phenobarbital/navigator-session",
59
- description=__description__,
60
- keywords=['asyncio', 'session', 'aioredis', 'aiohttp'],
61
- platforms=['POSIX'],
62
- long_description=readme(),
63
- long_description_content_type='text/markdown',
64
- classifiers=[
65
- "Development Status :: 4 - Beta",
66
- "Intended Audience :: Developers",
67
- "Operating System :: POSIX :: Linux",
68
- "Environment :: Web Environment",
69
- "Topic :: Software Development :: Build Tools",
70
- "Topic :: Software Development :: Libraries :: Python Modules",
71
- "Topic :: Database :: Front-Ends",
72
- "Programming Language :: Python :: 3.9",
73
- "Programming Language :: Python :: 3.10",
74
- "Programming Language :: Python :: 3.11",
75
- "Programming Language :: Python :: 3.12",
76
- "Framework :: AsyncIO",
77
- "Framework :: aiohttp",
78
- ],
79
- author=__author__,
80
- author_email=__author_email__,
81
- packages=find_packages(exclude=["contrib", "docs", "tests"]),
82
- license=__license__,
83
- setup_requires=[
84
- "wheel==0.42.0",
85
- "Cython==3.0.9",
86
- "asyncio==3.4.3"
87
- ],
88
- install_requires=[
89
- "aiohttp>=3.9.5",
90
- "uvloop==0.19.0",
91
- "asyncio==3.4.3",
92
- "jsonpickle>=3.0.2",
93
- "redis>=5.0.4",
94
- "python_datamodel>=0.2.1",
95
- "navconfig[default]>=1.6.3",
96
- ],
97
- project_urls={ # Optional
98
- "Source": "https://github.com/phenobarbital/navigator-session",
99
- "Funding": "https://paypal.me/phenobarbital",
100
- "Say Thanks!": "https://saythanks.io/to/phenobarbital",
101
- },
102
- )