Skip to content

Commit

Permalink
Adding anaconda dev container (#30). Closes #31
Browse files Browse the repository at this point in the history
* Adding anaconda dev container

Adding dev container to VSCode to enable local execution.

* Make awake_sleep_seconds optional and support None

I have some days in my Garmin Sleep data where I have no restless moments sleeping this results in an error daily_sleep_dto.awake_sleep_seconds
  Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType]

* pre-commit actions

* bump version again

* Removing unnecessary comments

Removing the unnecessary comments from the devcontainer.json and docker files.

* Fixing validation errors for SleepData

I had a strange sleep report when crossing timezones flying back from Europe where the sleep score was INVALID and values were missing. Making the missing values optional to remove validation errors.

* fix lint

---------

Co-authored-by: Matin Tamizi <[email protected]>
  • Loading branch information
nzigel and matin authored Nov 2, 2023
1 parent fad9855 commit 5aadba6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/devcontainers/anaconda:0-3

# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp
10 changes: 10 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Anaconda (Python 3)",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/node:1": {}
}
}
3 changes: 3 additions & 0 deletions .devcontainer/noop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file copied into the container along with environment.yml* from the parent
folder. This file is included to prevents the Dockerfile COPY instruction from
failing if no environment.yml is found.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ test.py
.pdm-python
tmp/
.pdm.toml

# exclude saved oauth tokens
oauth*_token.json
10 changes: 5 additions & 5 deletions garth/data/sleep.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class DailySleepDTO:
sleep_end_timestamp_gmt: int
sleep_start_timestamp_local: int
sleep_end_timestamp_local: int
unmeasurable_sleep_seconds: int
deep_sleep_seconds: int
light_sleep_seconds: int
rem_sleep_seconds: int
awake_sleep_seconds: int
device_rem_capable: bool
retro: bool
unmeasurable_sleep_seconds: Optional[int] = None
deep_sleep_seconds: Optional[int] = None
light_sleep_seconds: Optional[int] = None
rem_sleep_seconds: Optional[int] = None
awake_sleep_seconds: Optional[int] = None
sleep_from_device: Optional[bool] = None
sleep_version: Optional[int] = None
awake_count: Optional[int] = None
Expand Down
2 changes: 1 addition & 1 deletion garth/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.40"
__version__ = "0.4.41"

0 comments on commit 5aadba6

Please sign in to comment.