Skip to content

Commit ccfa52f

Browse files
authored
Merge pull request #277 from cyberjunky/revamp
Revamped API code and enhanced example/demo code
2 parents 0caa04a + 4addc9a commit ccfa52f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+7943
-18239
lines changed

.coderabbit.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@
22
language: "en-US"
33
early_access: true
44
reviews:
5-
profile: "assertive"
6-
request_changes_workflow: false
5+
profile: "pythonic"
6+
request_changes_workflow: true
77
high_level_summary: true
88
poem: false
99
review_status: true
1010
collapse_walkthrough: false
1111
auto_review:
1212
enabled: true
1313
drafts: false
14+
auto_fix:
15+
enabled: true
16+
include_imports: true
17+
include_type_hints: true
18+
include_security_fixes: true
1419
path_filters:
1520
- "!tests/**/cassettes/**"
1621
path_instructions:
1722
- path: "tests/**"
1823
instructions: |
1924
- test functions shouldn't have a return type hint
2025
- it's ok to use `assert` instead of `pytest.assume()`
26+
- path: "garminconnect/**"
27+
instructions: |
28+
- prefer modern Python patterns (3.10+)
29+
- use type hints consistently
30+
- follow PEP 8 and modern Python conventions
31+
- suggest performance improvements where applicable
2132
chat:
2233
auto_reply: true

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# EditorConfig configuration for code consistency
2+
# https://editorconfig.org/
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_style = space
10+
indent_size = 4
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
max_line_length = 88
14+
15+
[*.py]
16+
indent_size = 4
17+
18+
[*.{yml,yaml}]
19+
indent_size = 2
20+
21+
[*.{js,json}]
22+
indent_size = 2
23+
24+
[*.toml]
25+
indent_size = 4
26+
27+
[*.md]
28+
trim_trailing_whitespace = false

.github/dependabot.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "weekly"
7+
interval: daily
8+
time: "20:00"
9+
timezone: "Europe/Amsterdam"
810

911
- package-ecosystem: "pip"
1012
directory: "/"
1113
schedule:
12-
interval: "weekly"
14+
interval: daily
15+
time: "20:00"
16+
timezone: "Europe/Amsterdam"

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI
2+
3+
"on":
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- revamp
9+
pull_request:
10+
branches:
11+
- main
12+
- master
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: ["3.10", "3.11", "3.12", "3.13"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install pdm
33+
pdm install --group :all
34+
35+
- name: Lint with ruff
36+
run: |
37+
pdm run ruff check .
38+
39+
- name: Format check with black
40+
run: |
41+
pdm run black --check .
42+
43+
- name: Type check with mypy
44+
run: |
45+
pdm run mypy garminconnect --ignore-missing-imports
46+
47+
# - name: Test with pytest
48+
# env:
49+
# GARMINTOKENS: ${{ secrets.GARMINTOKENS }}
50+
# run: |
51+
# # Use existing VCR cassettes for CI to avoid network calls
52+
# pdm run pytest tests/ -v --tb=short --vcr-record=none
53+
# continue-on-error: false
54+
55+
# - name: Upload coverage reports
56+
# if: matrix.python-version == '3.11'
57+
# env:
58+
# GARMINTOKENS: ${{ secrets.GARMINTOKENS }}
59+
# run: |
60+
# pdm run coverage run -m pytest -v --tb=short --vcr-record=none
61+
# pdm run coverage xml
62+
# continue-on-error: true
63+
64+
- name: Upload coverage artifact
65+
if: matrix.python-version == '3.11'
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage-xml
69+
path: coverage.xml
70+
71+
security:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Set up Python
77+
uses: actions/setup-python@v5
78+
with:
79+
python-version: "3.11"
80+
81+
- name: Install dependencies
82+
run: |
83+
python -m pip install --upgrade pip
84+
pip install bandit[toml] safety
85+
86+
- name: Security check with bandit
87+
run: |
88+
bandit -r garminconnect -f json -o bandit-report.json || true
89+
90+
- name: Safety check
91+
run: |
92+
safety check --json --output safety-report.json || true
93+
continue-on-error: true

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Custom
2-
response.json
2+
your_data/
3+
pdm.lock
34

45
# Virtual environments
56
.venv/
67
.pdm-python
7-
__pypackages__/
88

99
# Byte-compiled / optimized / DLL files
1010
__pycache__/
@@ -44,6 +44,9 @@ MANIFEST
4444
# PyCharm idea folder
4545
.idea/
4646

47+
# VS Code
48+
.vscode/
49+
4750
# Installer logs
4851
pip-log.txt
4952
pip-delete-this-directory.txt
@@ -141,4 +144,4 @@ dmypy.json
141144
.pyre/
142145

143146
# Ignore folder for local testing
144-
ignore/
147+
ignore/

.pre-commit-config.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,24 @@ repos:
1818
- tomli
1919
exclude: 'cassettes/'
2020

21+
- repo: https://github.com/psf/black
22+
rev: 24.8.0
23+
hooks:
24+
- id: black
25+
language_version: python3
26+
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.6.4
29+
hooks:
30+
- id: ruff
31+
args: [--fix, --unsafe-fixes]
32+
- id: ruff-format
33+
2134
- repo: local
2235
hooks:
23-
- id: lint
24-
name: lint
25-
entry: make lint
36+
- id: mypy
37+
name: mypy type checking
38+
entry: .venv/bin/pdm run mypy garminconnect tests
2639
types: [python]
2740
language: system
2841
pass_filenames: false

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
],
55
"python.testing.unittestEnabled": false,
66
"python.testing.pytestEnabled": true
7-
}
7+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2024 Ron Klinkien
3+
Copyright (c) 2020-2025 Ron Klinkien
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)