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

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,136 @@
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
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ new_version: ${{ steps.release.outputs.new_version }}
20
+ suffix: ${{ steps.release.outputs.suffix }}
21
+ tag_name: ${{ steps.release.outputs.tag_name }}
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Extract tag and Details
26
+ id: release
27
+ run: |
28
+ if [ "${{ github.ref_type }}" = "tag" ]; then
29
+ TAG_NAME=${GITHUB_REF#refs/tags/}
30
+ NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
31
+ SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
32
+ echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
33
+ echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
34
+ echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
35
+ echo "Version is $NEW_VERSION"
36
+ echo "Suffix is $SUFFIX"
37
+ echo "Tag name is $TAG_NAME"
38
+ else
39
+ echo "No tag found"
40
+ exit 1
41
+ fi
42
+
43
+ check_pypi:
44
+ needs: details
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - name: Fetch information from PyPI
48
+ run: |
49
+ response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
50
+ latest_previous_version=$(echo $response | jq --raw-output "select(.releases != null) | .releases | keys_unsorted | last")
51
+ if [ -z "$latest_previous_version" ]; then
52
+ echo "Package not found on PyPI."
53
+ latest_previous_version="0.0.0"
54
+ fi
55
+ echo "Latest version on PyPI: $latest_previous_version"
56
+ echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
57
+
58
+ - name: Compare versions and exit if not newer
59
+ run: |
60
+ NEW_VERSION=${{ needs.details.outputs.new_version }}
61
+ LATEST_VERSION=$latest_previous_version
62
+ if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
63
+ echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
64
+ exit 1
65
+ else
66
+ echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
67
+ fi
68
+
69
+ setup_and_build:
70
+ needs: [details, check_pypi]
71
+ runs-on: ubuntu-latest
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+
75
+ - name: Set up Python
76
+ uses: actions/setup-python@v5
77
+ with:
78
+ python-version: "3.11"
79
+
80
+ - name: Install uv
81
+ uses: astral-sh/setup-uv@v3
82
+ with:
83
+ enable-cache: true
84
+ cache-dependency-glob: uv.lock
85
+
86
+ - name: Build
87
+ run: uv build
88
+
89
+ - name: Upload artifacts
90
+ uses: actions/upload-artifact@v4
91
+ with:
92
+ name: dist
93
+ path: dist/
94
+
95
+ pypi_publish:
96
+ name: Upload release to PyPI
97
+ needs: [setup_and_build, details]
98
+ runs-on: ubuntu-latest
99
+ environment:
100
+ name: release
101
+ permissions:
102
+ id-token: write
103
+ steps:
104
+ - name: Download artifacts
105
+ uses: actions/download-artifact@v4
106
+ with:
107
+ name: dist
108
+ path: dist/
109
+
110
+ - name: Publish distribution to PyPI
111
+ uses: pypa/gh-action-pypi-publish@release/v1
112
+
113
+ github_release:
114
+ name: Create GitHub Release
115
+ needs: [setup_and_build, details]
116
+ runs-on: ubuntu-latest
117
+ permissions:
118
+ contents: write
119
+ steps:
120
+ - name: Checkout Code
121
+ uses: actions/checkout@v4
122
+ with:
123
+ fetch-depth: 0
124
+
125
+ - name: Download artifacts
126
+ uses: actions/download-artifact@v4
127
+ with:
128
+ name: dist
129
+ path: dist/
130
+
131
+ - name: Create GitHub Release
132
+ id: create_release
133
+ env:
134
+ GH_TOKEN: ${{ github.token }}
135
+ run: |
136
+ 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.1
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
@@ -24,44 +24,34 @@ Tool designed to parse and extract data from the travel tracking app [Polarsteps
24
24
  ## Getting started
25
25
 
26
26
  ### Installation
27
- To set up the project, ensure you have Python 3.11+ installed. Follow these steps:
28
-
29
- Clone the repository:
30
-
31
- ```shell
32
- git clone https://github.com/niekvleeuwen/polarsteps-data-parser.git
33
- cd polarsteps-trip-analyzer
34
- ```
35
-
36
- Ensure poetry is available, e.g. on Ubuntu/Debian you can run the following:
27
+ To set up the project, ensure you have Python 3.11+ installed.
37
28
 
29
+ Install from PyPI using pip:
38
30
  ```shell
39
- apt-get install python3 poetry
31
+ pip install polarsteps-data-parser
40
32
  ```
41
33
 
42
- Install dependencies using Poetry:
34
+ ### Usage
35
+ To get the following output, run `polarsteps-data-parser --help`.
43
36
 
44
37
  ```shell
45
- poetry install
46
- ```
47
-
48
- Then enter the created virtual environment:
38
+ Usage: polarsteps-data-parser [OPTIONS] INPUT_FOLDER
49
39
 
50
- ```shell
51
- poetry shell
52
- ```
40
+ Parse the data from a Polarsteps trip export.
53
41
 
54
- ### Usage
55
- To run the project, use the following command:
42
+ INPUT_FOLDER should contain the Polarsteps data export of one (!) trip. Make
43
+ sure the folder contains a `trip.json` and `locations.json`.
56
44
 
57
- ```shell
58
- polarsteps-data-parser [OPTIONS]
45
+ Options:
46
+ --output TEXT Output PDF file name [default: Trip report.pdf]
47
+ --enrich-with-comments Whether to enrich the trip with comments or not.
48
+ --help Show this message and exit.
59
49
  ```
60
50
 
61
51
  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
52
 
63
53
  ```shell
64
- polarsteps-data-parser --input-folder ./data/trip1 --enrich-comments
54
+ polarsteps-data-parser ./data/trip1 --enrich-with-comments
65
55
  ```
66
56
 
67
57
  ## Disclaimer