papi-projects 0.1.1__tar.gz → 0.1.3__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.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.1
2
+ Name: papi-projects
3
+ Version: 0.1.3
4
+ Summary: PAPI is an API for managing projects
5
+ License: MIT
6
+ Author: sandyjmacdonald
7
+ Author-email: sandyjmacdonald@gmail.com
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: httpx (>=0.27.2,<0.28.0)
14
+ Requires-Dist: pendulum (>=3.0.0,<4.0.0)
15
+ Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
16
+ Requires-Dist: tinydb (>=4.8.0,<5.0.0)
17
+ Description-Content-Type: text/markdown
18
+
19
+ PAPI is an API for managing projects.
20
+
21
+ <img src="https://imgur.com/lprJ3mP.jpg" alt="HAHA BUSINESS meme" height="250">
22
+
23
+ It has functionality for creating User and Project instances, storing users in a TinyDB database, and generating project IDs in the format we use in the Data Science group (at the Bioscience Technology Facility at the University of York). It also has wrappers for Asana and Toggl Track, two tools we use for project management and time tracking, respectively.
24
+
25
+ Much of the functionality is tailor-made to the way we manage projects in our group, but make of it what you will!
26
+
27
+ ## Installation
28
+
29
+ The simplest way to install this is to do as follows:
30
+
31
+ ```
32
+ pip install papi-projects
33
+ ```
34
+
35
+ You can also install the Poetry packaging and dependency tool and then clone this repository and install with poetry, as follows:
36
+
37
+ ```
38
+ pipx install poetry
39
+ git clone https://github.com/sandyjmacdonald/papi
40
+ cd papi
41
+ poetry install
42
+ ```
43
+
44
+ ## Environment variables
45
+
46
+ The Asana and Toggl Track wrappers expect several environment variables for API keys, etc. and the best way to do this is with a .env file that can be loaded via the Python dotenv library straight into your script. The CLI scripts provided also expect these variables to be in a .env file.
47
+
48
+ The .env file should look as follows:
49
+
50
+ ```
51
+ # Asana config:
52
+ ASANA_API_KEY="YOURAPIKEY"
53
+ ASANA_PASSWORD=""
54
+ ASANA_WORKSPACE="myworkspace"
55
+ ASANA_TEAM="My Team Name"
56
+
57
+ # toggl track config:
58
+ TOGGL_TRACK_API_KEY="YOURAPIKEY"
59
+ TOGGL_TRACK_PASSWORD="api_token"
60
+ TOGGL_TRACK_WORKSPACE="My Workspace Name"
61
+ ```
62
+
63
+ The `ASANA_PASSWORD` and `TOGGL_TRACK_PASSWORD` values can be left as above, the remaining ones should be replaced with the correct values from your Asana and Toggl Track accounts.
64
+
65
+ This .env file can either be put in your working directory or in the top-level papi module folder wherever it is installed.
66
+
67
+ Alternatively, these values can be hard-coded in your scripts, but this is not advised and will not work with the CLI scripts provided.
68
+
69
+ ## CLI scripts
70
+
71
+ Two convenience CLI scripts are provided for common Toggl Track tasks. They are:
72
+
73
+ ## create-toggl-project
74
+
75
+ This script creates a project ID if necessary, and adds the project to your Toggl Track:
76
+
77
+ ```
78
+ usage: create-toggl-project [-h] [-u USER_ID] [-g GRANT_CODE] [-n NAME] [-p PROJECT_ID]
79
+
80
+ options:
81
+ -h, --help show this help message and exit
82
+ -u USER_ID, --user_id USER_ID
83
+ three-letter user ID, e.g. CRD
84
+ -g GRANT_CODE, --grant_code GRANT_CODE
85
+ grant code, e.g. R12345
86
+ -n NAME, --name NAME short project name, e.g. 'RNA-seq analysis'
87
+ -p PROJECT_ID, --project_id PROJECT_ID
88
+ full project ID, e.g. P2024-ABC-DEFG, if already generated
89
+ ```
90
+
91
+ Ideally, a three-character user ID, grant code, and short project name will be provided, and PAPI will generate the project ID, e.g.
92
+
93
+ ```
94
+ create-toggl-project -u CRD -g R12345 -n 'Such project. Wow.'
95
+ ```
96
+
97
+ If a project ID has already been created, then it can be provided via the `-p` argument and the user ID is not necessary, e.g.
98
+
99
+ ```
100
+ create-toggl-project -p P2024-CRD-ABCD -g R12345 -n 'Such project. Wow.'
101
+ ```
102
+
103
+ The grant code (`-g`) and name (`-n`) are not required, but either a project ID (`-p`) or user ID (`-u`) _is_ necessary.
104
+
105
+ ## collate-toggl-hours
106
+
107
+ This script collates and returns your Toggl Track hours tracked over a specified time period:
108
+
109
+ ```
110
+ usage: collate-toggl-hours [-h] -s START [-e END] [-o OUTPUT]
111
+
112
+ options:
113
+ -h, --help show this help message and exit
114
+ -s START, --start START
115
+ start date in YYYY-MM-DD format
116
+ -e END, --end END end date in YYYY-MM-DD format, if none supplied then end date is now
117
+ -o OUTPUT, --output OUTPUT
118
+ output TSV filename, omit to write to stdout
119
+ ```
120
+
121
+ This script collates your tracked hours for any projects worked during a given time period and return the project name and decimal number of hours in tab-separated format.
122
+
123
+ If an output filename is provided, then the resulting hours are saved to that file, otherwise they are printed to stdout.
124
+
125
+ If no end date (`-e`) is provided, then the end date is the current time/date.
126
+
127
+ To collate your hours worked in August 2024:
128
+
129
+ ```
130
+ collate-toggl-hours -s 2024-08-01 -e 2024-08-31 -o august-2024-hours.tsv
131
+ ```
@@ -0,0 +1,113 @@
1
+ PAPI is an API for managing projects.
2
+
3
+ <img src="https://imgur.com/lprJ3mP.jpg" alt="HAHA BUSINESS meme" height="250">
4
+
5
+ It has functionality for creating User and Project instances, storing users in a TinyDB database, and generating project IDs in the format we use in the Data Science group (at the Bioscience Technology Facility at the University of York). It also has wrappers for Asana and Toggl Track, two tools we use for project management and time tracking, respectively.
6
+
7
+ Much of the functionality is tailor-made to the way we manage projects in our group, but make of it what you will!
8
+
9
+ ## Installation
10
+
11
+ The simplest way to install this is to do as follows:
12
+
13
+ ```
14
+ pip install papi-projects
15
+ ```
16
+
17
+ You can also install the Poetry packaging and dependency tool and then clone this repository and install with poetry, as follows:
18
+
19
+ ```
20
+ pipx install poetry
21
+ git clone https://github.com/sandyjmacdonald/papi
22
+ cd papi
23
+ poetry install
24
+ ```
25
+
26
+ ## Environment variables
27
+
28
+ The Asana and Toggl Track wrappers expect several environment variables for API keys, etc. and the best way to do this is with a .env file that can be loaded via the Python dotenv library straight into your script. The CLI scripts provided also expect these variables to be in a .env file.
29
+
30
+ The .env file should look as follows:
31
+
32
+ ```
33
+ # Asana config:
34
+ ASANA_API_KEY="YOURAPIKEY"
35
+ ASANA_PASSWORD=""
36
+ ASANA_WORKSPACE="myworkspace"
37
+ ASANA_TEAM="My Team Name"
38
+
39
+ # toggl track config:
40
+ TOGGL_TRACK_API_KEY="YOURAPIKEY"
41
+ TOGGL_TRACK_PASSWORD="api_token"
42
+ TOGGL_TRACK_WORKSPACE="My Workspace Name"
43
+ ```
44
+
45
+ The `ASANA_PASSWORD` and `TOGGL_TRACK_PASSWORD` values can be left as above, the remaining ones should be replaced with the correct values from your Asana and Toggl Track accounts.
46
+
47
+ This .env file can either be put in your working directory or in the top-level papi module folder wherever it is installed.
48
+
49
+ Alternatively, these values can be hard-coded in your scripts, but this is not advised and will not work with the CLI scripts provided.
50
+
51
+ ## CLI scripts
52
+
53
+ Two convenience CLI scripts are provided for common Toggl Track tasks. They are:
54
+
55
+ ## create-toggl-project
56
+
57
+ This script creates a project ID if necessary, and adds the project to your Toggl Track:
58
+
59
+ ```
60
+ usage: create-toggl-project [-h] [-u USER_ID] [-g GRANT_CODE] [-n NAME] [-p PROJECT_ID]
61
+
62
+ options:
63
+ -h, --help show this help message and exit
64
+ -u USER_ID, --user_id USER_ID
65
+ three-letter user ID, e.g. CRD
66
+ -g GRANT_CODE, --grant_code GRANT_CODE
67
+ grant code, e.g. R12345
68
+ -n NAME, --name NAME short project name, e.g. 'RNA-seq analysis'
69
+ -p PROJECT_ID, --project_id PROJECT_ID
70
+ full project ID, e.g. P2024-ABC-DEFG, if already generated
71
+ ```
72
+
73
+ Ideally, a three-character user ID, grant code, and short project name will be provided, and PAPI will generate the project ID, e.g.
74
+
75
+ ```
76
+ create-toggl-project -u CRD -g R12345 -n 'Such project. Wow.'
77
+ ```
78
+
79
+ If a project ID has already been created, then it can be provided via the `-p` argument and the user ID is not necessary, e.g.
80
+
81
+ ```
82
+ create-toggl-project -p P2024-CRD-ABCD -g R12345 -n 'Such project. Wow.'
83
+ ```
84
+
85
+ The grant code (`-g`) and name (`-n`) are not required, but either a project ID (`-p`) or user ID (`-u`) _is_ necessary.
86
+
87
+ ## collate-toggl-hours
88
+
89
+ This script collates and returns your Toggl Track hours tracked over a specified time period:
90
+
91
+ ```
92
+ usage: collate-toggl-hours [-h] -s START [-e END] [-o OUTPUT]
93
+
94
+ options:
95
+ -h, --help show this help message and exit
96
+ -s START, --start START
97
+ start date in YYYY-MM-DD format
98
+ -e END, --end END end date in YYYY-MM-DD format, if none supplied then end date is now
99
+ -o OUTPUT, --output OUTPUT
100
+ output TSV filename, omit to write to stdout
101
+ ```
102
+
103
+ This script collates your tracked hours for any projects worked during a given time period and return the project name and decimal number of hours in tab-separated format.
104
+
105
+ If an output filename is provided, then the resulting hours are saved to that file, otherwise they are printed to stdout.
106
+
107
+ If no end date (`-e`) is provided, then the end date is the current time/date.
108
+
109
+ To collate your hours worked in August 2024:
110
+
111
+ ```
112
+ collate-toggl-hours -s 2024-08-01 -e 2024-08-31 -o august-2024-hours.tsv
113
+ ```
@@ -1,6 +1,7 @@
1
1
  from dotenv import dotenv_values
2
2
 
3
- config = dotenv_values(".env")
3
+ dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
4
+ config = dotenv_values(dotenv_path)
4
5
 
5
6
  ASANA_API_KEY = config["ASANA_API_KEY"]
6
7
  ASANA_PASSWORD = config["ASANA_PASSWORD"]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "papi-projects"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  description = "PAPI is an API for managing projects"
5
5
  authors = ["sandyjmacdonald <sandyjmacdonald@gmail.com>"]
6
6
  license = "MIT"
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: papi-projects
3
- Version: 0.1.1
4
- Summary: PAPI is an API for managing projects
5
- License: MIT
6
- Author: sandyjmacdonald
7
- Author-email: sandyjmacdonald@gmail.com
8
- Requires-Python: >=3.11,<4.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: httpx (>=0.27.2,<0.28.0)
14
- Requires-Dist: pendulum (>=3.0.0,<4.0.0)
15
- Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
16
- Requires-Dist: tinydb (>=4.8.0,<5.0.0)
17
- Description-Content-Type: text/markdown
18
-
19
-
File without changes