Plinx 0.0.1__py3-none-any.whl → 1.0.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.
plinx/status_codes.py CHANGED
@@ -2,18 +2,39 @@ from enum import Enum
2
2
 
3
3
 
4
4
  class StatusCodes(Enum):
5
- """Status codes for the API."""
5
+ """
6
+ Enumeration of HTTP status codes supported by the Plinx framework.
6
7
 
7
- # 2XX
8
+ This enum defines standard HTTP status codes as defined in RFC 7231,
9
+ organized by their categories (2xx for success, 3xx for redirection, etc.).
10
+
11
+ Each status code has a name that reflects its standard description,
12
+ and a numeric value that is sent in HTTP responses.
13
+
14
+ Usage:
15
+ ```python
16
+ from plinx.status_codes import StatusCodes
17
+
18
+ # Set a 404 status code
19
+ response.status_code = StatusCodes.NOT_FOUND.value # 404
20
+
21
+ # Get the name of a status code for display
22
+ status_name = StatusCodes.NOT_FOUND.name # "NOT_FOUND"
23
+ # Can be formatted for human display:
24
+ human_readable = StatusCodes.NOT_FOUND.name.replace("_", " ").title() # "Not Found"
25
+ ```
26
+ """
27
+
28
+ # 2XX - Success
8
29
  OK = 200
9
30
  CREATED = 201
10
31
  ACCEPTED = 202
11
32
  NO_CONTENT = 204
12
33
 
13
- # 3XX
34
+ # 3XX - Redirection
14
35
  NOT_MODIFIED = 304
15
36
 
16
- # 4XX
37
+ # 4XX - Client Error
17
38
  BAD_REQUEST = 400
18
39
  UNAUTHORIZED = 401
19
40
  FORBIDDEN = 403
@@ -27,7 +48,7 @@ class StatusCodes(Enum):
27
48
  TOO_MANY_REQUESTS = 429
28
49
  UNAVAILABLE_FOR_LEGAL_REASONS = 451
29
50
 
30
- # 5XX
51
+ # 5XX - Server Error
31
52
  INTERNAL_SERVER_ERROR = 500
32
53
  NOT_IMPLEMENTED = 501
33
54
  BAD_GATEWAY = 502
plinx/utils.py CHANGED
@@ -5,9 +5,24 @@ from plinx.status_codes import StatusCodes
5
5
 
6
6
  def handle_404(response: Response) -> None:
7
7
  """
8
- Set the response status code to 404 and return None.
9
- :param response:
10
- :return:
8
+ Set up a standardized 404 Not Found response.
9
+
10
+ This utility function is used internally by the framework when no route
11
+ matches the requested URL path. It sets the status code to 404 and
12
+ the response text to "Not Found".
13
+
14
+ Args:
15
+ response: The Response object to configure with 404 status
16
+
17
+ Returns:
18
+ None
19
+
20
+ Example:
21
+ ```python
22
+ response = Response()
23
+ handle_404(response)
24
+ # response now has status_code=404 and text="Not Found"
25
+ ```
11
26
  """
12
27
  response.status_code = StatusCodes.NOT_FOUND.value
13
28
  response.text = StatusCodes.NOT_FOUND.name.replace("_", " ").title()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: Plinx
3
- Version: 0.0.1
3
+ Version: 1.0.1
4
4
  Summary: Plinx is an experimental, minimalistic, and extensible web framework and ORM written in Python.
5
5
  Home-page: https://github.com/dhavalsavalia/plinx
6
6
  Author: Dhaval Savalia
@@ -15,12 +15,27 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
15
15
  Requires-Python: >=3.11.0
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
+ Requires-Dist: webob
19
+ Requires-Dist: parse
20
+ Requires-Dist: requests
21
+ Requires-Dist: requests-wsgi-adapter
22
+ Dynamic: author
23
+ Dynamic: author-email
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: requires-dist
31
+ Dynamic: requires-python
32
+ Dynamic: summary
18
33
 
19
34
 
20
35
  # Plinx
21
36
 
22
37
  ![purpose](https://img.shields.io/badge/purpose-learning-green.svg)
23
- ![PyPI](https://img.shields.io/pypi/v/bumbo.svg)
38
+ ![PyPI](https://img.shields.io/pypi/v/Plinx.svg)
24
39
 
25
40
  **Plinx** is an experimental, minimalistic, and extensible WSGI-based web framework and ORM written in Python.
26
41
  It is designed to be simple, fast, and easy to extend, making it ideal for rapid prototyping and educational purposes.
@@ -29,8 +44,9 @@ It is designed to be simple, fast, and easy to extend, making it ideal for rapid
29
44
 
30
45
  ## Features
31
46
 
32
- - 🚀 Minimal and fast web framework
33
- - 🛣️ Intuitive routing system
47
+ - 🚀 Minimal and fast WSGI web framework
48
+ - 💾 Integrated Object-Relational Mapper (ORM)
49
+ - 🛣️ Intuitive routing system (including parameterized and class-based routes)
34
50
  - 🧩 Extensible middleware support
35
51
  - 🧪 Simple, readable codebase for learning and hacking
36
52
  - 📝 Type hints and modern Python best practices
@@ -39,6 +55,12 @@ It is designed to be simple, fast, and easy to extend, making it ideal for rapid
39
55
 
40
56
  ## Installation
41
57
 
58
+ Install from PyPI:
59
+
60
+ ```bash
61
+ pip install Plinx
62
+ ```
63
+
42
64
  Install directly from the git source:
43
65
 
44
66
  ```bash
@@ -52,19 +74,30 @@ pip install git+https://github.com/dhavalsavalia/plinx.git
52
74
  Create a simple web application in seconds:
53
75
 
54
76
  ```python
77
+ # myapp.py
55
78
  from plinx import Plinx
56
79
 
57
80
  app = Plinx()
58
81
 
59
82
  @app.route("/")
60
83
  def index(request, response):
61
- response.text = "Hello, world!"
84
+ response.text = "Hello, Plinx 1.0.1!"
85
+
86
+ # Example using the ORM (requires database setup)
87
+ # from plinx.orm import Database, Table, Column
88
+ # db = Database("my_database.db")
89
+ # class Item(Table):
90
+ # name = Column(str)
91
+ # count = Column(int)
92
+ # db.create(Item)
93
+ # db.save(Item(name="Example", count=1))
62
94
  ```
63
95
 
64
- Run your app (example, assuming you have an ASGI server like `uvicorn`):
96
+ Run your app using a WSGI server (like `gunicorn`):
65
97
 
66
98
  ```bash
67
- uvicorn myapp:app
99
+ pip install gunicorn
100
+ gunicorn myapp:app
68
101
  ```
69
102
 
70
103
  ## Testing
@@ -77,19 +110,6 @@ pytest --cov=.
77
110
 
78
111
  ---
79
112
 
80
- ## Roadmap
81
-
82
- - [x] Web Framework
83
- - [x] Routing
84
- - [x] Explicit Routing Methods (GET, POST, etc.)
85
- - [x] Parameterized Routes
86
- - [x] Class Based Routes
87
- - [x] Django-like Routes
88
- - [x] Middleware Support
89
- - [ ] ORM
90
-
91
- ---
92
-
93
113
  ## Contributing
94
114
 
95
115
  Contributions are welcome! Please open issues or submit pull requests for improvements, bug fixes, or new features.
@@ -104,7 +124,7 @@ This project is licensed under the MIT License. See [LICENSE](LICENSE) for detai
104
124
 
105
125
  ## Author & Contact
106
126
 
107
- Created and maintained by [Dhaval Savalia](https://github.com/dhavalsavalia).
127
+ Created and maintained by [Dhaval Savalia](https://github.com/dhavalsavalia).
108
128
  For questions or opportunities, feel free to reach out via [LinkedIn](https://www.linkedin.com/in/dhavalsavalia/) or open an issue.
109
129
 
110
130
  ---
@@ -0,0 +1,15 @@
1
+ plinx/__init__.py,sha256=TkcBtaKtAwXDE6XKgnkfC-fIzNxtCErHDt0WCh1ZF74,54
2
+ plinx/applications.py,sha256=XM5jPYgeJapYxaGcTzphcpr_281et0QDwPMfAGIbRtA,11483
3
+ plinx/methods.py,sha256=uLZmj3KQ4QF-JVNgq3fVY7kOJkKJDMQghyiogU8m2Yc,2101
4
+ plinx/middleware.py,sha256=Kdeau4eZ5f4nKTlH_CNvaIndYwkgIdtWBP50-khEK5s,5050
5
+ plinx/response.py,sha256=-CgkW4cH9pLSa73YdrnceCInObwPzpSplhnWfAg-360,4079
6
+ plinx/status_codes.py,sha256=dPkHkcnULbhrxk6WYhR5wmrd2sKhOQf409G_OtX8Cug,1536
7
+ plinx/utils.py,sha256=da0uiLEvLMrjROeUJ5lfBTRAIqKoSdKkqImPs1qHsF4,769
8
+ plinx/orm/__init__.py,sha256=ryDdzvF6Eh6RIHyEgym6UKCaFMnMitwucazpiWuvICQ,61
9
+ plinx/orm/orm.py,sha256=-eHAgURYWw5kL9zMCO1Mha5gRcPCbqoAY6BALj-gqJc,15790
10
+ plinx/orm/utils.py,sha256=fkP89dYMcNFUOcRryxGTNUEV0Dr40-qwG-IH2AxY4DQ,118
11
+ plinx-1.0.1.dist-info/licenses/LICENSE,sha256=MljMjTJD6oOY41eZWLDZ4x8FrTUcl7ElKxWIXJXUwLM,1066
12
+ plinx-1.0.1.dist-info/METADATA,sha256=nvJIwZYncIm-dAB8_oZC8FX4W8Ow2yr3UA_xBd1WPEg,3116
13
+ plinx-1.0.1.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
14
+ plinx-1.0.1.dist-info/top_level.txt,sha256=U_4P3aFsTEhhvfiE3sVbJKAG9Fp4IPC5d6zpttayAZw,6
15
+ plinx-1.0.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- plinx/__init__.py,sha256=oMho3a3JJZllxtj4lLwS96pwWRBvctDJRFww5lfqlBs,32
2
- plinx/applications.py,sha256=Oy2pO1zyfKWyYXeJ8AuzdoAab6XJThNHDbOdpKWA5-8,5957
3
- plinx/methods.py,sha256=CEaousqNXbgdyaEL0BdOtAWh1p03jAaAFzXJkY9xII0,294
4
- plinx/middleware.py,sha256=OiNDhKWpmpKkAIbSWxRzP_tQXSyfDToos-MQMDPSUWM,2161
5
- plinx/response.py,sha256=oDZPF9V76HhqdUZLzSmoLw_q-GG9hc5krfCBgNm3OfU,1460
6
- plinx/status_codes.py,sha256=V7vX7_ujYIaVjO3I3eVUnuNKiTXMSov56wJt8tvMbAM,700
7
- plinx/utils.py,sha256=WaU_j7YXsdlZh3M33B2vXjRPAU26lBeQ5sV2ZasXVwE,352
8
- Plinx-0.0.1.dist-info/LICENSE,sha256=MljMjTJD6oOY41eZWLDZ4x8FrTUcl7ElKxWIXJXUwLM,1066
9
- Plinx-0.0.1.dist-info/METADATA,sha256=N-vDBHtG4pV2LKumS4yh40_IYzKKh8PgRf1G3Umw_Q0,2568
10
- Plinx-0.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
11
- Plinx-0.0.1.dist-info/top_level.txt,sha256=U_4P3aFsTEhhvfiE3sVbJKAG9Fp4IPC5d6zpttayAZw,6
12
- Plinx-0.0.1.dist-info/RECORD,,