projgen 0.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.
projgen/__init__.py ADDED
File without changes
projgen/__main__.py ADDED
@@ -0,0 +1,98 @@
1
+ import typer
2
+ import os
3
+ import json
4
+ from rich import print
5
+ from rich.panel import Panel
6
+ import copy
7
+ import datetime
8
+ import random
9
+
10
+ PROJECT_DESCRIPTION = \
11
+ """Your current project started at [red]{start}[/red] and ends at [red]{end}[/red].
12
+ Project specifics:{specs}"""
13
+
14
+ app = typer.Typer()
15
+
16
+ def get_specific(specific: str, db: dict):
17
+ return random.choice(list(db['database'][specific].keys()))
18
+
19
+ @app.command()
20
+ def status():
21
+ assert os.path.exists("./projgen.json")
22
+ with open("./projgen.json", "r") as f:
23
+ data = json.loads(f.read())
24
+ specs = ""
25
+ for key, value in data['currentProject']['specifics'].items():
26
+ specs += f"\n·\t{key}: {value}"
27
+ print(Panel(PROJECT_DESCRIPTION.format(start=data['currentProject']['start'], end=data['currentProject']['end'], specs=specs), title="Current Project", style="white"))
28
+
29
+ @app.command()
30
+ def new_project():
31
+ assert os.path.exists("./projgen.json")
32
+ with open("./projgen.json", "r") as f:
33
+ data = json.loads(f.read())
34
+ new = copy.deepcopy(data)
35
+ new['pastProjects'].append(data['currentProject'])
36
+ new['currentProject'] = {}
37
+ new['currentProject']['start'] = str(datetime.datetime.now())
38
+ new['currentProject']['end'] = str(datetime.datetime.now() + datetime.timedelta(days=30))
39
+ new['currentProject']['specifics'] = {}
40
+ todo = ['type']
41
+ for t in todo:
42
+ new['currentProject']['specifics'][t] = get_specific(t, data)
43
+ todo += data['database'][t][new['currentProject']['specifics'][t]]
44
+ with open("./projgen.json", "w") as f:
45
+ f.write(json.dumps(new, indent=4))
46
+ status()
47
+
48
+ @app.command()
49
+ def update():
50
+ assert os.path.exists("./projgen.json")
51
+ with open("./projgen.json", "r") as f:
52
+ data = json.loads(f.read())
53
+ if datetime.datetime.fromisoformat(data['currentProject']['end']) < datetime.datetime.now():
54
+ print("Project finished.")
55
+ new_project()
56
+ else:
57
+ print("Project not yet finished.")
58
+ status()
59
+
60
+ @app.command()
61
+ def add_db_item(specific: str, item: str):
62
+ assert os.path.exists("./projgen.json")
63
+ with open("./projgen.json", "r") as f:
64
+ data = json.loads(f.read())
65
+ if specific not in data['database']:
66
+ data['database'][specific] = {}
67
+ data['database'][specific][item] = []
68
+ with open("./projgen.json", "w") as f:
69
+ f.write(json.dumps(data, indent=4))
70
+
71
+ @app.command()
72
+ def add_db_requirement(specific: str, item: str, requirement: str):
73
+ assert os.path.exists("./projgen.json")
74
+ with open("./projgen.json", "r") as f:
75
+ data = json.loads(f.read())
76
+ if specific not in data['database']:
77
+ data['database'][specific] = {}
78
+ if item not in data['database'][specific]:
79
+ data['database'][specific][item] = []
80
+ data['database'][specific][item].append(requirement)
81
+ with open("./projgen.json", "w") as f:
82
+ f.write(json.dumps(data, indent=4))
83
+
84
+ @app.command()
85
+ def show_database():
86
+ assert os.path.exists("./projgen.json")
87
+ with open("./projgen.json", "r") as f:
88
+ data = json.loads(f.read())
89
+ for key, value in data['database'].items():
90
+ print(f"[bold]{key}[/bold]:")
91
+ for k, v in value.items():
92
+ print(f"·\t{k}: {v}")
93
+
94
+ def main():
95
+ app()
96
+
97
+ if __name__ == '__main__':
98
+ main()
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.3
2
+ Name: projgen
3
+ Version: 0.0.1
4
+ Summary: Project Manager
5
+ Author-email: Ceayo <ceayo@duck.com>
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # ProjGen: The Project Manager
@@ -0,0 +1,5 @@
1
+ projgen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ projgen/__main__.py,sha256=k5xsqW8XwcQRDWaAwSk6T-wcWXH3gFsK2qehrggunmQ,3276
3
+ projgen-0.0.1.dist-info/METADATA,sha256=rOtOvCezlgUkEDTml2s8iJblNzcQ7LFn9eKctT4I6Pk,353
4
+ projgen-0.0.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
5
+ projgen-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.24.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any