polarsteps-data-parser 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. polarsteps_data_parser-0.1.2/.github/workflows/release.yaml +139 -0
  2. polarsteps_data_parser-0.1.2/.github/workflows/ruff-lint.yml +12 -0
  3. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/.gitignore +167 -167
  4. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/.pre-commit-config.yaml +14 -14
  5. polarsteps_data_parser-0.1.2/LICENSE +21 -0
  6. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/PKG-INFO +23 -20
  7. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/README.md +55 -52
  8. polarsteps_data_parser-0.1.2/USAGE_GUIDE.md +109 -0
  9. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/polarsteps_data_parser/__main__.py +74 -74
  10. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/polarsteps_data_parser/model.py +147 -147
  11. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/polarsteps_data_parser/pdf_generator.py +153 -155
  12. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/polarsteps_data_parser/retrieve_step_comments.py +135 -135
  13. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/polarsteps_data_parser/utils.py +71 -71
  14. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/pyproject.toml +31 -31
  15. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/ruff.toml +74 -74
  16. polarsteps_data_parser-0.1.2/uv.lock +395 -0
  17. polarsteps_data_parser-0.1.0/LICENSE +0 -674
  18. polarsteps_data_parser-0.1.0/uv.lock +0 -344
  19. {polarsteps_data_parser-0.1.0 → polarsteps_data_parser-0.1.2}/.env.dist +0 -0
@@ -0,0 +1,139 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
+ - "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
8
+ - "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
9
+ - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10
+
11
+ env:
12
+ PACKAGE_NAME: "polarsteps-data-parser"
13
+ OWNER: "niekvleeuwen"
14
+
15
+ jobs:
16
+ details:
17
+ name: Extract details
18
+ runs-on: ubuntu-latest
19
+ outputs:
20
+ new_version: ${{ steps.release.outputs.new_version }}
21
+ suffix: ${{ steps.release.outputs.suffix }}
22
+ tag_name: ${{ steps.release.outputs.tag_name }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - name: Extract tag and Details
27
+ id: release
28
+ run: |
29
+ if [ "${{ github.ref_type }}" = "tag" ]; then
30
+ TAG_NAME=${GITHUB_REF#refs/tags/}
31
+ NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
32
+ SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
33
+ echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
34
+ echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
35
+ echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
36
+ echo "Version is $NEW_VERSION"
37
+ echo "Suffix is $SUFFIX"
38
+ echo "Tag name is $TAG_NAME"
39
+ else
40
+ echo "No tag found"
41
+ exit 1
42
+ fi
43
+
44
+ check_pypi:
45
+ name: Verify new version against latest PyPI release
46
+ needs: details
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - name: Fetch information from PyPI
50
+ run: |
51
+ response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
52
+ latest_previous_version=$(echo $response | jq --raw-output "select(.releases != null) | .releases | keys_unsorted | last")
53
+ if [ -z "$latest_previous_version" ]; then
54
+ echo "Package not found on PyPI."
55
+ latest_previous_version="0.0.0"
56
+ fi
57
+ echo "Latest version on PyPI: $latest_previous_version"
58
+ echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
59
+
60
+ - name: Compare versions and exit if not newer
61
+ run: |
62
+ NEW_VERSION=${{ needs.details.outputs.new_version }}
63
+ LATEST_VERSION=$latest_previous_version
64
+ if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
65
+ echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
66
+ exit 1
67
+ else
68
+ echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
69
+ fi
70
+
71
+ setup_and_build:
72
+ name: Build package
73
+ needs: [details, check_pypi]
74
+ runs-on: ubuntu-latest
75
+ steps:
76
+ - uses: actions/checkout@v4
77
+
78
+ - name: Set up Python
79
+ uses: actions/setup-python@v5
80
+ with:
81
+ python-version: "3.11"
82
+
83
+ - name: Install uv
84
+ uses: astral-sh/setup-uv@v3
85
+ with:
86
+ enable-cache: true
87
+ cache-dependency-glob: uv.lock
88
+
89
+ - name: Build
90
+ run: uv build
91
+
92
+ - name: Upload artifacts
93
+ uses: actions/upload-artifact@v4
94
+ with:
95
+ name: dist
96
+ path: dist/
97
+
98
+ pypi_publish:
99
+ name: Upload release to PyPI
100
+ needs: [setup_and_build, details]
101
+ runs-on: ubuntu-latest
102
+ environment:
103
+ name: release
104
+ permissions:
105
+ id-token: write
106
+ steps:
107
+ - name: Download artifacts
108
+ uses: actions/download-artifact@v4
109
+ with:
110
+ name: dist
111
+ path: dist/
112
+
113
+ - name: Publish distribution to PyPI
114
+ uses: pypa/gh-action-pypi-publish@release/v1
115
+
116
+ github_release:
117
+ name: Create GitHub Release
118
+ needs: [setup_and_build, details]
119
+ runs-on: ubuntu-latest
120
+ permissions:
121
+ contents: write
122
+ steps:
123
+ - name: Checkout Code
124
+ uses: actions/checkout@v4
125
+ with:
126
+ fetch-depth: 0
127
+
128
+ - name: Download artifacts
129
+ uses: actions/download-artifact@v4
130
+ with:
131
+ name: dist
132
+ path: dist/
133
+
134
+ - name: Create GitHub Release
135
+ id: create_release
136
+ env:
137
+ GH_TOKEN: ${{ github.token }}
138
+ run: |
139
+ gh release create ${{ needs.details.outputs.tag_name }} dist/* --title ${{ needs.details.outputs.tag_name }} --generate-notes
@@ -0,0 +1,12 @@
1
+ name: Ruff
2
+ on: [ push, pull_request ]
3
+ jobs:
4
+ ruff:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v4
8
+ - uses: astral-sh/ruff-action@v3
9
+ with:
10
+ version: "0.9.7"
11
+ - run: ruff check
12
+ - run: ruff format
@@ -1,168 +1,168 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- *.py,cover
50
- .hypothesis/
51
- .pytest_cache/
52
- cover/
53
-
54
- # Translations
55
- *.mo
56
- *.pot
57
-
58
- # Django stuff:
59
- *.log
60
- local_settings.py
61
- db.sqlite3
62
- db.sqlite3-journal
63
-
64
- # Flask stuff:
65
- instance/
66
- .webassets-cache
67
-
68
- # Scrapy stuff:
69
- .scrapy
70
-
71
- # Sphinx documentation
72
- docs/_build/
73
-
74
- # PyBuilder
75
- .pybuilder/
76
- target/
77
-
78
- # Jupyter Notebook
79
- .ipynb_checkpoints
80
-
81
- # IPython
82
- profile_default/
83
- ipython_config.py
84
-
85
- # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
-
90
- # pipenv
91
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
- # install all needed dependencies.
95
- #Pipfile.lock
96
-
97
- # poetry
98
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
- #poetry.lock
103
-
104
- # pdm
105
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
- #pdm.lock
107
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
- # in version control.
109
- # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
- .pdm.toml
111
- .pdm-python
112
- .pdm-build/
113
-
114
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
- __pypackages__/
116
-
117
- # Celery stuff
118
- celerybeat-schedule
119
- celerybeat.pid
120
-
121
- # SageMath parsed files
122
- *.sage.py
123
-
124
- # Environments
125
- .env
126
- .venv
127
- env/
128
- venv/
129
- ENV/
130
- env.bak/
131
- venv.bak/
132
-
133
- # Spyder project settings
134
- .spyderproject
135
- .spyproject
136
-
137
- # Rope project settings
138
- .ropeproject
139
-
140
- # mkdocs documentation
141
- /site
142
-
143
- # mypy
144
- .mypy_cache/
145
- .dmypy.json
146
- dmypy.json
147
-
148
- # Pyre type checker
149
- .pyre/
150
-
151
- # pytype static type analyzer
152
- .pytype/
153
-
154
- # Cython debug symbols
155
- cython_debug/
156
-
157
- # PyCharm
158
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
- # and can be added to the global gitignore or merged into this file. For a more nuclear
161
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
- .idea/
163
-
164
- # Ignore folder containing Polarsteps export data
165
- data/
166
-
167
- # Ignore exported PDF files
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ .idea/
163
+
164
+ # Ignore folder containing Polarsteps export data
165
+ data/
166
+
167
+ # Ignore exported PDF files
168
168
  *.pdf
@@ -1,15 +1,15 @@
1
- repos:
2
- - repo: https://github.com/astral-sh/ruff-pre-commit
3
- # Ruff version.
4
- rev: v0.4.6
5
- hooks:
6
- # Run the linter.
7
- - id: ruff
8
- args: [ --fix ]
9
- # Run the formatter.
10
- - id: ruff-format
11
- - repo: https://github.com/astral-sh/uv-pre-commit
12
- # uv version.
13
- rev: 0.6.2
14
- hooks:
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.4.6
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ args: [ --fix ]
9
+ # Run the formatter.
10
+ - id: ruff-format
11
+ - repo: https://github.com/astral-sh/uv-pre-commit
12
+ # uv version.
13
+ rev: 0.6.2
14
+ hooks:
15
15
  - id: uv-lock
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Niek van Leeuwen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polarsteps-data-parser
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Parse and extract data from the data export of travel tracking app Polarsteps.
5
5
  Author-email: Niek van Leeuwen <ik@niekvanleeuwen.nl>
6
6
  License-Expression: MIT
@@ -21,47 +21,50 @@ Tool designed to parse and extract data from the travel tracking app [Polarsteps
21
21
  1. **Data backup**: The data export does not support viewing your data in any useful way. To preserve the data (who knows if Polarsteps still exists in 20 years), the tool combines the data and generates a PDF document.
22
22
  2. **Data analysis & visualization**: The parsed data can also be leveraged for in-depth analysis, enabling users to gain insights into their travel patterns, destinations visited, duration of stays, distances traveled, and more. This opens up possibilities for statistical analysis, trend identification, and visualization of the trip data.
23
23
 
24
+ ## Detailed Usage Guide
25
+
26
+ If you’re new to Python or command-line tools, I’ve created a step-by-step usage guide to help you install and run polarsteps-data-parser (no programming experience required).
27
+
28
+ 👉 Read the guide here: [Usage guide](https://github.com/niekvleeuwen/polarsteps-data-parser/blob/main/USAGE_GUIDE.md)
29
+
24
30
  ## Getting started
25
31
 
26
- ### Installation
27
- To set up the project, ensure you have Python 3.11+ installed. Follow these steps:
28
32
 
29
- Clone the repository:
33
+ 1. Clone the repository and navigate to the project root:
30
34
 
31
35
  ```shell
32
36
  git clone https://github.com/niekvleeuwen/polarsteps-data-parser.git
33
- cd polarsteps-trip-analyzer
37
+ cd polarsteps-data-parser
34
38
  ```
35
39
 
36
- Ensure poetry is available, e.g. on Ubuntu/Debian you can run the following:
40
+ 2. Install dependencies using [uv](https://docs.astral.sh/uv/).
41
+ Make sure `uv` is installed on your system before proceeding.
37
42
 
38
43
  ```shell
39
- apt-get install python3 poetry
44
+ uv sync
40
45
  ```
41
46
 
42
- Install dependencies using Poetry:
47
+ ### Usage
48
+ To get the following output, run `uv run polarsteps-data-parser --help`.
43
49
 
44
50
  ```shell
45
- poetry install
46
- ```
51
+ Usage: polarsteps-data-parser [OPTIONS] INPUT_FOLDER
47
52
 
48
- Then enter the created virtual environment:
53
+ Parse the data from a Polarsteps trip export.
49
54
 
50
- ```shell
51
- poetry shell
52
- ```
55
+ INPUT_FOLDER should contain the Polarsteps data export of one (!) trip. Make
56
+ sure the folder contains a `trip.json` and `locations.json`.
53
57
 
54
- ### Usage
55
- To run the project, use the following command:
56
-
57
- ```shell
58
- polarsteps-data-parser [OPTIONS]
58
+ Options:
59
+ --output TEXT Output PDF file name [default: Trip report.pdf]
60
+ --enrich-with-comments Whether to enrich the trip with comments or not.
61
+ --help Show this message and exit.
59
62
  ```
60
63
 
61
64
  For example, to load and analyse a trip with the data located in the `./data/trip1` folder and enrich the trip with comments, use the following command:
62
65
 
63
66
  ```shell
64
- polarsteps-data-parser --input-folder ./data/trip1 --enrich-comments
67
+ uv run polarsteps-data-parser ./data/trip1 --enrich-with-comments
65
68
  ```
66
69
 
67
70
  ## Disclaimer