konecty-sdk-python 0.2.0__tar.gz → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: konecty-sdk-python
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Konecty SDK Python
5
5
  Author-email: Leonardo Leal <leonardo.leal@konecty.com>, Derotino Silveira <derotino.silveira@konecty.com>
6
6
  License: MIT
@@ -28,3 +28,14 @@ Description-Content-Type: text/markdown
28
28
  ## Konecty Python SDK
29
29
 
30
30
  > 🛠️ Work in progress
31
+
32
+ #### Build & Publish
33
+
34
+ It is needed to increase the version number on the [pyproject](./pyproject.toml) file.
35
+
36
+ ```sh
37
+
38
+ uv build
39
+ uvx twine upload --config-file .pypirc --skip-existing dist/*
40
+
41
+ ```
@@ -0,0 +1,14 @@
1
+ ## Konecty Python SDK
2
+
3
+ > 🛠️ Work in progress
4
+
5
+ #### Build & Publish
6
+
7
+ It is needed to increase the version number on the [pyproject](./pyproject.toml) file.
8
+
9
+ ```sh
10
+
11
+ uv build
12
+ uvx twine upload --config-file .pypirc --skip-existing dist/*
13
+
14
+ ```
@@ -25,7 +25,13 @@ cli.add_command(pull_command)
25
25
 
26
26
  def main():
27
27
  """Entry point for the CLI."""
28
- cli()
28
+ import asyncio
29
+ import sys
30
+
31
+ if sys.platform == "win32":
32
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
33
+
34
+ asyncio.run(cli())
29
35
 
30
36
 
31
37
  if __name__ == "__main__":
@@ -9,6 +9,7 @@
9
9
  # ///
10
10
  """Script para aplicar alterações locais ao MongoDB."""
11
11
 
12
+ import asyncio
12
13
  import json
13
14
  from pathlib import Path
14
15
  from typing import Any, Dict, List, Literal, Optional, Set, Tuple, TypedDict, cast
@@ -329,7 +330,7 @@ async def apply_namespace(
329
330
  help="Tenta reescrever em caso de falha",
330
331
  )
331
332
  @click.option("--w", default="majority", help="Nível de escrita do MongoDB")
332
- async def apply_command(
333
+ def apply_command(
333
334
  metadata_dir: str,
334
335
  host: str,
335
336
  port: int,
@@ -345,6 +346,41 @@ async def apply_command(
345
346
  w: str,
346
347
  ) -> None:
347
348
  """Aplica alterações locais ao MongoDB."""
349
+ asyncio.run(
350
+ _apply_command(
351
+ metadata_dir=metadata_dir,
352
+ host=host,
353
+ port=port,
354
+ database=database,
355
+ username=username,
356
+ password=password,
357
+ replicaset=replicaset,
358
+ document=document,
359
+ prune=prune,
360
+ dry_run=dry_run,
361
+ direct_connection=direct_connection,
362
+ retry_writes=retry_writes,
363
+ w=w,
364
+ )
365
+ )
366
+
367
+
368
+ async def _apply_command(
369
+ metadata_dir: str,
370
+ host: str,
371
+ port: int,
372
+ database: str,
373
+ username: Optional[str],
374
+ password: Optional[str],
375
+ replicaset: Optional[str],
376
+ document: Optional[str],
377
+ prune: bool,
378
+ dry_run: bool,
379
+ direct_connection: bool,
380
+ retry_writes: bool,
381
+ w: str,
382
+ ) -> None:
383
+ """Internal async implementation of apply command."""
348
384
  metadata_path = Path(metadata_dir).resolve()
349
385
  if not metadata_path.exists():
350
386
  console.print(f"[red]Diretório {metadata_dir} não encontrado[/red]")
@@ -497,9 +533,11 @@ def main():
497
533
  if sys.platform == "win32":
498
534
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
499
535
 
500
- asyncio.run(apply_command())
536
+ apply_command()
501
537
 
502
538
 
503
539
  if __name__ == "__main__":
504
540
  main()
505
541
  main()
542
+ main()
543
+ main()
@@ -1,5 +1,6 @@
1
1
  """Script para fazer backup dos documentos do MongoDB."""
2
2
 
3
+ import asyncio
3
4
  import json
4
5
  import tarfile
5
6
  import tempfile
@@ -24,7 +25,7 @@ console = Console()
24
25
  @click.option("--password", help="Senha do MongoDB")
25
26
  @click.option("--replicaset", help="Nome do ReplicaSet do MongoDB (ex: rs0)")
26
27
  @click.option("--version", help="Rótulo de versão para o arquivo de backup")
27
- async def backup_command(
28
+ def backup_command(
28
29
  host: str,
29
30
  port: int,
30
31
  database: str,
@@ -35,6 +36,31 @@ async def backup_command(
35
36
  version: Optional[str],
36
37
  ) -> None:
37
38
  """Gera backup dos documentos do MongoDB."""
39
+ asyncio.run(
40
+ _backup_command(
41
+ host=host,
42
+ port=port,
43
+ database=database,
44
+ output=output,
45
+ username=username,
46
+ password=password,
47
+ replicaset=replicaset,
48
+ version=version,
49
+ )
50
+ )
51
+
52
+
53
+ async def _backup_command(
54
+ host: str,
55
+ port: int,
56
+ database: str,
57
+ output: str,
58
+ username: Optional[str],
59
+ password: Optional[str],
60
+ replicaset: Optional[str],
61
+ version: Optional[str],
62
+ ) -> None:
63
+ """Internal async implementation of backup command."""
38
64
  output_dir = Path(output).resolve()
39
65
  output_dir.mkdir(parents=True, exist_ok=True)
40
66
 
@@ -121,7 +147,7 @@ def main():
121
147
  if sys.platform == "win32":
122
148
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
123
149
 
124
- asyncio.run(backup_command())
150
+ backup_command()
125
151
 
126
152
 
127
153
  if __name__ == "__main__":
@@ -1,5 +1,6 @@
1
1
  """Script para extrair dados do MongoDB e gerar arquivos JSON."""
2
2
 
3
+ import asyncio
3
4
  import json
4
5
  from pathlib import Path
5
6
  from typing import Any, Dict, List, Literal, Optional, TypedDict, Union, cast
@@ -90,7 +91,7 @@ async def write_file(file_path: str, content: str) -> None:
90
91
  is_flag=True,
91
92
  help="Extrair todas as collections sem perguntar",
92
93
  )
93
- async def pull_command(
94
+ def pull_command(
94
95
  host: str,
95
96
  port: int,
96
97
  database: str,
@@ -107,6 +108,43 @@ async def pull_command(
107
108
  extract_all: bool,
108
109
  ) -> None:
109
110
  """Baixa metadados do MongoDB."""
111
+ asyncio.run(
112
+ _pull_command(
113
+ host=host,
114
+ port=port,
115
+ database=database,
116
+ output=output,
117
+ username=username,
118
+ password=password,
119
+ replicaset=replicaset,
120
+ document=document,
121
+ view=view,
122
+ list_param=list_param,
123
+ pivot=pivot,
124
+ access=access,
125
+ hook=hook,
126
+ extract_all=extract_all,
127
+ )
128
+ )
129
+
130
+
131
+ async def _pull_command(
132
+ host: str,
133
+ port: int,
134
+ database: str,
135
+ output: str,
136
+ username: Optional[str],
137
+ password: Optional[str],
138
+ replicaset: Optional[str],
139
+ document: Optional[str],
140
+ view: Optional[str],
141
+ list_param: Optional[str],
142
+ pivot: Optional[str],
143
+ access: Optional[str],
144
+ hook: Optional[str],
145
+ extract_all: bool,
146
+ ) -> None:
147
+ """Internal async implementation of pull command."""
110
148
  output_dir = Path(output).resolve()
111
149
  output_dir.mkdir(parents=True, exist_ok=True)
112
150
 
@@ -258,7 +296,7 @@ def main():
258
296
  if sys.platform == "win32":
259
297
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
260
298
 
261
- asyncio.run(pull_command())
299
+ pull_command()
262
300
 
263
301
 
264
302
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "konecty-sdk-python"
3
- version = "0.2.0"
3
+ version = "0.4.0"
4
4
  description = "Konecty SDK Python"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,3 +0,0 @@
1
- ## Konecty Python SDK
2
-
3
- > 🛠️ Work in progress