zenx 0.9.3__tar.gz → 0.9.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.
Files changed (33) hide show
  1. {zenx-0.9.3 → zenx-0.9.4}/PKG-INFO +6 -4
  2. {zenx-0.9.3 → zenx-0.9.4}/pyproject.toml +15 -7
  3. zenx-0.9.4/zenx/pipelines/discord.py +65 -0
  4. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/PKG-INFO +6 -4
  5. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/requires.txt +4 -1
  6. zenx-0.9.3/zenx/pipelines/discord.py +0 -45
  7. {zenx-0.9.3 → zenx-0.9.4}/setup.cfg +0 -0
  8. {zenx-0.9.3 → zenx-0.9.4}/zenx/cli.py +0 -0
  9. {zenx-0.9.3 → zenx-0.9.4}/zenx/clients/__init__.py +0 -0
  10. {zenx-0.9.3 → zenx-0.9.4}/zenx/clients/database.py +0 -0
  11. {zenx-0.9.3 → zenx-0.9.4}/zenx/clients/http.py +0 -0
  12. {zenx-0.9.3 → zenx-0.9.4}/zenx/debug_runner.py +0 -0
  13. {zenx-0.9.3 → zenx-0.9.4}/zenx/discovery.py +0 -0
  14. {zenx-0.9.3 → zenx-0.9.4}/zenx/engine.py +0 -0
  15. {zenx-0.9.3 → zenx-0.9.4}/zenx/exceptions.py +0 -0
  16. {zenx-0.9.3 → zenx-0.9.4}/zenx/logger.py +0 -0
  17. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/__init__.py +0 -0
  18. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/base.py +0 -0
  19. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/google_rpc.py +0 -0
  20. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/manager.py +0 -0
  21. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/preprocess.py +0 -0
  22. {zenx-0.9.3 → zenx-0.9.4}/zenx/pipelines/websocket.py +0 -0
  23. {zenx-0.9.3 → zenx-0.9.4}/zenx/resources/proto/__init__.py +0 -0
  24. {zenx-0.9.3 → zenx-0.9.4}/zenx/resources/proto/feed_pb2.py +0 -0
  25. {zenx-0.9.3 → zenx-0.9.4}/zenx/resources/proto/feed_pb2_grpc.py +0 -0
  26. {zenx-0.9.3 → zenx-0.9.4}/zenx/settings.py +0 -0
  27. {zenx-0.9.3 → zenx-0.9.4}/zenx/spiders/__init__.py +0 -0
  28. {zenx-0.9.3 → zenx-0.9.4}/zenx/spiders/base.py +0 -0
  29. {zenx-0.9.3 → zenx-0.9.4}/zenx/utils.py +0 -0
  30. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/SOURCES.txt +0 -0
  31. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/dependency_links.txt +0 -0
  32. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/entry_points.txt +0 -0
  33. {zenx-0.9.3 → zenx-0.9.4}/zenx.egg-info/top_level.txt +0 -0
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zenx
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: mini-framework
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: curl-cffi>=0.12.0
7
- Requires-Dist: httpx>=0.28.1
8
7
  Requires-Dist: parsel>=1.10.0
9
8
  Requires-Dist: pebble>=5.1.1
10
9
  Requires-Dist: pydantic>=2.11.7
@@ -18,6 +17,10 @@ Requires-Dist: redis[hiredis]>=6.2.0; extra == "redis"
18
17
  Provides-Extra: grpc
19
18
  Requires-Dist: grpcio>=1.73.1; extra == "grpc"
20
19
  Requires-Dist: protobuf>=6.31.1; extra == "grpc"
20
+ Provides-Extra: websocket
21
+ Requires-Dist: websockets>=15.0.1; extra == "websocket"
22
+ Provides-Extra: discord
23
+ Requires-Dist: httpx>=0.28.1; extra == "discord"
21
24
  Provides-Extra: all
22
25
  Requires-Dist: curl-cffi>=0.12.0; extra == "all"
23
26
  Requires-Dist: grpcio>=1.73.1; extra == "all"
@@ -31,5 +34,4 @@ Requires-Dist: typer>=0.16.0; extra == "all"
31
34
  Requires-Dist: uvloop>=0.21.0; extra == "all"
32
35
  Requires-Dist: redis[hiredis]>=6.2.0; extra == "all"
33
36
  Requires-Dist: websockets>=15.0.1; extra == "all"
34
- Provides-Extra: websocket
35
- Requires-Dist: websockets>=15.0.1; extra == "websocket"
37
+ Requires-Dist: httpx>=0.28.1; extra == "all"
@@ -1,11 +1,10 @@
1
1
  [project]
2
2
  name = "zenx"
3
- version = "0.9.3"
3
+ version = "0.9.4"
4
4
  description = "mini-framework"
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
7
7
  "curl-cffi>=0.12.0",
8
- "httpx>=0.28.1",
9
8
  "parsel>=1.10.0",
10
9
  "pebble>=5.1.1",
11
10
  "pydantic>=2.11.7",
@@ -20,8 +19,19 @@ dependencies = [
20
19
  zenx = "zenx.cli:app"
21
20
 
22
21
  [project.optional-dependencies]
23
- redis = ["redis[hiredis]>=6.2.0"]
24
- grpc = ["grpcio>=1.73.1","protobuf>=6.31.1"]
22
+ redis = [
23
+ "redis[hiredis]>=6.2.0"
24
+ ]
25
+ grpc = [
26
+ "grpcio>=1.73.1",
27
+ "protobuf>=6.31.1"
28
+ ]
29
+ websocket = [
30
+ "websockets>=15.0.1",
31
+ ]
32
+ discord = [
33
+ "httpx>=0.28.1",
34
+ ]
25
35
  all = [
26
36
  "curl-cffi>=0.12.0",
27
37
  "grpcio>=1.73.1",
@@ -35,7 +45,5 @@ all = [
35
45
  "uvloop>=0.21.0",
36
46
  "redis[hiredis]>=6.2.0",
37
47
  "websockets>=15.0.1",
38
- ]
39
- websocket = [
40
- "websockets>=15.0.1",
48
+ "httpx>=0.28.1",
41
49
  ]
@@ -0,0 +1,65 @@
1
+ from typing import Dict
2
+ from structlog import BoundLogger
3
+
4
+ from zenx.pipelines.base import Pipeline
5
+ from zenx.clients.database import DBClient
6
+ from zenx.settings import Settings
7
+ from zenx.utils import log_processing_time
8
+
9
+
10
+ try:
11
+ from httpx import AsyncClient
12
+
13
+ class SynopticDiscordPipeline(Pipeline): # type: ignore[reportRedeclaration]
14
+ name = "syncoptic_discord"
15
+ required_settings = ["SYNOPTIC_DISCORD_WEBHOOK"]
16
+
17
+
18
+ def __init__(self, logger: BoundLogger, db: DBClient, settings: Settings) -> None:
19
+ super().__init__(logger, db, settings)
20
+ self._uri = settings.SYNOPTIC_DISCORD_WEBHOOK
21
+ self._client = AsyncClient(headers={"Content-Type": "application/json"})
22
+
23
+
24
+ async def start(self) -> None:
25
+ for setting in self.required_settings:
26
+ if not getattr(self.settings, setting):
27
+ raise ValueError(f"Missing required setting: {setting}")
28
+
29
+
30
+ @log_processing_time
31
+ async def process_item(self, item: Dict, spider: str) -> Dict:
32
+ await self._process(item)
33
+ return item
34
+
35
+
36
+ async def _process(self, item: Dict) -> None:
37
+ try:
38
+ _item = {k: v for k, v in item.items() if not k.startswith("_")}
39
+ await self._client.post(self._uri, json=_item)
40
+ except Exception as e:
41
+ self.logger.error("processing", exception=str(e), id=item.get("_id"), pipeline=self.name)
42
+
43
+
44
+ async def close(self) -> None:
45
+ if hasattr(self, "_client") and self._client:
46
+ await self._client.aclose()
47
+ except ModuleNotFoundError:
48
+ # proxy pattern
49
+ class SynopticDiscordPipeline(Pipeline):
50
+ name = "synoptic_discord"
51
+ required_settings = []
52
+
53
+ _ERROR_MESSAGE = (
54
+ f"The '{name}' pipeline is disabled because the required dependencies are not installed. "
55
+ "Please install it to enable this feature:\n\n"
56
+ " pip install 'zenx[discord]'"
57
+ )
58
+
59
+ def __init__(self, *args, **kwargs):
60
+ super().__init__(*args, **kwargs)
61
+ raise ImportError(self._ERROR_MESSAGE)
62
+
63
+ async def start(self) -> None: pass
64
+ async def process_item(self, item: Dict, spider: str) -> Dict: return {}
65
+ async def close(self) -> None: pass
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zenx
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: mini-framework
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: curl-cffi>=0.12.0
7
- Requires-Dist: httpx>=0.28.1
8
7
  Requires-Dist: parsel>=1.10.0
9
8
  Requires-Dist: pebble>=5.1.1
10
9
  Requires-Dist: pydantic>=2.11.7
@@ -18,6 +17,10 @@ Requires-Dist: redis[hiredis]>=6.2.0; extra == "redis"
18
17
  Provides-Extra: grpc
19
18
  Requires-Dist: grpcio>=1.73.1; extra == "grpc"
20
19
  Requires-Dist: protobuf>=6.31.1; extra == "grpc"
20
+ Provides-Extra: websocket
21
+ Requires-Dist: websockets>=15.0.1; extra == "websocket"
22
+ Provides-Extra: discord
23
+ Requires-Dist: httpx>=0.28.1; extra == "discord"
21
24
  Provides-Extra: all
22
25
  Requires-Dist: curl-cffi>=0.12.0; extra == "all"
23
26
  Requires-Dist: grpcio>=1.73.1; extra == "all"
@@ -31,5 +34,4 @@ Requires-Dist: typer>=0.16.0; extra == "all"
31
34
  Requires-Dist: uvloop>=0.21.0; extra == "all"
32
35
  Requires-Dist: redis[hiredis]>=6.2.0; extra == "all"
33
36
  Requires-Dist: websockets>=15.0.1; extra == "all"
34
- Provides-Extra: websocket
35
- Requires-Dist: websockets>=15.0.1; extra == "websocket"
37
+ Requires-Dist: httpx>=0.28.1; extra == "all"
@@ -1,5 +1,4 @@
1
1
  curl-cffi>=0.12.0
2
- httpx>=0.28.1
3
2
  parsel>=1.10.0
4
3
  pebble>=5.1.1
5
4
  pydantic>=2.11.7
@@ -22,6 +21,10 @@ typer>=0.16.0
22
21
  uvloop>=0.21.0
23
22
  redis[hiredis]>=6.2.0
24
23
  websockets>=15.0.1
24
+ httpx>=0.28.1
25
+
26
+ [discord]
27
+ httpx>=0.28.1
25
28
 
26
29
  [grpc]
27
30
  grpcio>=1.73.1
@@ -1,45 +0,0 @@
1
- from httpx import AsyncClient
2
- from typing import Dict
3
- from structlog import BoundLogger
4
-
5
- from zenx.pipelines.base import Pipeline
6
- from zenx.clients.database import DBClient
7
- from zenx.settings import Settings
8
- from zenx.utils import log_processing_time
9
-
10
-
11
-
12
- class SynopticDiscordPipeline(Pipeline):
13
- name = "syncoptic_discord"
14
- required_settings = ["SYNOPTIC_DISCORD_WEBHOOK"]
15
-
16
-
17
- def __init__(self, logger: BoundLogger, db: DBClient, settings: Settings) -> None:
18
- super().__init__(logger, db, settings)
19
- self._uri = settings.SYNOPTIC_DISCORD_WEBHOOK
20
- self._client = AsyncClient(headers={"Content-Type": "application/json"})
21
-
22
-
23
- async def start(self) -> None:
24
- for setting in self.required_settings:
25
- if not getattr(self.settings, setting):
26
- raise ValueError(f"Missing required setting: {setting}")
27
-
28
-
29
- @log_processing_time
30
- async def process_item(self, item: Dict, spider: str) -> Dict:
31
- await self._process(item)
32
- return item
33
-
34
-
35
- async def _process(self, item: Dict) -> None:
36
- try:
37
- _item = {k: v for k, v in item.items() if not k.startswith("_")}
38
- await self._client.post(self._uri, json=_item)
39
- except Exception as e:
40
- self.logger.error("processing", exception=str(e), id=item.get("_id"), pipeline=self.name)
41
-
42
-
43
- async def close(self) -> None:
44
- if hasattr(self, "_client") and self._client:
45
- await self._client.aclose()
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