|
1 | 1 | # Project TODO and Notes |
2 | 2 |
|
3 | | -## TODO |
| 3 | +## Refactoring TODOs |
4 | 4 |
|
5 | | -- [ ] Complete coverage |
| 5 | +- Typing |
6 | 6 |
|
7 | | -- [ ] Get rid of deprecation warnings from test coverage |
| 7 | + - Try to get rid of `Optional[Dict[str, Any]]` args |
8 | 8 |
|
9 | | -- [ ] Finish method naming and typing documentation. |
| 9 | +- base.py: reorganize and see what we can move out. |
10 | 10 |
|
11 | | -- [ ] Confront MyPy. See https://stackoverflow.com/a/51294709 for json help |
| 11 | + - Rename to `_base`? Files it first, makes it clearer that everything in it is |
| 12 | + private |
| 13 | + - Move the methods for building `curl` commands into a mixin? It's a lot of |
| 14 | + code for an isolated and tightly scoped feature. |
| 15 | + - refactor `_make_request`. |
| 16 | + - do we need both `data` and `json`? Also, could we simplify a lot of typing |
| 17 | + if we separated GET, POST, and DELETE methods? Maybe even a separate, |
| 18 | + second non-auth GET? Could use `@overload` |
| 19 | + - we had to makee a `ParamDict` type in `nutrition.py`. Use this everywhere? |
| 20 | + - start by looking at how many methods use which params |
12 | 21 |
|
13 | | -- [ ] When typing resource, wrap the actual response type around the JSONType,, |
14 | | - e.g. List[JSONType], Dict[str, JSONType], so that the user can actually know |
15 | | - what to expect (or None, of course) |
| 22 | +- client.py: |
16 | 23 |
|
17 | | -- [ ] Test that all methods have an alias in `Client` and that the signatures |
18 | | - match |
| 24 | + - Creat and Test that all methods have an alias in `Client` and that the |
| 25 | + signatures match |
| 26 | + - Make sure that `ClientValidationException` is getting used for arbitrary |
| 27 | + validations like: |
19 | 28 |
|
20 | | -- [ ] Rationalize `ClientValidationException` subclass inheritance |
| 29 | +```python |
| 30 | +if not food_id and not (food_name and calories): |
| 31 | + raise ClientValidationException( |
| 32 | + "Must provide either food_id or (food_name and calories)" |
| 33 | + ) |
| 34 | +``` |
| 35 | + |
| 36 | +- exceptions.py |
| 37 | + |
| 38 | + - Should ClientValidationException really subclass FitbitAPIException? It |
| 39 | + doesn't need the API lookup mapping (`exception_type`) or a `status_code`, |
| 40 | + so we may just be able to simplify it. The most important thing is that the |
| 41 | + user understands that the message came from the client prior to the API |
| 42 | + call. |
| 43 | + |
| 44 | +- Resource docstrings/documentation: |
| 45 | + |
| 46 | + - Update the list of exceptions that are raised in the doctring for |
| 47 | + `base._make_request` |
| 48 | + - Review all documentation and between **API docs, return types, and |
| 49 | + exceptions**, update the doctrings |
| 50 | + - Update "Returns" in all resource docstrings |
| 51 | + - Review and add link to |
| 52 | + https://dev.fitbit.com/build/reference/web-api/developer-guide/best-practices/ |
| 53 | + in README--they still apply! |
21 | 54 |
|
22 | | -- [ ] Set up CI! |
| 55 | +- Set up CI! |
23 | 56 |
|
24 | | -- [ ] Consider a "replace_food_log" helper that does a delete + an add in one. |
25 | | - (there might be several of these that make sense--just take an ID and then the |
26 | | - signature of the "create" method) |
| 57 | +## Longer term TODOs |
| 58 | + |
| 59 | +- Performance profiling |
27 | 60 |
|
28 | 61 | - Docs! https://www.sphinx-doc.org/en/master/#get-started (put on github pages?) |
29 | 62 |
|
30 | | -- [ ] Why does this log twice: |
| 63 | +- Why does this log twice: |
31 | 64 |
|
32 | 65 | ```log |
33 | 66 | [2025-02-07 16:41:38,471] ERROR [fitbit_client.NutritionResource] ValidationException: Intensity level "MEDIUM" available only if weight objective is to lose weight. [Type: validation, Status: 400], Field: intensity |
34 | 67 | [2025-02-07 16:41:38,472] ERROR [fitbit_client.NutritionResource] ValidationException in create_food_goal for foods/log/goal.json: Intensity level "MEDIUM" available only if weight objective is to lose weight. |
35 | 68 |
|
36 | 69 | ``` |
37 | 70 |
|
38 | | -- [ ] For methods with paging, figure out how to encapsulate it...do they call |
| 71 | +- For methods with paging, figure out how to encapsulate it...do they call |
39 | 72 | `_make_request` with the URL in the response, or what? Does the response |
40 | 73 | return a 2-tuple where the first item is the response and second is a |
41 | 74 | pre-baked function that can me called? See: |
|
48 | 81 | be reused. |
49 | 82 | - We may need a public version of a generic `make_request` method. |
50 | 83 |
|
51 | | -- [ ] For all `create_...`methods, add the ID from the response to logs and |
52 | | - maybe something human readable, like the first n characters of the name??. |
53 | | - Right now: |
| 84 | +- For all `create_...`methods, add the ID from the response to logs and maybe |
| 85 | + something human readable, like the first n characters of the name??. Right |
| 86 | + now: |
54 | 87 |
|
55 | 88 | ```log |
56 | 89 | [2025-02-05 06:09:34,828] INFO [fitbit_client.NutritionResource] create_food_log succeeded for foods/log.json (status 201) |
57 | 90 | ``` |
58 | 91 |
|
59 | | -- [ ] Review and add link to |
60 | | - https://dev.fitbit.com/build/reference/web-api/developer-guide/best-practices/ |
61 | | - in README--they still apply! |
62 | | - |
63 | | -- [ ] Form to change scopes are part of OAuth flow? Maybe get rid of the cut and |
| 92 | +- Form to change scopes are part of OAuth flow? Maybe get rid of the cut and |
64 | 93 | paste method altogether? It's less to test... |
65 | 94 |
|
66 | | -- [ ] Make the food download_food_logs (rename to `get_food_logs`) and food log |
67 | | - to CSV part of one helper package. It should expand the foods to have their |
68 | | - complete nutrition (a separate call for each unique food) (put this in a |
69 | | - `tools` package??) |
| 95 | +- Extension ideas: |
70 | 96 |
|
71 | | -- [ ] PyPI deployment |
| 97 | + - Make the food download_food_logs method (rename to `get_food_logs`) and food |
| 98 | + log to CSV part of one helper package. It should expand the foods to have |
| 99 | + their complete nutrition (a separate call for each unique food) (put this in |
| 100 | + a `tools` package??) |
| 101 | + - PRIVATE filters on methods that return PUBLIC and PRIVATE stuff (API doesn't |
| 102 | + seem to have this). Would require a sidecar database or pickle - it just |
| 103 | + needs to be a hash with a few elements to facilitate a lookup via the api |
| 104 | + - Consider e.g., a "replace_food_log" extension that does a delete + an add in |
| 105 | + one. (there might be several of these that make sense--just take an ID and |
| 106 | + then the signature of the "create" method). |
72 | 107 |
|
73 | | -- [ ] Extension: PRIVATE filters on methods that return PUBLIC and PRIVATE stuff |
74 | | - (API doesn't seem to have this). Maybe a sidecar database? |
| 108 | +- PyPI deployment |
75 | 109 |
|
76 | | -- [ ] Enum for units? (it'll be big, maybe just common ones?) |
| 110 | +- Enum for units? (it'll be big, maybe just common ones?) |
77 | 111 |
|
78 | 112 | ## CI/CD/Linting |
79 | 113 |
|
80 | | -- [ ] Linting |
81 | | - |
82 | | - - [x] black |
83 | | - - [x] isort |
84 | | - - [x] mdformat |
85 | | - - [ ] mypy |
86 | | - |
87 | 114 | - GitHub Actions Setup |
88 | 115 |
|
89 | | - - [ ] Linting |
90 | | - - [ ] black |
91 | | - - [ ] isort |
92 | | - - [ ] mdformat |
93 | | - - [ ] mypy |
94 | | - - [ ] Test running (TBD) |
95 | | - - [ ] Coverage reporting (TBD) |
96 | | - - [ ] Automated PyPI deployment |
| 116 | + - Linting |
| 117 | + - black |
| 118 | + - isort |
| 119 | + - mdformat |
| 120 | + - mypy |
| 121 | + - Test running (TBD) |
| 122 | + - Coverage reporting (TBD) |
| 123 | + - Automated PyPI deployment |
0 commit comments