snakex 1.0.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.
snakex-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chirag Vishwakarma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
snakex-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: snakex
3
+ Version: 1.0.0
4
+ Summary: Teri Maa ne bhoot ke sath suhagrat rachai thi woh bhoot huh mein
5
+ Home-page:
6
+ Author: kya dekh rha hai luvday
7
+ Author-email: xyz@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: license
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+ Dynamic: summary
23
+
24
+ # snakex
25
+
26
+ ## Install
27
+ ```bash
28
+ pip install snakex
29
+ ```
30
+
31
+ ## Use
32
+ ```python
33
+ import snakex
34
+
35
+ # Show all codes
36
+ snakex.show_codes()
37
+
38
+ # Show specific code
39
+ snakex.show_codes("form")
40
+ ```
41
+
42
+ ## Build
43
+ Run from the project folder:
44
+ ```bash
45
+ python -m pip install build twine
46
+ python -m build
47
+ ```
48
+
49
+ ## Upload to PyPI
50
+ ```bash
51
+ python -m twine upload dist/*
52
+ ```
53
+ Use your PyPI API token when prompted. Keep it private.
54
+
55
+ ## Publish changes
56
+ 1. Update your code.
57
+ 2. Increase the version in `setup.py` (and `__version__`, if used).
58
+ 3. Rebuild and upload:
59
+ ```powershell
60
+ Remove-Item -Recurse -Force build, dist, *.egg-info -ErrorAction SilentlyContinue
61
+ python -m build
62
+ python -m twine upload dist/*
63
+ ```
64
+
65
+ Replace `YOUR_PACKAGE_NAME` and `your_package_name` with your actual package names. Use a new version for every PyPI release.
snakex-1.0.0/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # snakex
2
+
3
+ ## Install
4
+ ```bash
5
+ pip install snakex
6
+ ```
7
+
8
+ ## Use
9
+ ```python
10
+ import snakex
11
+
12
+ # Show all codes
13
+ snakex.show_codes()
14
+
15
+ # Show specific code
16
+ snakex.show_codes("form")
17
+ ```
18
+
19
+ ## Build
20
+ Run from the project folder:
21
+ ```bash
22
+ python -m pip install build twine
23
+ python -m build
24
+ ```
25
+
26
+ ## Upload to PyPI
27
+ ```bash
28
+ python -m twine upload dist/*
29
+ ```
30
+ Use your PyPI API token when prompted. Keep it private.
31
+
32
+ ## Publish changes
33
+ 1. Update your code.
34
+ 2. Increase the version in `setup.py` (and `__version__`, if used).
35
+ 3. Rebuild and upload:
36
+ ```powershell
37
+ Remove-Item -Recurse -Force build, dist, *.egg-info -ErrorAction SilentlyContinue
38
+ python -m build
39
+ python -m twine upload dist/*
40
+ ```
41
+
42
+ Replace `YOUR_PACKAGE_NAME` and `your_package_name` with your actual package names. Use a new version for every PyPI release.
snakex-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
snakex-1.0.0/setup.py ADDED
@@ -0,0 +1,26 @@
1
+ from setuptools import setup, find_packages
2
+ import io
3
+ import os
4
+
5
+ def read(fname):
6
+ return io.open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8").read()
7
+
8
+ setup(
9
+ name="snakex", # must be unique on PyPI
10
+ version="1.0.0",
11
+ author="kya dekh rha hai luvday",
12
+ author_email="xyz@gmail.com",
13
+ description="Teri Maa ne bhoot ke sath suhagrat rachai thi woh bhoot huh mein ",
14
+ long_description=read("README.md"),
15
+ long_description_content_type="text/markdown",
16
+ url="", # optional
17
+ packages=find_packages(),
18
+ include_package_data=True,
19
+ install_requires=[],
20
+ license="MIT", # ✅ SPDX-compliant license declaration
21
+ classifiers=[
22
+ "Programming Language :: Python :: 3",
23
+ "Operating System :: OS Independent",
24
+ ],
25
+ python_requires=">=3.6",
26
+ )
@@ -0,0 +1,28 @@
1
+ import os
2
+
3
+ def show_codes(filename: str = None):
4
+ """
5
+ Displays code from the snakex package.
6
+ - If filename is given (without .py), shows that file's code.
7
+ - If no filename is given, shows all .py files.
8
+ """
9
+ base_path = os.path.dirname(__file__)
10
+ files = [f for f in os.listdir(base_path) if f.endswith(".py") and f != "__init__.py"]
11
+
12
+ if filename:
13
+ file_path = os.path.join(base_path, f"{filename}.py")
14
+ if os.path.exists(file_path):
15
+ print(f"\n=== Showing {filename}.py ===\n")
16
+ with open(file_path, "r", encoding="utf-8") as f:
17
+ print(f.read())
18
+ else:
19
+ print(f"\n❌ File '{filename}.py' not found in snakex.\n")
20
+ print("Available files:")
21
+ for f in files:
22
+ print("•", f.replace(".py", ""))
23
+ else:
24
+ print("\nAll practical codes in snakex:\n")
25
+ for f in files:
26
+ print(f"\n=== {f} ===\n")
27
+ with open(os.path.join(base_path, f), "r", encoding="utf-8") as file:
28
+ print(file.read())
@@ -0,0 +1,69 @@
1
+ #models/student.js
2
+
3
+
4
+ const mongoose = require("mongoose");
5
+
6
+ const studentSchema = new mongoose.Schema({
7
+ name: String,
8
+ roll: Number,
9
+ course: String
10
+ });
11
+
12
+ module.exports = mongoose.model("Student", studentSchema);
13
+
14
+
15
+ #routes/Student_Routes.js
16
+
17
+
18
+ const express = require("express");
19
+ const router = express.Router();
20
+ const Student = require("../models/student");
21
+
22
+ router.post("/", async (req, res) => {
23
+ const student = new Student(req.body);
24
+ await student.save();
25
+ res.json(student);
26
+ });
27
+
28
+ router.get("/", async (req, res) => {
29
+ const students = await Student.find();
30
+ res.json(students);
31
+ });
32
+
33
+ module.exports = router;
34
+
35
+
36
+ #server.js
37
+
38
+
39
+ const express = require("express");
40
+ const mongoose = require("mongoose");
41
+ const cors = require("cors");
42
+ const Student_Routes = require("./routes/Student_Routes");
43
+
44
+ const app = express();
45
+
46
+ app.use(cors());
47
+ app.use(express.json());
48
+
49
+ mongoose.connect("mongodb://127.0.0.1:27017/studentDB")
50
+ .then(() => console.log("MongoDB connected successfully"))
51
+ .catch(err => console.log(err));
52
+
53
+ app.use("/student", Student_Routes);
54
+
55
+ app.get("/", (req, res) => {
56
+ res.send("Backend running Successfully");
57
+ });
58
+
59
+ app.listen(5000, () => {
60
+ console.log("Server running on port 5000");
61
+ });
62
+
63
+ #http://localhost:5000/student
64
+
65
+ {
66
+ "name": "Rahul",
67
+ "roll": 101,
68
+ "course": "BSc IT"
69
+ }
@@ -0,0 +1,101 @@
1
+ #backend/server.js
2
+
3
+
4
+ const express = require("express");
5
+ const cors = require("cors");
6
+
7
+ const app = express();
8
+ app.use(cors());
9
+ app.use(express.json());
10
+
11
+ app.post("/register", (req, res) => {
12
+ const { name, email, password, age } = req.body;
13
+
14
+ if (!name || !email || !password || !age)
15
+ return res.status(400).json({ message: "All fields required" });
16
+
17
+ if (!/\S+@\S+\.\S+/.test(email))
18
+ return res.status(400).json({ message: "Invalid email" });
19
+
20
+ if (password.length < 6)
21
+ return res.status(400).json({ message: "Password must be 6 characters" });
22
+
23
+ if (Number(age) < 18)
24
+ return res.status(400).json({ message: "Age must be 18 or above" });
25
+
26
+ res.json({ message: "Registration successful" });
27
+ });
28
+
29
+ app.listen(5000, () => console.log("Server running on port 5000"));
30
+
31
+
32
+ #frontend/src/Register.jsx
33
+
34
+
35
+ import React, { useState } from "react";
36
+
37
+ function Register() {
38
+ const [form, setForm] = useState({
39
+ name: "", email: "", password: "", age: ""
40
+ });
41
+ const [message, setMessage] = useState("");
42
+
43
+ const handleSubmit = async (e) => {
44
+ e.preventDefault();
45
+
46
+ if (!form.name || !form.email || !form.password || !form.age) {
47
+ setMessage("All fields are required");
48
+ return;
49
+ }
50
+
51
+ try {
52
+ const res = await fetch("http://localhost:5000/register", {
53
+ method: "POST",
54
+ headers: { "Content-Type": "application/json" },
55
+ body: JSON.stringify(form)
56
+ });
57
+
58
+ const data = await res.json();
59
+ setMessage(data.message);
60
+ } catch {
61
+ setMessage("Server connection error");
62
+ }
63
+ };
64
+
65
+ return (
66
+ <div>
67
+ <h2>User Registration</h2>
68
+ <form onSubmit={handleSubmit}>
69
+ <input placeholder="Name"
70
+ onChange={e => setForm({...form, name: e.target.value})} />
71
+ <input placeholder="Email"
72
+ onChange={e => setForm({...form, email: e.target.value})} />
73
+ <input type="password" placeholder="Password"
74
+ onChange={e => setForm({...form, password: e.target.value})} />
75
+ <input type="number" placeholder="Age"
76
+ onChange={e => setForm({...form, age: e.target.value})} />
77
+ <button type="submit">Register</button>
78
+ </form>
79
+ <p>{message}</p>
80
+ </div>
81
+ );
82
+ }
83
+
84
+ export default Register;
85
+
86
+
87
+ #frontend/src/App.jsx
88
+
89
+
90
+ import Register from "./Register";
91
+
92
+ function App() {
93
+ return (
94
+ <div>
95
+ <Register />
96
+ </div>
97
+ );
98
+ }
99
+
100
+ export default App;
101
+
@@ -0,0 +1,115 @@
1
+ #.env
2
+
3
+ MONGODB_URL=mongodb://127.0.0.1:27017/userlogin
4
+ PORT=3000
5
+ JWT_SECRET=vivek123
6
+
7
+
8
+ #models/User.js
9
+
10
+
11
+ const mongoose = require("mongoose");
12
+
13
+ const userSchema = new mongoose.Schema({
14
+ name: String,
15
+ email: { type: String, unique: true },
16
+ password: String
17
+ });
18
+
19
+ module.exports = mongoose.model("User", userSchema);
20
+
21
+
22
+ #Routes/authRoutes.js
23
+
24
+
25
+ const express = require("express");
26
+ const bcrypt = require("bcryptjs");
27
+ const jwt = require("jsonwebtoken");
28
+ const User = require("../models/User");
29
+
30
+ const router = express.Router();
31
+
32
+ router.post("/register", async (req, res) => {
33
+ const { name, email, password } = req.body;
34
+
35
+ const hashedPassword = await bcrypt.hash(password, 10);
36
+
37
+ await User.create({
38
+ name, email, password: hashedPassword
39
+ });
40
+
41
+ res.json({ message: "Registered successfully" });
42
+ });
43
+
44
+ router.post("/login", async (req, res) => {
45
+ const { email, password } = req.body;
46
+ const user = await User.findOne({ email });
47
+
48
+ if (!user || !await bcrypt.compare(password, user.password)) {
49
+ return res.status(401).json({ message: "Invalid login" });
50
+ }
51
+
52
+ const token = jwt.sign(
53
+ { id: user._id },
54
+ process.env.JWT_SECRET,
55
+ { expiresIn: "1h" }
56
+ );
57
+
58
+ res.json({ token });
59
+ });
60
+
61
+ router.get("/profile", (req, res) => {
62
+ try {
63
+ const token = req.headers.authorization.split(" ")[1];
64
+ const user = jwt.verify(token, process.env.JWT_SECRET);
65
+ res.json({ message: "Access granted", user });
66
+ } catch {
67
+ res.status(401).json({ message: "Invalid token" });
68
+ }
69
+ });
70
+
71
+ module.exports = router;
72
+
73
+
74
+ #server.js
75
+
76
+
77
+ const express = require("express");
78
+ const mongoose = require("mongoose");
79
+ require("dotenv").config();
80
+
81
+ const authRoutes = require("./Routes/authRoutes");
82
+
83
+ const app = express();
84
+ app.use(express.json());
85
+
86
+ app.use("/", authRoutes);
87
+
88
+ mongoose.connect(process.env.MONGODB_URL)
89
+ .then(() => {
90
+ console.log("MongoDB connected");
91
+ app.listen(process.env.PORT, () =>
92
+ console.log("Server running")
93
+ );
94
+ })
95
+ .catch(err => console.log(err));
96
+
97
+
98
+ Test in Postman
99
+ Register
100
+ POST http://localhost:3000/register
101
+
102
+ Body → raw → JSON:
103
+ {
104
+ "name": "Rahul",
105
+ "email": "rahul@gmail.com",
106
+ "password": "123456"
107
+ }
108
+
109
+
110
+ Login
111
+ POST http://localhost:3000/login
112
+ {
113
+ "email": "rahul@gmail.com",
114
+ "password": "123456"
115
+ }
@@ -0,0 +1,47 @@
1
+ #server.js
2
+
3
+
4
+ const express = require("express");
5
+ const cors = require("cors");
6
+
7
+ const app = express();
8
+ app.use(cors());
9
+
10
+ app.get("/api/students", (req, res) => {
11
+ res.json([
12
+ { id: 1, name: "Rahul" },
13
+ { id: 2, name: "Priya" }
14
+ ]);
15
+ });
16
+
17
+ app.listen(5000, () => {
18
+ console.log("Server running on port 5000");
19
+ });
20
+
21
+ #app.jsx
22
+
23
+
24
+ import { useEffect, useState } from "react";
25
+ import axios from "axios";
26
+
27
+ function App() {
28
+ const [students, setStudents] = useState([]);
29
+
30
+ useEffect(() => {
31
+ axios.get("http://localhost:5000/api/students")
32
+ .then(res => setStudents(res.data));
33
+ }, []);
34
+
35
+ return (
36
+ <div>
37
+ <h1>Student List</h1>
38
+ {students.map(s => (
39
+ <p key={s.id}>{s.id} - {s.name}</p>
40
+ ))}
41
+ </div>
42
+ );
43
+ }
44
+
45
+ export default App;
46
+
47
+
File without changes
@@ -0,0 +1,90 @@
1
+ #1. File: .env
2
+
3
+ MONGO_URI=mongodb://127.0.0.1:27017/userdb
4
+ PORT=3000
5
+
6
+
7
+ #server.js
8
+
9
+
10
+ const express = require("express");
11
+ const mongoose = require("mongoose");
12
+ require("dotenv").config();
13
+
14
+ const app = express();
15
+ app.use(express.json());
16
+
17
+ const userSchema = new mongoose.Schema({
18
+ username: { type: String, required: true, unique: true },
19
+ password: { type: String, required: true }
20
+ });
21
+
22
+ const User = mongoose.model("User", userSchema);
23
+
24
+ app.post("/register", async (req, res) => {
25
+ const { username, password } = req.body;
26
+
27
+ const existingUser = await User.findOne({ username });
28
+
29
+ if (existingUser) {
30
+ return res.status(400).json({ message: "User already exists" });
31
+ }
32
+
33
+ await User.create({ username, password });
34
+ res.json({ message: "Registration successful" });
35
+ });
36
+
37
+ app.post("/login", async (req, res) => {
38
+ const { username, password } = req.body;
39
+
40
+ const user = await User.findOne({ username, password });
41
+
42
+ if (!user) {
43
+ return res.status(400).json({
44
+ message: "Invalid username or password"
45
+ });
46
+ }
47
+
48
+ res.json({ message: "Login successful" });
49
+ });
50
+
51
+ mongoose.connect(process.env.MONGO_URI)
52
+ .then(() => {
53
+ console.log("MongoDB connected");
54
+ app.listen(process.env.PORT, () =>
55
+ console.log("Server running")
56
+ );
57
+ })
58
+ .catch(err => console.log(err));
59
+
60
+ #pack
61
+ npm init -y
62
+ npm install express mongoose dotenv
63
+
64
+
65
+ Test using Postman
66
+ Register a user
67
+ - Method: POST
68
+ - URL: http://localhost:3000/register
69
+ - Select Body → raw → JSON.
70
+ {
71
+ "username": "rahul",
72
+ "password": "12345"
73
+ }
74
+
75
+
76
+ Expected response:
77
+ {
78
+ "message": "Registration successful"
79
+ }
80
+
81
+
82
+ Login
83
+ - Method: POST
84
+ - URL: http://localhost:3000/login
85
+ Send the same JSON body.
86
+
87
+ Expected response:
88
+ {
89
+ "message": "Login successful"
90
+ }
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: snakex
3
+ Version: 1.0.0
4
+ Summary: Teri Maa ne bhoot ke sath suhagrat rachai thi woh bhoot huh mein
5
+ Home-page:
6
+ Author: kya dekh rha hai luvday
7
+ Author-email: xyz@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: license
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+ Dynamic: summary
23
+
24
+ # snakex
25
+
26
+ ## Install
27
+ ```bash
28
+ pip install snakex
29
+ ```
30
+
31
+ ## Use
32
+ ```python
33
+ import snakex
34
+
35
+ # Show all codes
36
+ snakex.show_codes()
37
+
38
+ # Show specific code
39
+ snakex.show_codes("form")
40
+ ```
41
+
42
+ ## Build
43
+ Run from the project folder:
44
+ ```bash
45
+ python -m pip install build twine
46
+ python -m build
47
+ ```
48
+
49
+ ## Upload to PyPI
50
+ ```bash
51
+ python -m twine upload dist/*
52
+ ```
53
+ Use your PyPI API token when prompted. Keep it private.
54
+
55
+ ## Publish changes
56
+ 1. Update your code.
57
+ 2. Increase the version in `setup.py` (and `__version__`, if used).
58
+ 3. Rebuild and upload:
59
+ ```powershell
60
+ Remove-Item -Recurse -Force build, dist, *.egg-info -ErrorAction SilentlyContinue
61
+ python -m build
62
+ python -m twine upload dist/*
63
+ ```
64
+
65
+ Replace `YOUR_PACKAGE_NAME` and `your_package_name` with your actual package names. Use a new version for every PyPI release.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ snakex/__init__.py
5
+ snakex/create-read-db.py
6
+ snakex/form.py
7
+ snakex/jwt.py
8
+ snakex/restapi.py
9
+ snakex/update-del.py
10
+ snakex/user-reg.py
11
+ snakex.egg-info/PKG-INFO
12
+ snakex.egg-info/SOURCES.txt
13
+ snakex.egg-info/dependency_links.txt
14
+ snakex.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ snakex