Git Product home page Git Product logo

fitbit-downloader's Introduction

PyPI PyPI - License Documentation Tests Run on Ubuntu Python Versions Tests Run on Macos Python Versions Tests Run on Windows Python Versions Github Repo

fitbit-downloader

Overview

A CLI and Python tool for downloading Fitbit data

Getting Started

Install fitbit-downloader:

pip install fitbit-downloader

A simple example:

import fitbit_downloader

# Do something with fitbit_downloader

See a more in-depth tutorial here.

Development Status

This project is currently in early-stage development. There may be breaking changes often. While the major version is 0, minor version upgrades will often have breaking changes.

Developing

First, you need a couple global dependencies installed, see their documentation for details:

Then clone the repo and run npm install and mvenv sync dev. Make your changes and then run just to run formatting, linting, and tests.

Develop documentation by running just docs to start up a dev server.

To run tests only, run just test. You can pass additional arguments to pytest, e.g. just test -k test_something.

Prior to committing, you can run just with no arguments to run all the checks.

Download Sample Responses

Run python -m fitbit_downloader.download_samples to output JSON files with the responses.

Generate Response Models

Note: There are currently some manual modifications to the generated files. They are all marked with TODO so that we can work them into the generation. If you re-run the generation, you will need to manually update the files to make the same changes.

Run python -m fitbit_downloader.gen_models to output response models in fitbit_downloader.models from the sample responses.

Author

Created by Nick DeRobertis. MIT License.

Links

See the documentation here.

fitbit-downloader's People

Contributors

github-actions[bot] avatar nickderobertis avatar semantic-release-bot avatar

Watchers

 avatar

fitbit-downloader's Issues

[#48]: refactor auto-merge workflow once Github Actions improves

[#48]: refactor auto-merge workflow once Github Actions improves

The only difference in these jobs is that they checkout master instead of requiring master

  • reuse jobs

  • reuse steps

  • trigger workflow from within action/workflow

  • commit triggered by action triggers push event

# TODO [#48]: refactor auto-merge workflow once Github Actions improves

name: automerge
on:
  pull_request:
    types:
      - unlabeled
      - synchronize
      - opened
      - edited
      - ready_for_review
      - reopened
      - unlocked
  pull_request_review:
    types:
      - submitted
jobs:
  test:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: [3.8]

    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"
      - uses: actions/checkout@v1
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install Pipenv
        uses: dschep/install-pipenv-action@v1
      - name: Install dependencies
        run: |
          pipenv sync
      - name: Lint with flake8
        run: |
          pip install flake8
          # stop the build if there are Python syntax errors or undefined names
          flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
          # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
          flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
      - name: Test with pytest
        run: |
          pipenv run python -m pytest --cov=./ --cov-report=xml
      - name: Static Typing Checks with mypy
        run: |
          pipenv run mypy $(python directory.py)
  automerge:
    runs-on: ubuntu-latest
    needs: test
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python 3.8
        uses: actions/setup-python@v1
        with:
          python-version: 3.8
      - name: Check if maintainer
        env:
          GITHUB_PR_USER: ${{ github.actor }}
        run: |
          python is_maintainer.py;
          exit $?;
      - name: Auto-merge PR
        id: automerge
        if: success()
        uses: "nickderobertis/automerge-action@merged-to-use-temporarily"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_LABELS: "!no auto merge"
          UPDATE_LABELS: "!no auto merge"
      - name: Stop if Not Merged
        run: |
          if $PR_WAS_MERGED; then
            echo "PR was merged, now need to deploy"
            exit 0;
          fi;
          echo "PR was not merged, will not auto-deploy"
          exit 1;
        env:
          PR_WAS_MERGED: ${{ steps.automerge.outputs.merged }}

  # TODO [#48]: refactor auto-merge workflow once Github Actions improves
  #
  # Entire jobs are getting copied between workflow files due to limitations in Github Actions.
  # The only difference in these jobs is that they checkout master instead of requiring master
  #
  # Possible changes to Github Actions that would allow the automerge workflow to be refactored:
  # - reuse jobs
  # - reuse steps
  # - trigger workflow from within action/workflow
  # - commit triggered by action triggers push event
  collectTODO:
    needs: automerge
    runs-on: ubuntu-latest
    steps:
      - uses: "actions/checkout@master"
      - name: "TODO to Issue"
        uses: "nickderobertis/todo-to-issue-action@pr-support"
        id: "todo"

  deploy:
    needs: automerge
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: [3.8]
    steps:
      - uses: actions/checkout@v1
        with:
          ref: refs/heads/master
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      - name: Get package name
        id: package_name
        run: echo ::set-output name=package_name::$(python name.py)
      - uses: nickderobertis/pypi-latest-version-action@master
        id: output_pypi_version
        with:
          package: ${{ steps.package_name.outputs.package_name }}
      - name: Output build version
        id: output_build_version
        run: |
          bash output-version.sh
      - name: Install Pipenv
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        uses: dschep/install-pipenv-action@v1
      - name: Install dependencies
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        run: |
          pipenv sync
          sudo apt-get install pandoc -y
      - name: Build Documentation
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        run: |
          cd docsrc
          pipenv run make github
          cd ..
          echo "" > docs/.nojekyll
      - name: Deploy Documentation
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        uses: peaceiris/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.gh_token }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./docs
      - name: Build PyPI Package
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        run: |
          pipenv run python upload.py --build-only
      - name: Upload PyPI Package
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        uses: pypa/gh-action-pypi-publish@master
        with:
          user: __token__
          password: ${{ secrets.pypi_password }}
      - name: Publish Github Release
        if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
        uses: release-drafter/release-drafter@v5
        with:
          name: "v${{steps.output_build_version.outputs.version}}"
          tag: "v${{steps.output_build_version.outputs.version}}"
          version: "v${{steps.output_build_version.outputs.version}}"
          publish: true
        env:
          GITHUB_TOKEN: ${{ secrets.gh_token }}

df943599e0a32bfca9e2d4b92fd201abccacf5a1

Set this to optional dynamically

Set this to optional dynamically

# TODO: Set this to optional dynamically

    elevation: int
    fairlyActiveMinutes: int
    floors: int
    # TODO: Set this to optional dynamically
    heartRateZones: Optional[List[HeartRateZone]]
    lightlyActiveMinutes: int
    marginalCalories: int
    # TODO: Set this to optional dynamically
    restingHeartRate: Optional[int]
    sedentaryMinutes: int
    steps: int
    veryActiveMinutes: int

28ea18b74c948596c7e369495ee038a4a418c2fb

Set this to optional dynamically

Set this to optional dynamically

# TODO: Set this to optional dynamically

    elevation: int
    fairlyActiveMinutes: int
    floors: int
    # TODO: Set this to optional dynamically
    heartRateZones: Optional[List[HeartRateZone]]
    lightlyActiveMinutes: int
    marginalCalories: int
    # TODO: Set this to optional dynamically
    restingHeartRate: Optional[int]
    sedentaryMinutes: int
    steps: int
    veryActiveMinutes: int

28ea18b74c948596c7e369495ee038a4a418c2fb

[#2]: refactor docs workflow once Github Actions improves

[#2]: refactor docs workflow once Github Actions improves

  • reuse jobs

  • reuse steps

  • trigger workflow from within action/workflow

# TODO [#2]: refactor docs workflow once Github Actions improves

name: Build and Push Docs

on:
  push:
    paths:
      - 'docsrc/**'
    branches:
      - master

jobs:
  # TODO [#2]: refactor docs workflow once Github Actions improves
  #
  # Entire jobs are getting copied between workflow files due to limitations in Github Actions
  #
  # Possible changes to Github Actions that would allow the docs workflow to be refactored:
  # - reuse jobs
  # - reuse steps
  # - trigger workflow from within action/workflow
  test:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install Pipenv
      uses: dschep/install-pipenv-action@v1
    - name: Install dependencies
      run: |
        pipenv sync
    - name: Lint with flake8
      run: |
        pip install flake8
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
    - name: Test with pytest
      run: |
        pipenv run python -m pytest --cov=./ --cov-report=xml
    - name: Upload coverage to Codecov
      if: github.ref == 'refs/heads/master'
      uses: codecov/codecov-action@v1
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        file: ./coverage.xml
        flags: unittests
        name: codecov-pytest
        yml: ./codecov.yml
    - name: Static Typing Checks with mypy
      run: |
        pipenv run mypy $(python directory.py)

  deploy:
    needs: test

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install Pipenv
      uses: dschep/install-pipenv-action@v1
    - name: Install dependencies
      run: |
        pipenv sync
        sudo apt-get install pandoc -y
    - name: Build Documentation
      run: |
        cd docsrc
        pipenv run make github
        cd ..
        echo "" > docs/.nojekyll
    - name: Deploy Documentation
      uses: peaceiris/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.gh_token }}
        PUBLISH_BRANCH: gh-pages
        PUBLISH_DIR: ./docs

16e8ac587daec1c59f9eb08dc8d1bd6751e92dde

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.