tinycontracts 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

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.
tinycontracts/cli.py CHANGED
@@ -25,7 +25,7 @@ def print_banner(host: str, port: int, resources: list[str], folder: Path):
25
25
  console.print()
26
26
  console.print(
27
27
  Panel.fit(
28
- "[bold cyan]tinycontracts[/bold cyan] [dim]v0.1.0[/dim]",
28
+ "[bold cyan]tinycontracts[/bold cyan] [dim]v0.1.1[/dim]",
29
29
  border_style="cyan",
30
30
  )
31
31
  )
@@ -127,7 +127,7 @@ def serve(
127
127
  @app.command()
128
128
  def version():
129
129
  """show version"""
130
- console.print("tinycontracts [cyan]v0.1.0[/cyan]")
130
+ console.print("tinycontracts [cyan]v0.1.1[/cyan]")
131
131
 
132
132
 
133
133
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinycontracts
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: serve a folder of json/csv/parquet files as a rest api
5
5
  Author-email: Aditya Kumar <adityakuma0308@gmail.com>
6
6
  License-Expression: MIT
@@ -29,16 +29,20 @@ Turn JSON, CSV, and Parquet files into REST APIs instantly.
29
29
  ## Install
30
30
 
31
31
  ```bash
32
- uv sync
32
+ pip install tinycontracts
33
33
  ```
34
34
 
35
35
  ## Usage
36
36
 
37
37
  ```bash
38
- tinycontracts serve ./data
38
+ tc ./data
39
39
  ```
40
40
 
41
- This scans `./data` for `.json`, `.csv`, and `.parquet` files and serves them as REST endpoints.
41
+ Or with options:
42
+
43
+ ```bash
44
+ tc ./data --port 8000 --host 0.0.0.0
45
+ ```
42
46
 
43
47
  ## Example
44
48
 
@@ -47,27 +51,43 @@ Given this structure:
47
51
  data/
48
52
  users.json
49
53
  orders.csv
50
- products.parquet
54
+ config.json
51
55
  ```
52
56
 
53
57
  You get:
54
58
  ```
55
- GET /users
56
- GET /orders
57
- GET /products
59
+ GET /users # list all users
60
+ GET /users/1 # get user by id
61
+ GET /orders # list all orders
62
+ GET /config # get config
63
+
64
+ GET /_help # api documentation
65
+ GET /_schema # all schemas
66
+ GET /docs # swagger ui
58
67
  ```
59
68
 
60
- ## Filtering
69
+ ## Filtering & Pagination
61
70
 
62
- Query any field:
63
- ```
64
- GET /users?role=admin
65
- GET /orders?status=shipped&customer_id=123
71
+ ```bash
72
+ # filter by field
73
+ curl "localhost:4242/users?active=true"
74
+
75
+ # pagination
76
+ curl "localhost:4242/orders?_limit=10&_offset=20"
77
+
78
+ # sorting
79
+ curl "localhost:4242/orders?_sort=-created_at"
80
+
81
+ # combine
82
+ curl "localhost:4242/orders?status=pending&_limit=5&_sort=-amount"
66
83
  ```
67
84
 
68
85
  ## Schema
69
86
 
70
- Get the inferred JSON schema:
71
- ```
72
- GET /users/schema
87
+ ```bash
88
+ # all schemas
89
+ curl localhost:4242/_schema
90
+
91
+ # single resource schema
92
+ curl localhost:4242/users/_schema
73
93
  ```
@@ -1,10 +1,10 @@
1
1
  tinycontracts/__init__.py,sha256=WEsinRwkR1RI9izRzpTB0MidHLvvZxFE0S6KvkcK2aE,17
2
- tinycontracts/cli.py,sha256=kir936bXvhjnVRfz4Gm36HmECq3PZLszKrTOvolhwY8,4078
2
+ tinycontracts/cli.py,sha256=rZL3uqxMBCoIoowgIWotqZgayPr7i2MnZEAICFLyIM0,4078
3
3
  tinycontracts/loader.py,sha256=CYgvvdTmuioaQeaTZNxLKy0ndFaCjR-xzQoh61FN5q4,884
4
4
  tinycontracts/routes.py,sha256=ZVtr7-Sx1IAJIlK9yHgiFzgUa5Wpodsm90jliopQagM,3840
5
5
  tinycontracts/schema.py,sha256=tZjLLvQGKi5H4drZZRNCDWY5SWg4_MnYtJWz5hsw8ng,692
6
6
  tinycontracts/server.py,sha256=23gJheNqjPHckSeNlquG-G8viJNrMEVItcYxBg-n-t8,728
7
- tinycontracts-0.1.0.dist-info/METADATA,sha256=erlssWxzSfTqQ5cf-gOL_kcHuWLRbnDilwUczBcoYkM,1438
8
- tinycontracts-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
9
- tinycontracts-0.1.0.dist-info/entry_points.txt,sha256=mBH0FJ35wm3PDzo0sK-0XP0NA53XQ93JpMCYXRBEPiI,45
10
- tinycontracts-0.1.0.dist-info/RECORD,,
7
+ tinycontracts-0.1.1.dist-info/METADATA,sha256=0BC5D-yzLu6lwCSsOeobB-oSHBSFYWKGOOalDzCRCzk,1871
8
+ tinycontracts-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
9
+ tinycontracts-0.1.1.dist-info/entry_points.txt,sha256=mBH0FJ35wm3PDzo0sK-0XP0NA53XQ93JpMCYXRBEPiI,45
10
+ tinycontracts-0.1.1.dist-info/RECORD,,