papi-projects 0.2.0__tar.gz → 0.2.2__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.1
2
2
  Name: papi-projects
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: PAPI is an API for managing projects
5
5
  License: MIT
6
6
  Author: sandyjmacdonald
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
13
  Requires-Dist: httpx (>=0.27.2,<0.28.0)
14
14
  Requires-Dist: pendulum (>=3.0.0,<4.0.0)
15
+ Requires-Dist: pyperclip (>=1.9.0,<2.0.0)
15
16
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
16
17
  Requires-Dist: tinydb (>=4.8.0,<5.0.0)
17
18
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "papi-projects"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "PAPI is an API for managing projects"
5
5
  authors = ["sandyjmacdonald <sandyjmacdonald@gmail.com>"]
6
6
  license = "MIT"
@@ -17,6 +17,7 @@ pendulum = "^3.0.0"
17
17
  httpx = "^0.27.2"
18
18
  tinydb = "^4.8.0"
19
19
  python-dotenv = "^1.0.0"
20
+ pyperclip = "^1.9.0"
20
21
 
21
22
  [tool.poetry.scripts]
22
23
  create-project = "scripts.create_project:main"
@@ -1,4 +1,5 @@
1
1
  import argparse
2
+ import pyperclip
2
3
  from papi.wrappers import NotionWrapper
3
4
  from papi import config, setup_logger
4
5
  from papi.user import User
@@ -22,7 +23,7 @@ def main():
22
23
  "-p", "--project_id", type=str, help="full project ID, e.g. P2024-JAS-ABCD, if already generated", required=False
23
24
  )
24
25
  parser.add_argument(
25
- '--enable-logging', action='store_true', help='enable logging output for the papi librar.'
26
+ '--enable-logging', action='store_true', help='enable logging output for the papi library.'
26
27
  )
27
28
  parser.add_argument(
28
29
  '--log-level', type=str, choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], default='INFO', help='set the logging level (default: INFO)'
@@ -51,24 +52,24 @@ def main():
51
52
  project_name = args.name
52
53
  project_id = args.project_id
53
54
 
54
- if user_id and not user_name:
55
- user = User(user_id=user_id)
56
- elif user_name and not user_id:
57
- user = User(user_name)
58
- elif user_id and user_name:
59
- user = User(user_name, user_id=user_id)
60
- else:
61
- logger.warning("Please provide either a three-letter user ID and/or user name")
62
- return
63
-
64
55
  if project_id and not project_name:
65
56
  project = Project(id=project_id)
57
+ user_id = project.user_id
58
+ user = User(user_id=user_id)
66
59
  elif project_name and not project_id:
60
+ if user_id and not user_name:
61
+ user = User(user_id=user_id)
62
+ elif user_name and not user_id:
63
+ user = User(user_name)
64
+ elif user_id and user_name:
65
+ user = User(user_name, user_id=user_id)
67
66
  project = Project(name=project_name, user_id=user.user_id)
68
67
  elif project_id and project_name:
69
68
  project = Project(name=project_name, id=project_id)
69
+ user_id = project.user_id
70
+ user = User(user_id=user_id)
70
71
  else:
71
- logger.warning("Please provide either a valid project ID and/or project name")
72
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
72
73
  return
73
74
 
74
75
  # Create project on Notion
@@ -77,6 +78,10 @@ def main():
77
78
  notion_proj_id = notion.create_project(project, user, notion_projects_db, user_page_id=user_page_id)
78
79
  else:
79
80
  notion_proj_id = notion.create_project(project, user, notion_projects_db)
81
+
82
+ pyperclip.copy(project.id)
83
+
84
+ logger.info(f"Project created with ID: {project.id} (copied to clipboard)")
80
85
 
81
86
  if __name__ == "__main__":
82
87
  main()
@@ -1,5 +1,6 @@
1
1
  import sys
2
2
  import argparse
3
+ import pyperclip
3
4
  from papi.wrappers import NotionWrapper, TogglTrackWrapper
4
5
  from papi import config, setup_logger
5
6
  from papi.user import User
@@ -108,24 +109,24 @@ def main():
108
109
  enable_toggl = args.enable_toggl
109
110
  enable_notion = args.enable_notion
110
111
 
111
- if user_id and not user_name:
112
- user = User(user_id=user_id)
113
- elif user_name and not user_id:
114
- user = User(user_name)
115
- elif user_id and user_name:
116
- user = User(user_name, user_id=user_id)
117
- else:
118
- logger.warning("Please provide either a three-letter user ID and/or user name")
119
- return
120
-
121
112
  if project_id and not project_name:
122
113
  project = Project(id=project_id)
114
+ user_id = project.user_id
115
+ user = User(user_id=user_id)
123
116
  elif project_name and not project_id:
117
+ if user_id and not user_name:
118
+ user = User(user_id=user_id)
119
+ elif user_name and not user_id:
120
+ user = User(user_name)
121
+ elif user_id and user_name:
122
+ user = User(user_name, user_id=user_id)
124
123
  project = Project(name=project_name, user_id=user.user_id)
125
124
  elif project_id and project_name:
126
125
  project = Project(name=project_name, id=project_id)
126
+ user_id = project.user_id
127
+ user = User(user_id=user_id)
127
128
  else:
128
- logger.warning("Please provide either a valid project ID and/or project name")
129
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
129
130
  return
130
131
 
131
132
  if enable_toggl:
@@ -147,6 +148,8 @@ def main():
147
148
  # Create project on Toggl Track
148
149
  toggl_proj_id = toggl.create_project(project, toggl.default_workspace_id)
149
150
 
151
+ pyperclip.copy(project.id)
152
+
150
153
  if enable_notion:
151
154
  # Set up Notion API wrapper
152
155
  #
@@ -166,6 +169,10 @@ def main():
166
169
  notion_proj_id = notion.create_project(project, user, notion_projects_db, user_page_id=user_page_id)
167
170
  else:
168
171
  notion_proj_id = notion.create_project(project, user, notion_projects_db)
172
+
173
+ pyperclip.copy(project.id)
174
+
175
+ logger.info(f"Project created with ID: {project.id} (copied to clipboard)")
169
176
 
170
177
  if __name__ == "__main__":
171
178
  main()
@@ -1,4 +1,5 @@
1
1
  import argparse
2
+ import pyperclip
2
3
  from papi.wrappers import TogglTrackWrapper
3
4
  from papi import config, setup_logger
4
5
  from papi.project import Project
@@ -53,28 +54,18 @@ def main():
53
54
  project_name = args.name
54
55
  project_id = args.project_id
55
56
 
56
- if not project_id and user_id:
57
- # Create project instance, grant code and name are optional
58
- if grant_code and project_name:
59
- project = Project(user_id=user_id, grant_code=grant_code, name=project_name)
60
- elif grant_code and not project_name:
61
- project = Project(user_id=user_id, grant_code=grant_code)
62
- elif not grant_code and project_name:
63
- project = Project(user_id=user_id, name=project_name)
57
+ if project_id and not project_name:
58
+ project = Project(id=project_id)
59
+ elif project_name and not project_id:
60
+ if user_id:
61
+ project = Project(name=project_name, user_id=user_id)
64
62
  else:
65
- project = Project(user_id=user_id)
66
- elif not user_id and project_id:
67
- # Create project instance, grant code and name are optional
68
- if grant_code and project_name:
69
- project = Project(id=project_id, grant_code=grant_code, name=project_name)
70
- elif grant_code and not project_name:
71
- project = Project(id=project_id, grant_code=grant_code)
72
- elif not grant_code and project_name:
73
- project = Project(id=project_id, name=project_name)
74
- else:
75
- project = Project(id=project_id)
63
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
64
+ return
65
+ elif project_id and project_name:
66
+ project = Project(name=project_name, id=project_id)
76
67
  else:
77
- logger.warning("Please provide either a three-letter user_id *or* a full project_id")
68
+ logger.warning("Please provide either a valid project ID or valid three-letter user ID")
78
69
  return
79
70
 
80
71
  # Create project on Toggl Track
@@ -84,5 +75,9 @@ def main():
84
75
  # otherwise it will just be the project ID
85
76
  toggl_proj_id = toggl.create_project(project, toggl.default_workspace_id)
86
77
 
78
+ pyperclip.copy(project.id)
79
+
80
+ logger.info(f"Project created with ID: {project.id} (copied to clipboard)")
81
+
87
82
  if __name__ == "__main__":
88
83
  main()
File without changes