inpysta 1.0.2__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.
- inpysta/__init__.py +307 -0
- inpysta-1.0.2.dist-info/METADATA +90 -0
- inpysta-1.0.2.dist-info/RECORD +4 -0
- inpysta-1.0.2.dist-info/WHEEL +4 -0
inpysta/__init__.py
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This project library is not to be claimed as your own. To use it, add credit
|
|
3
|
+
and acknowledgement of PySta. This library, as it is open-source, should be credited.
|
|
4
|
+
|
|
5
|
+
C 2026 inPySta Dev.
|
|
6
|
+
|
|
7
|
+
_ inPySta Dev. Studio
|
|
8
|
+
|
|
9
|
+
How To Use
|
|
10
|
+
|
|
11
|
+
1. Open any Python file
|
|
12
|
+
2. In the terminal, run: 'pip install inpysta'
|
|
13
|
+
3. In your code, add: 'from inpysta import MockEngineMain'
|
|
14
|
+
4. add: 'Engine = MockEngineMain("MyEngine") # you can name it whatever
|
|
15
|
+
5. Now, run anything you want.
|
|
16
|
+
|
|
17
|
+
COMMANDS BASED OFF OF v1.0.2
|
|
18
|
+
|
|
19
|
+
CreateUser(username, userage) Creates a user with credentials.
|
|
20
|
+
DeleteUser(username) Deletes a user
|
|
21
|
+
|
|
22
|
+
myUser = CreateUser(...) Stores your user
|
|
23
|
+
myUser._follow(follower) {follower} will follow myUser
|
|
24
|
+
myUser._unfollow(unfollower) {unfollower} will unfollow myUser
|
|
25
|
+
|
|
26
|
+
EditInfo(username) Will ask you to edit either username, or userage
|
|
27
|
+
SetParentalUser(username) Sets a parental user for {username} based on your input
|
|
28
|
+
ViewUsers() Returns a list of all the usernames
|
|
29
|
+
PrintInfo(username) Prints info (e.g. Username, userage..) about the provided username
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
What is inPysta?
|
|
33
|
+
inPySta is a Python library that simulates Instagram. You can follow, unfollow and much more.
|
|
34
|
+
Since this is still v1.0.2, no posts have been added. Maybe in v5.0.0, we'll have posts.
|
|
35
|
+
|
|
36
|
+
inPySta is just a project, made for fun. Not professional. Just a project you'd make at 3.00 AM, for
|
|
37
|
+
no absolutely no reason. Here's some test code:
|
|
38
|
+
|
|
39
|
+
from pysta import MockEngineMain
|
|
40
|
+
|
|
41
|
+
engine = MockEngineMain("myEngine")
|
|
42
|
+
myUser = engine.CreateUser("myUser")
|
|
43
|
+
|
|
44
|
+
This starts an engine, called myEngine. Then it creates a user called myUser, and
|
|
45
|
+
saves it to the database.
|
|
46
|
+
|
|
47
|
+
You can check the database by running:
|
|
48
|
+
|
|
49
|
+
engine.ViewUsers() <- this returns a list of users
|
|
50
|
+
|
|
51
|
+
or
|
|
52
|
+
|
|
53
|
+
print(engine.ViewUsers())
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
# Authored by "Elia Jebreen"
|
|
58
|
+
# NOTE Thanks for using inPySta
|
|
59
|
+
|
|
60
|
+
_version = "Beta v1.0.2" # MAIN VERSION OF inPySta
|
|
61
|
+
|
|
62
|
+
class NotAValidUser(Exception): ... # Errors if someone is not a user
|
|
63
|
+
class AlreadyFollowed(Exception): ... # Errors if someone is already followed
|
|
64
|
+
class NoInfoProvided(Exception): ... # If no info is provided
|
|
65
|
+
|
|
66
|
+
def _NotAValidUser(user: str=None): raise NotAValidUser(f"Not a valid user: {user}")
|
|
67
|
+
def _AlreadyFollowed(): raise AlreadyFollowed()
|
|
68
|
+
def _NoInfoProvided(message): raise NoInfoProvided(message)
|
|
69
|
+
|
|
70
|
+
users = [] # Simulate all users
|
|
71
|
+
|
|
72
|
+
class UserProfileAccount: # Create the main User class
|
|
73
|
+
"""
|
|
74
|
+
Create an account here
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
def __init__(self, username, userage, parentalUsername=None): # Never store passwords
|
|
78
|
+
global users
|
|
79
|
+
|
|
80
|
+
self.username = username # Store username
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
self.userage = int(userage)
|
|
84
|
+
except ValueError:
|
|
85
|
+
raise TypeError("Userage must be a valid integer or integer string.")
|
|
86
|
+
|
|
87
|
+
self.followers = [] # Who follows this user
|
|
88
|
+
self.followersCount = 0 # How many follow this user
|
|
89
|
+
|
|
90
|
+
self.follows = [] # people the USER follows
|
|
91
|
+
self.followsCount = 0
|
|
92
|
+
self.parentalUsername = parentalUsername
|
|
93
|
+
|
|
94
|
+
self.notAdult = True if userage < 18 else False
|
|
95
|
+
if self.notAdult:
|
|
96
|
+
print(f"You might want to set up a parental username for {self.username}")
|
|
97
|
+
|
|
98
|
+
users.append(self)
|
|
99
|
+
|
|
100
|
+
def _follow(self, usernameFollowing: str): # Follow this user
|
|
101
|
+
"""Follow someone"""
|
|
102
|
+
target_clean = usernameFollowing.strip().lower()
|
|
103
|
+
|
|
104
|
+
# Find the actual target user object in the database
|
|
105
|
+
target_user = None
|
|
106
|
+
for u in users:
|
|
107
|
+
if u.username.lower() == target_clean:
|
|
108
|
+
target_user = u
|
|
109
|
+
break
|
|
110
|
+
|
|
111
|
+
if target_user:
|
|
112
|
+
if target_clean in self.follows:
|
|
113
|
+
_AlreadyFollowed()
|
|
114
|
+
return
|
|
115
|
+
|
|
116
|
+
# Update current user's following list
|
|
117
|
+
self.follows.append(target_clean)
|
|
118
|
+
self.followsCount += 1
|
|
119
|
+
|
|
120
|
+
# Update the target user's followers list
|
|
121
|
+
target_user.followers.append(self.username.lower())
|
|
122
|
+
target_user.followersCount += 1
|
|
123
|
+
else:
|
|
124
|
+
_NotAValidUser(usernameFollowing)
|
|
125
|
+
return
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _unfollow(self, usernameUnfollowing: str): # Unfollow this user
|
|
129
|
+
"""Unfollow someone"""
|
|
130
|
+
|
|
131
|
+
if usernameUnfollowing.lower() in self.followers:
|
|
132
|
+
self.followers.remove(usernameUnfollowing.lower())
|
|
133
|
+
self.followersCount -= 1
|
|
134
|
+
else:
|
|
135
|
+
print(f"{usernameUnfollowing} is not in {self.username}'s followers")
|
|
136
|
+
return
|
|
137
|
+
|
|
138
|
+
def __repr__(self):
|
|
139
|
+
"""Tells Python exactly how to print this object in lists and consoles."""
|
|
140
|
+
return f"'{self.username}'"
|
|
141
|
+
|
|
142
|
+
class MockEngineMain:
|
|
143
|
+
def __init__(self, engine):
|
|
144
|
+
self.engine = "Mock Engine" if engine is None else engine
|
|
145
|
+
|
|
146
|
+
@staticmethod
|
|
147
|
+
def CreateUser(username:str, userage: int | str, parentalUser=None):
|
|
148
|
+
"""
|
|
149
|
+
Create a new user and store it
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
if username.lower() in [i.username.lower() for i in users]:
|
|
153
|
+
print(f"Registration Error: Username '{username}' is already taken.")
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
if username is None or userage is None:
|
|
157
|
+
_NoInfoProvided("Username or userage was not provided.")
|
|
158
|
+
return
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
NewUser = UserProfileAccount(username, userage, parentalUser)
|
|
162
|
+
return NewUser
|
|
163
|
+
except Exception as e:
|
|
164
|
+
__error__ = type(e).__name__
|
|
165
|
+
print(f"Something went wrong: {__error__}")
|
|
166
|
+
|
|
167
|
+
@staticmethod
|
|
168
|
+
def DeleteUser(user:UserProfileAccount):
|
|
169
|
+
"""
|
|
170
|
+
Remove a user from the database
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
if not user in users:
|
|
174
|
+
_NoInfoProvided("Username to delete was not provided.")
|
|
175
|
+
return
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
users.remove(user)
|
|
179
|
+
except Exception as e:
|
|
180
|
+
__error__ = type(e).__name__
|
|
181
|
+
print(f"Something went wrong: {__error__}")
|
|
182
|
+
|
|
183
|
+
@staticmethod
|
|
184
|
+
def ViewUsers() -> list:
|
|
185
|
+
"""
|
|
186
|
+
View all the users in the database
|
|
187
|
+
"""
|
|
188
|
+
print(users)
|
|
189
|
+
return users
|
|
190
|
+
|
|
191
|
+
@staticmethod
|
|
192
|
+
def PrintInfo(username):
|
|
193
|
+
"""
|
|
194
|
+
Prints info about the provided username
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
if username is None:
|
|
198
|
+
_NoInfoProvided("Username not provided")
|
|
199
|
+
|
|
200
|
+
if username.lower() not in [i.username.lower() for i in users]:
|
|
201
|
+
_NotAValidUser(username)
|
|
202
|
+
return
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
for i in users:
|
|
206
|
+
if i.username == username:
|
|
207
|
+
print("**********************************")
|
|
208
|
+
print(f"Info about '{i.username}':")
|
|
209
|
+
print("**********************************")
|
|
210
|
+
print(f" Username: {i.username}")
|
|
211
|
+
print(f" Age: {i.userage}")
|
|
212
|
+
print(f" Parental User: {f'Enabled (\'{i.parentalUsername}\')' if i.parentalUsername else 'Disabled'}")
|
|
213
|
+
print()
|
|
214
|
+
print(f" Followers: {i.followers}")
|
|
215
|
+
print(f" Follow Count: {i.followersCount}")
|
|
216
|
+
print(f" Following: {i.follows}")
|
|
217
|
+
print(f" Following Count: {i.followsCount}")
|
|
218
|
+
print("***********************************************")
|
|
219
|
+
|
|
220
|
+
@staticmethod
|
|
221
|
+
def EditInfo(username: str):
|
|
222
|
+
"""
|
|
223
|
+
Edit info about a user. Provide username.
|
|
224
|
+
"""
|
|
225
|
+
|
|
226
|
+
if username is None:
|
|
227
|
+
_NoInfoProvided("Username was not provided")
|
|
228
|
+
return
|
|
229
|
+
username = username.lower()
|
|
230
|
+
|
|
231
|
+
for i in users:
|
|
232
|
+
if i.username.lower() == username:
|
|
233
|
+
user = i
|
|
234
|
+
break
|
|
235
|
+
else:
|
|
236
|
+
user = None
|
|
237
|
+
|
|
238
|
+
if user is None:
|
|
239
|
+
_NotAValidUser(username)
|
|
240
|
+
return
|
|
241
|
+
|
|
242
|
+
usersP = ["username", "user", "name", "id"]
|
|
243
|
+
agesP = ["age"]
|
|
244
|
+
|
|
245
|
+
toEdit = input("What would you like to edit? (e.g. username, age) ").lower()
|
|
246
|
+
|
|
247
|
+
if toEdit in usersP:
|
|
248
|
+
changeTo = input(f"Change username ({user.username}) to: ")
|
|
249
|
+
user.username = changeTo
|
|
250
|
+
elif toEdit in agesP:
|
|
251
|
+
changeTo = input(f"Change age ({user.userage}) to: ")
|
|
252
|
+
user.userage = int(changeTo)
|
|
253
|
+
else:
|
|
254
|
+
print("Invalid option: Choose either username or age")
|
|
255
|
+
return
|
|
256
|
+
|
|
257
|
+
@staticmethod
|
|
258
|
+
def SetParentalUser(username: str):
|
|
259
|
+
"""
|
|
260
|
+
Set a parental user for users under 18
|
|
261
|
+
"""
|
|
262
|
+
|
|
263
|
+
if username is None:
|
|
264
|
+
_NoInfoProvided("Username was not provided")
|
|
265
|
+
return
|
|
266
|
+
username = username.lower()
|
|
267
|
+
|
|
268
|
+
for i in users:
|
|
269
|
+
if i.username.lower() == username:
|
|
270
|
+
user = i
|
|
271
|
+
break
|
|
272
|
+
else:
|
|
273
|
+
user = None
|
|
274
|
+
|
|
275
|
+
if user is None:
|
|
276
|
+
_NotAValidUser(username)
|
|
277
|
+
return
|
|
278
|
+
|
|
279
|
+
if user.notAdult:
|
|
280
|
+
parentalUsername = input(f"Enter a username to set as a parent for '{username}': ")
|
|
281
|
+
for i in users:
|
|
282
|
+
if i.username.lower() == parentalUsername.lower():
|
|
283
|
+
user.parentalUsername = parentalUsername
|
|
284
|
+
print(f"Set {parentalUsername} as a parent for {username}")
|
|
285
|
+
break
|
|
286
|
+
else:
|
|
287
|
+
_NotAValidUser(parentalUsername)
|
|
288
|
+
|
|
289
|
+
def main(): # Won't run if you're using the library
|
|
290
|
+
"""
|
|
291
|
+
Testing the engine.
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
engine = MockEngineMain("Engine") # Create the main engine (you can have 2+ engines!)
|
|
295
|
+
|
|
296
|
+
engine.CreateUser("test", 19) # Create a user named test with age 19
|
|
297
|
+
engine.CreateUser("admin", 5) # Create a user named admin with age 5
|
|
298
|
+
engine.ViewUsers() # view all users
|
|
299
|
+
engine.PrintInfo("admin") # Print the info of admin
|
|
300
|
+
engine.PrintInfo("test") # Print info of test
|
|
301
|
+
engine.SetParentalUser("admin") # Set a parent for admin (test)
|
|
302
|
+
engine.PrintInfo("admin") # print info about admin
|
|
303
|
+
|
|
304
|
+
if __name__ == "__main__":
|
|
305
|
+
main()
|
|
306
|
+
else:
|
|
307
|
+
print(f"Running PySta {_version}")
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: inpysta
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A lightweight Python library that simulates an Instagram database engine for practice and mock backend design.
|
|
5
|
+
Project-URL: Homepage, https://github.com
|
|
6
|
+
Project-URL: Issues, https://github.com/issues
|
|
7
|
+
Author-email: Elia Jebreen <opfr.eli@gmail.com>
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# đ¸ InPySta (Beta v1.0.2)
|
|
17
|
+
|
|
18
|
+
> A lightweight, highly custom Python library that simulates an Instagram database engine. Built for fun, experimentation, and mock backend practice!
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## đ What is InPySta?
|
|
23
|
+
InPySta is a simple simulation engine for managing user profiles, tracking followers/following networks, handling minor account requirements (parental settings), and editing database entries on the fly.
|
|
24
|
+
|
|
25
|
+
*This is a fun project built to experiment with class architectures and command-line interfaces.*
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## đ ī¸ Installation
|
|
30
|
+
|
|
31
|
+
You can install InPySta directly via the terminal using `pip`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install inpysta
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## đģ Quick Start Guide
|
|
40
|
+
|
|
41
|
+
Get your engine up and running in just a few lines of code:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from inpysta import MockEngineMain
|
|
45
|
+
|
|
46
|
+
# 1. Initialize the engine core
|
|
47
|
+
engine = MockEngineMain("MyInstagramMock")
|
|
48
|
+
|
|
49
|
+
# 2. Create profile accounts
|
|
50
|
+
user1 = engine.CreateUser("coolboy10", 19)
|
|
51
|
+
user2 = engine.CreateUser("admin_user", 15) # Prompts parental warning alert
|
|
52
|
+
|
|
53
|
+
# 3. View the system database state
|
|
54
|
+
engine.ViewUsers()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## đšī¸ Available API Commands
|
|
60
|
+
|
|
61
|
+
### đī¸ Engine Management (`MockEngineMain`)
|
|
62
|
+
|
|
63
|
+
* **`CreateUser(username: str, userage: int)`**
|
|
64
|
+
Registers a unique user profile inside the engine global database. Returns the account object configuration.
|
|
65
|
+
* **`DeleteUser(user_object)`**
|
|
66
|
+
Removes a registered profile reference clean out of the database array.
|
|
67
|
+
* **`ViewUsers()`**
|
|
68
|
+
Outputs a structured list tracking all active profiles registered on the instance.
|
|
69
|
+
* **`PrintInfo(username: str)`**
|
|
70
|
+
Displays a visually formatted card containing statistics, counts, age verification, and tracking lists for a specific username.
|
|
71
|
+
* **`EditInfo(username: str)`**
|
|
72
|
+
Launches an interactive dashboard allowing you to change profile variables like username or age natively from console prompts.
|
|
73
|
+
* **`SetParentalUser(username: str)`**
|
|
74
|
+
Enables linking an minor account (under 18) to an established adult guardian account inside the platform database.
|
|
75
|
+
|
|
76
|
+
### đ¤ Profile Interaction (`UserProfileAccount`)
|
|
77
|
+
|
|
78
|
+
When you save a user object via `my_user = engine.CreateUser(...)`, you unlock individual account operations:
|
|
79
|
+
|
|
80
|
+
* **`my_user._follow(target_username: str)`**
|
|
81
|
+
Processes a safe, bidirectional relationship link. Appends the destination user to your `follows` tracking array and adds you to their `followers` log.
|
|
82
|
+
* **`my_user._unfollow(target_username: str)`**
|
|
83
|
+
Removes the mutual network ties between the current profile and the target user.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## đĄī¸ License & Acknowledgement
|
|
88
|
+
This library is open-source. To use it in your own external projects or modifications, please add clear credit and acknowledgement back to **InPySta**.
|
|
89
|
+
|
|
90
|
+
**Š 2026 InPySta Dev Studio.** authored by *Elia Jebreen*.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
inpysta/__init__.py,sha256=UtvqEb49UrTkoXONq0TnxMtBfPSGSCGUAZrMAWQSPhk,10688
|
|
2
|
+
inpysta-1.0.2.dist-info/METADATA,sha256=Ql1Hq5vT6XTVnUAPGy3NwbCFjZGWqexu-onIMpCoy3w,3414
|
|
3
|
+
inpysta-1.0.2.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
|
|
4
|
+
inpysta-1.0.2.dist-info/RECORD,,
|