update to README and Makefile to support both Python 2 and 3

This commit is contained in:
petergardfjall 2018-09-01 08:50:54 +02:00
parent 825c4fcb8a
commit 2c9ed99087
3 changed files with 26 additions and 13 deletions

View File

@ -1,7 +1,10 @@
venv: venv-py2:
virtualenv venv.garminexport virtualenv venv.garminexport
venv-py3:
python3 -m venv venv.garminexport
init: init:
pip install -r requirements.txt pip install -r requirements.txt

View File

@ -1,28 +1,30 @@
Garmin Connect activity backup tool Garmin Connect activity backup tool
=================================== ===================================
``garminbackup.py`` is a program that downloads activities for a ``garminbackup.py`` is a program that downloads activities for a
given [Garmin Connect](http://connect.garmin.com/) account and stores given [Garmin Connect](http://connect.garmin.com/) account and stores
them in a backup directory locally on the user's computer. The first time them in a backup directory locally on the user's computer. The first time
the program is run, it will download *all* activities. After that, it will the program is run, it will download *all* activities. After that, it will
do incremental backups of your account. That is, the script will only download do incremental backups of your account. That is, the script will only download
activities that haven't already been downloaded to the backup directory. activities that haven't already been downloaded to the backup directory.
The library contains a simple utility program, ``get_activity.py`` for The library contains a simple utility program, ``get_activity.py`` for
downloading a single Garmin Connect activity. Run ``./get_activity.py --help`` downloading a single Garmin Connect activity. Run ``./get_activity.py --help``
for more details. for more details.
The library also contains a ``garminclient`` module that could be used by third-party The library also contains a ``garminclient`` module that could be used by third-party
projects that need to communicate over the Garmin Connect API. See the projects that need to communicate over the Garmin Connect API. See the
Library Import section below for more details. Library Import section below for more details.
Prerequisites Prerequisites
============= =============
The instructions below for running the program (or importing the module) The instructions below for running the program (or importing the module)
assumes that you have [Python 2.7](https://www.python.org/download/releases/2.7/), assumes that you have Python 2.7 or Python 3+,
[pip](http://pip.readthedocs.org/en/latest/installing.html), and [virtualenv](http://virtualenv.readthedocs.org/en/latest/virtualenv.html#installation) installed. [pip](http://pip.readthedocs.org/en/latest/installing.html), and
[virtualenv](http://virtualenv.readthedocs.org/en/latest/virtualenv.html#installation)
(not required with Python 3) installed.
It also assumes that you have registered an account at It also assumes that you have registered an account at
[Garmin Connect](http://connect.garmin.com/). [Garmin Connect](http://connect.garmin.com/).
@ -31,7 +33,14 @@ Getting started
Create and activate a new virtual environment to create an isolated development Create and activate a new virtual environment to create an isolated development
environment (that contains the required dependencies and nothing else). environment (that contains the required dependencies and nothing else).
# using Python 2
virtualenv venv.garminexport virtualenv venv.garminexport
# using Python 3
python -m venv venv.garminexport
Activate the virtual environment
. venv.garminexport/bin/activate . venv.garminexport/bin/activate
Install the required dependencies in this virtual environment: Install the required dependencies in this virtual environment:
@ -42,14 +51,14 @@ Install the required dependencies in this virtual environment:
Running Running
======= =======
The backup program is run as follows (use the ``--help`` flag for a full list The backup program is run as follows (use the ``--help`` flag for a full list
of available options): of available options):
./garminbackup.py --backup-dir=activities <username or email> ./garminbackup.py --backup-dir=activities <username or email>
Once started, the program will prompt you for your account password and then Once started, the program will prompt you for your account password and then
log in to your Garmin Connect account to download activities to the specified log in to your Garmin Connect account to download activities to the specified
backup directory on your machine. The program will only download activities backup directory on your machine. The program will only download activities
that aren't already in the backup directory. that aren't already in the backup directory.
Activities can be exported in any of the formats outlined below. Note that Activities can be exported in any of the formats outlined below. Note that
@ -59,7 +68,7 @@ by default, the program downloads all formats for every activity. Use the
Supported export formats: Supported export formats:
- ``json_summary``: activity summary file (JSON) - ``json_summary``: activity summary file (JSON)
- ``json_details``: activity details file (JSON) - ``json_details``: activity details file (JSON)
- ``gpx``: activity GPX file (XML) - ``gpx``: activity GPX file (XML)
@ -80,7 +89,7 @@ Each activity file is prefixed by its upload timestamp and its activity id.
Library import Library import
============== ==============
To install the development version of this library in your local Python To install the development version of this library in your local Python
environment, run: environment, run:
`pip install -e git://github.com/petergardfjall/garminexport.git#egg=garminexport` `pip install -e git://github.com/petergardfjall/garminexport.git#egg=garminexport`

View File

@ -22,4 +22,5 @@ setup(name="Garmin Connect activity exporter",
'Natural Language :: English', 'Natural Language :: English',
'License :: OSI Approved :: Apache Software License', 'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5+',
]) ])