tinycontracts 0.1.0__tar.gz → 0.1.1__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: 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
  ```
@@ -0,0 +1,69 @@
1
+ # tinycontracts
2
+
3
+ Turn JSON, CSV, and Parquet files into REST APIs instantly.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install tinycontracts
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ tc ./data
15
+ ```
16
+
17
+ Or with options:
18
+
19
+ ```bash
20
+ tc ./data --port 8000 --host 0.0.0.0
21
+ ```
22
+
23
+ ## Example
24
+
25
+ Given this structure:
26
+ ```
27
+ data/
28
+ users.json
29
+ orders.csv
30
+ config.json
31
+ ```
32
+
33
+ You get:
34
+ ```
35
+ GET /users # list all users
36
+ GET /users/1 # get user by id
37
+ GET /orders # list all orders
38
+ GET /config # get config
39
+
40
+ GET /_help # api documentation
41
+ GET /_schema # all schemas
42
+ GET /docs # swagger ui
43
+ ```
44
+
45
+ ## Filtering & Pagination
46
+
47
+ ```bash
48
+ # filter by field
49
+ curl "localhost:4242/users?active=true"
50
+
51
+ # pagination
52
+ curl "localhost:4242/orders?_limit=10&_offset=20"
53
+
54
+ # sorting
55
+ curl "localhost:4242/orders?_sort=-created_at"
56
+
57
+ # combine
58
+ curl "localhost:4242/orders?status=pending&_limit=5&_sort=-amount"
59
+ ```
60
+
61
+ ## Schema
62
+
63
+ ```bash
64
+ # all schemas
65
+ curl localhost:4242/_schema
66
+
67
+ # single resource schema
68
+ curl localhost:4242/users/_schema
69
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tinycontracts"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "serve a folder of json/csv/parquet files as a rest api"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -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,49 +0,0 @@
1
- # tinycontracts
2
-
3
- Turn JSON, CSV, and Parquet files into REST APIs instantly.
4
-
5
- ## Install
6
-
7
- ```bash
8
- uv sync
9
- ```
10
-
11
- ## Usage
12
-
13
- ```bash
14
- tinycontracts serve ./data
15
- ```
16
-
17
- This scans `./data` for `.json`, `.csv`, and `.parquet` files and serves them as REST endpoints.
18
-
19
- ## Example
20
-
21
- Given this structure:
22
- ```
23
- data/
24
- users.json
25
- orders.csv
26
- products.parquet
27
- ```
28
-
29
- You get:
30
- ```
31
- GET /users
32
- GET /orders
33
- GET /products
34
- ```
35
-
36
- ## Filtering
37
-
38
- Query any field:
39
- ```
40
- GET /users?role=admin
41
- GET /orders?status=shipped&customer_id=123
42
- ```
43
-
44
- ## Schema
45
-
46
- Get the inferred JSON schema:
47
- ```
48
- GET /users/schema
49
- ```
File without changes
File without changes