-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI as strava_py #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[metadata] | ||
name = strava_py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the name that would be used for PyPI. Currently https://pypi.org/project/strava_py/ is unused (and https://pypi.org/project/strava/ is taken). |
||
version = 0.0.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (It's possible to use things like https://github.com/pypa/setuptools_scm to make it automatically take the version number from Git tags, but let's start off simple.) |
||
description = Create artistic visualisations with your exercise data | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
url = https://github.com/marcusvolz/strava_py | ||
author = Marcus Volz | ||
license = MIT | ||
license_file = LICENSE | ||
classifiers = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can freely choose classifiers from https://pypi.org/classifiers/. These don't have a huge lot of use, but are listed on a package's PyPI page and can be browsed: https://pypi.org/project/Pillow/ |
||
Development Status :: 3 - Alpha | ||
License :: OSI Approved :: MIT License | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3 :: Only | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Topic :: Artistic Software | ||
Topic :: Multimedia :: Graphics | ||
Topic :: Scientific/Engineering :: Visualization | ||
keywords = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also used on PyPI. Like classifiers, can be useful for people using the PyPI API. |
||
strava | ||
artistic visualisations | ||
artistic | ||
visualisation | ||
exercise data | ||
exercise | ||
project_urls = | ||
Source=https://github.com/marcusvolz/strava_py | ||
|
||
[options] | ||
packages = find: | ||
install_requires = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. List the dependent packages here, so they get installed when people install our package. |
||
fit2gpx | ||
gpxpy | ||
matplotlib | ||
pandas | ||
seaborn | ||
python_requires = >=3.7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pick a minimum supported Python version. pip uses this to make sure to install only for the known supported versions. 3.7 is the lowest currently supported: https://endoflife.date/python |
||
package_dir = =src | ||
zip_safe = True | ||
|
||
[options.packages.find] | ||
where = src | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
strava_py = strava_py.cli:main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from setuptools import setup | ||
|
||
setup() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from strava_py import cli | ||
|
||
if __name__ == "__main__": | ||
cli.main() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import argparse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used for parsing (and validating) arguments for us. |
||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter | ||
) | ||
parser.add_argument("path", help="Input path to folder with GPX and / or FIT files") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No dashes here, so |
||
parser.add_argument( | ||
"-o", "--output_file", default="plot.png", help="Output PNG file" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The dashes indicate an optional argument with two forms: short |
||
) | ||
args = parser.parse_args() | ||
|
||
# Normally imports go at the top, but scientific libraries can be slow to import | ||
# so let's validate arguments first | ||
from strava_py.plot_facets import plot_facets | ||
from strava_py.process_data import process_data | ||
|
||
print("Processing data...") | ||
df = process_data(args.path) | ||
|
||
print("Plotting facets...") | ||
plot_facets(df, output_file=args.output_file) | ||
print(f"Saved to {args.output_file}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains the metadata for the package.