fastgpx 0.1.0__tar.gz → 0.2.0__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.
- {fastgpx-0.1.0 → fastgpx-0.2.0}/.clang-format +36 -36
- {fastgpx-0.1.0 → fastgpx-0.2.0}/.gitignore +24 -24
- {fastgpx-0.1.0 → fastgpx-0.2.0}/.python-version +1 -1
- {fastgpx-0.1.0 → fastgpx-0.2.0}/CMakeLists.txt +17 -17
- {fastgpx-0.1.0 → fastgpx-0.2.0}/CMakeSettings.json +28 -28
- {fastgpx-0.1.0 → fastgpx-0.2.0}/Development.md +152 -152
- {fastgpx-0.1.0 → fastgpx-0.2.0}/GPX.md +50 -50
- {fastgpx-0.1.0 → fastgpx-0.2.0}/LICENSE.md +22 -22
- {fastgpx-0.1.0 → fastgpx-0.2.0}/PKG-INFO +2 -1
- {fastgpx-0.1.0 → fastgpx-0.2.0}/README.md +132 -132
- {fastgpx-0.1.0 → fastgpx-0.2.0}/benchmarks/benchmark_gpx.py +199 -199
- {fastgpx-0.1.0 → fastgpx-0.2.0}/benchmarks/benchmark_polyline.py +66 -66
- {fastgpx-0.1.0 → fastgpx-0.2.0}/benchmarks/gpx_parse.md +114 -114
- {fastgpx-0.1.0 → fastgpx-0.2.0}/catch2.py +87 -87
- {fastgpx-0.1.0 → fastgpx-0.2.0}/coverage.bat +8 -8
- {fastgpx-0.1.0 → fastgpx-0.2.0}/datetime.md +118 -118
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/Makefile +20 -20
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/make.bat +35 -35
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/source/api.rst +6 -6
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/source/conf.py +51 -51
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/source/index.rst +14 -14
- {fastgpx-0.1.0 → fastgpx-0.2.0}/docs/source/overview.rst +30 -30
- {fastgpx-0.1.0 → fastgpx-0.2.0}/profiling/profile_polyline.py +72 -72
- {fastgpx-0.1.0 → fastgpx-0.2.0}/pyproject.toml +65 -65
- {fastgpx-0.1.0 → fastgpx-0.2.0}/pytest.ini +7 -7
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/CMakeLists.txt +152 -139
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/app.cpp +31 -31
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/expected_gpx_data.json +4194 -4194
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/datetime.cpp +1060 -1041
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/datetime.hpp +111 -111
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/datetime_test.cpp +668 -668
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/errors.cpp +23 -23
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/errors.hpp +22 -22
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/errors_test.cpp +22 -22
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/fastgpx.cpp +443 -443
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/fastgpx.hpp +140 -140
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/fastgpx_test.cpp +283 -283
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/filesystem.cpp +70 -70
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/filesystem.hpp +26 -26
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/filesystem_test.cpp +61 -61
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/geom.cpp +148 -148
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/geom.hpp +86 -86
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/geom_test.cpp +152 -152
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/polyline.cpp +87 -84
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/polyline.hpp +25 -25
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/test_data.cpp +69 -69
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/test_data.hpp +37 -37
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/test_data.json +39 -39
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/fastgpx/test_data_test.cpp +35 -35
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/python_fastgpx.cpp +258 -258
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/cpp/python_utc_chrono.hpp +270 -270
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/__init__.py +5 -5
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/__init__.pyi +12 -12
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/fastgpx/__init__.pyi +128 -128
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/fastgpx/geo.pyi +9 -9
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/fastgpx/polyline.pyi +54 -54
- {fastgpx-0.1.0 → fastgpx-0.2.0}/tests/test_bounds.py +57 -57
- {fastgpx-0.1.0 → fastgpx-0.2.0}/tests/test_fastgpx.py +92 -92
- {fastgpx-0.1.0 → fastgpx-0.2.0}/tests/test_polyline.py +141 -141
- {fastgpx-0.1.0 → fastgpx-0.2.0}/uv.lock +546 -546
- {fastgpx-0.1.0 → fastgpx-0.2.0}/src/fastgpx/py.typed +0 -0
@@ -1,36 +1,36 @@
|
|
1
|
-
---
|
2
|
-
AccessModifierOffset: -2
|
3
|
-
# AlignConsecutiveAssignments: Consecutive
|
4
|
-
AllowShortBlocksOnASingleLine: false
|
5
|
-
# AllowShortCaseLabelsOnASingleLine: false
|
6
|
-
AllowShortEnumsOnASingleLine: false
|
7
|
-
AllowShortFunctionsOnASingleLine: Inline # InlineOnly # Empty
|
8
|
-
AllowShortIfStatementsOnASingleLine: Never
|
9
|
-
AllowShortLambdasOnASingleLine: All # Inline
|
10
|
-
BasedOnStyle: Google
|
11
|
-
BreakBeforeBraces: Custom
|
12
|
-
BraceWrapping:
|
13
|
-
AfterCaseLabel: true
|
14
|
-
AfterClass: true
|
15
|
-
AfterControlStatement: Always
|
16
|
-
AfterEnum: true
|
17
|
-
AfterExternBlock: true
|
18
|
-
AfterFunction: true
|
19
|
-
AfterNamespace: false
|
20
|
-
AfterStruct: true
|
21
|
-
AfterUnion: true
|
22
|
-
BeforeCatch: true
|
23
|
-
BeforeElse: true
|
24
|
-
BeforeLambdaBody: false
|
25
|
-
BeforeWhile: true
|
26
|
-
SplitEmptyFunction: false
|
27
|
-
ColumnLimit: 100
|
28
|
-
DerivePointerAlignment: false
|
29
|
-
IncludeBlocks: Preserve
|
30
|
-
IndentCaseLabels: false
|
31
|
-
IndentExternBlock: NoIndent
|
32
|
-
IndentPPDirectives: BeforeHash
|
33
|
-
PointerAlignment: Left
|
34
|
-
ReferenceAlignment: Left
|
35
|
-
SpaceAfterTemplateKeyword: false
|
36
|
-
SpacesBeforeTrailingComments: 1
|
1
|
+
---
|
2
|
+
AccessModifierOffset: -2
|
3
|
+
# AlignConsecutiveAssignments: Consecutive
|
4
|
+
AllowShortBlocksOnASingleLine: false
|
5
|
+
# AllowShortCaseLabelsOnASingleLine: false
|
6
|
+
AllowShortEnumsOnASingleLine: false
|
7
|
+
AllowShortFunctionsOnASingleLine: Inline # InlineOnly # Empty
|
8
|
+
AllowShortIfStatementsOnASingleLine: Never
|
9
|
+
AllowShortLambdasOnASingleLine: All # Inline
|
10
|
+
BasedOnStyle: Google
|
11
|
+
BreakBeforeBraces: Custom
|
12
|
+
BraceWrapping:
|
13
|
+
AfterCaseLabel: true
|
14
|
+
AfterClass: true
|
15
|
+
AfterControlStatement: Always
|
16
|
+
AfterEnum: true
|
17
|
+
AfterExternBlock: true
|
18
|
+
AfterFunction: true
|
19
|
+
AfterNamespace: false
|
20
|
+
AfterStruct: true
|
21
|
+
AfterUnion: true
|
22
|
+
BeforeCatch: true
|
23
|
+
BeforeElse: true
|
24
|
+
BeforeLambdaBody: false
|
25
|
+
BeforeWhile: true
|
26
|
+
SplitEmptyFunction: false
|
27
|
+
ColumnLimit: 100
|
28
|
+
DerivePointerAlignment: false
|
29
|
+
IncludeBlocks: Preserve
|
30
|
+
IndentCaseLabels: false
|
31
|
+
IndentExternBlock: NoIndent
|
32
|
+
IndentPPDirectives: BeforeHash
|
33
|
+
PointerAlignment: Left
|
34
|
+
ReferenceAlignment: Left
|
35
|
+
SpaceAfterTemplateKeyword: false
|
36
|
+
SpacesBeforeTrailingComments: 1
|
@@ -1,24 +1,24 @@
|
|
1
|
-
__pycache__
|
2
|
-
.venv
|
3
|
-
.env
|
4
|
-
env39/
|
5
|
-
|
6
|
-
/dist/
|
7
|
-
|
8
|
-
/build/
|
9
|
-
/output/
|
10
|
-
|
11
|
-
/.vs/
|
12
|
-
/out/
|
13
|
-
|
14
|
-
.mypy_cache/
|
15
|
-
.pytest_cache/
|
16
|
-
|
17
|
-
/*.png
|
18
|
-
|
19
|
-
/profiling/*.prof
|
20
|
-
|
21
|
-
/coverage/
|
22
|
-
LastCoverageResults.log
|
23
|
-
|
24
|
-
/docs/build/
|
1
|
+
__pycache__
|
2
|
+
.venv
|
3
|
+
.env
|
4
|
+
env39/
|
5
|
+
|
6
|
+
/dist/
|
7
|
+
|
8
|
+
/build/
|
9
|
+
/output/
|
10
|
+
|
11
|
+
/.vs/
|
12
|
+
/out/
|
13
|
+
|
14
|
+
.mypy_cache/
|
15
|
+
.pytest_cache/
|
16
|
+
|
17
|
+
/*.png
|
18
|
+
|
19
|
+
/profiling/*.prof
|
20
|
+
|
21
|
+
/coverage/
|
22
|
+
LastCoverageResults.log
|
23
|
+
|
24
|
+
/docs/build/
|
@@ -1 +1 @@
|
|
1
|
-
3.11
|
1
|
+
3.11
|
@@ -1,17 +1,17 @@
|
|
1
|
-
cmake_minimum_required(VERSION 3.30.2)
|
2
|
-
|
3
|
-
project(fastgpx)
|
4
|
-
|
5
|
-
# > The CTest module defines a BUILD_TESTING cache variable which defaults to true.
|
6
|
-
# > It is used to decide whether the module calls enable_testing() or not, so the
|
7
|
-
# > project does not have to make its own explicit call to enable_testing(). The
|
8
|
-
# > project can also use this cache variable to perform certain processing only
|
9
|
-
# > if testing is enabled. If the project has many tests that take a long time
|
10
|
-
# > to build, this can be a useful way to avoid adding them to the build when
|
11
|
-
# > they are not needed.
|
12
|
-
#
|
13
|
-
# The BUILD_TESTING is set to false in pyproject.toml, so the tests will not build
|
14
|
-
# when building the Python package.
|
15
|
-
include(CTest)
|
16
|
-
|
17
|
-
add_subdirectory(src/cpp)
|
1
|
+
cmake_minimum_required(VERSION 3.30.2)
|
2
|
+
|
3
|
+
project(fastgpx)
|
4
|
+
|
5
|
+
# > The CTest module defines a BUILD_TESTING cache variable which defaults to true.
|
6
|
+
# > It is used to decide whether the module calls enable_testing() or not, so the
|
7
|
+
# > project does not have to make its own explicit call to enable_testing(). The
|
8
|
+
# > project can also use this cache variable to perform certain processing only
|
9
|
+
# > if testing is enabled. If the project has many tests that take a long time
|
10
|
+
# > to build, this can be a useful way to avoid adding them to the build when
|
11
|
+
# > they are not needed.
|
12
|
+
#
|
13
|
+
# The BUILD_TESTING is set to false in pyproject.toml, so the tests will not build
|
14
|
+
# when building the Python package.
|
15
|
+
include(CTest)
|
16
|
+
|
17
|
+
add_subdirectory(src/cpp)
|
@@ -1,29 +1,29 @@
|
|
1
|
-
{
|
2
|
-
"configurations": [
|
3
|
-
{
|
4
|
-
"name": "x64-Debug",
|
5
|
-
"generator": "Ninja",
|
6
|
-
"configurationType": "Debug",
|
7
|
-
"inheritEnvironments": [ "msvc_x64_x64" ],
|
8
|
-
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
9
|
-
"installRoot": "${projectDir}\\out\\install\\${name}",
|
10
|
-
"cmakeCommandArgs": "-DPYTHON_EXECUTABLE=.venv/Scripts/python.exe -DCMAKE_PREFIX_PATH=${projectDir}/.venv/Lib/site-packages/pybind11/share/cmake/pybind11",
|
11
|
-
"buildCommandArgs": "",
|
12
|
-
"ctestCommandArgs": "",
|
13
|
-
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe"
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"name": "x64-Release",
|
17
|
-
"generator": "Ninja",
|
18
|
-
"configurationType": "RelWithDebInfo",
|
19
|
-
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
20
|
-
"installRoot": "${projectDir}\\out\\install\\${name}",
|
21
|
-
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe",
|
22
|
-
"cmakeCommandArgs": "-DPYTHON_EXECUTABLE=.venv/Scripts/python.exe -DCMAKE_PREFIX_PATH=${projectDir}/.venv/Lib/site-packages/pybind11/share/cmake/pybind11",
|
23
|
-
"buildCommandArgs": "",
|
24
|
-
"ctestCommandArgs": "",
|
25
|
-
"inheritEnvironments": [ "msvc_x64_x64" ],
|
26
|
-
"variables": []
|
27
|
-
}
|
28
|
-
]
|
1
|
+
{
|
2
|
+
"configurations": [
|
3
|
+
{
|
4
|
+
"name": "x64-Debug",
|
5
|
+
"generator": "Ninja",
|
6
|
+
"configurationType": "Debug",
|
7
|
+
"inheritEnvironments": [ "msvc_x64_x64" ],
|
8
|
+
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
9
|
+
"installRoot": "${projectDir}\\out\\install\\${name}",
|
10
|
+
"cmakeCommandArgs": "-DPYTHON_EXECUTABLE=.venv/Scripts/python.exe -DCMAKE_PREFIX_PATH=${projectDir}/.venv/Lib/site-packages/pybind11/share/cmake/pybind11",
|
11
|
+
"buildCommandArgs": "",
|
12
|
+
"ctestCommandArgs": "",
|
13
|
+
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"name": "x64-Release",
|
17
|
+
"generator": "Ninja",
|
18
|
+
"configurationType": "RelWithDebInfo",
|
19
|
+
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
20
|
+
"installRoot": "${projectDir}\\out\\install\\${name}",
|
21
|
+
"cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe",
|
22
|
+
"cmakeCommandArgs": "-DPYTHON_EXECUTABLE=.venv/Scripts/python.exe -DCMAKE_PREFIX_PATH=${projectDir}/.venv/Lib/site-packages/pybind11/share/cmake/pybind11",
|
23
|
+
"buildCommandArgs": "",
|
24
|
+
"ctestCommandArgs": "",
|
25
|
+
"inheritEnvironments": [ "msvc_x64_x64" ],
|
26
|
+
"variables": []
|
27
|
+
}
|
28
|
+
]
|
29
29
|
}
|
@@ -1,152 +1,152 @@
|
|
1
|
-
# Development
|
2
|
-
|
3
|
-
## Python
|
4
|
-
|
5
|
-
### Import Order
|
6
|
-
|
7
|
-
The typical organization of Python imports follows a structured convention to improve readability and maintainability of the code. This organization often adheres to the PEP 8 style guide, which is widely adopted in the Python community. Here is the recommended order and format:
|
8
|
-
|
9
|
-
Python imports are generally organized into three main sections, each separated by a blank line:
|
10
|
-
|
11
|
-
1. Standard Library Imports: These are modules that are part of Python's standard library, such as `os`, `sys`, `datetime`, etc.
|
12
|
-
|
13
|
-
2. Third-Party Imports: These are external libraries that are not part of the standard library, such as `numpy`, `requests`, etc.
|
14
|
-
|
15
|
-
3. Local Application or Project-Specific Imports: These are your own modules that are part of the project.
|
16
|
-
|
17
|
-
```py
|
18
|
-
# Standard library imports
|
19
|
-
import os
|
20
|
-
import sys
|
21
|
-
from datetime import datetime
|
22
|
-
|
23
|
-
# Third-party imports
|
24
|
-
import requests
|
25
|
-
import numpy as np
|
26
|
-
|
27
|
-
# Local application imports
|
28
|
-
from my_project.module import my_function
|
29
|
-
from . import another_module
|
30
|
-
```
|
31
|
-
|
32
|
-
|
33
|
-
### Python C Extension
|
34
|
-
|
35
|
-
Once set up, you can build the C++ extension with a simple `pip install .` or `pip install --editable .` for development builds.
|
36
|
-
|
37
|
-
```sh
|
38
|
-
pip install --editable .
|
39
|
-
```
|
40
|
-
|
41
|
-
```sh
|
42
|
-
pybind11-stubgen fastgpx -o src
|
43
|
-
|
44
|
-
pybind11-stubgen fastgpx --enum-class-locations "Precision:fastgpx.polyline" -o src
|
45
|
-
```
|
46
|
-
|
47
|
-
### Python Profiling
|
48
|
-
|
49
|
-
https://learn.microsoft.com/en-us/visualstudio/python/profiling-python-code-in-visual-studio?view=vs-2022
|
50
|
-
|
51
|
-
```sh
|
52
|
-
snakeviz profiling/fastgpx_polyline_encode.prof
|
53
|
-
```
|
54
|
-
|
55
|
-
```sh
|
56
|
-
snakeviz profiling/polyline_encode.prof
|
57
|
-
```
|
58
|
-
|
59
|
-
### pyproject.toml
|
60
|
-
|
61
|
-
> Installing Dependencies with pyproject.toml
|
62
|
-
>
|
63
|
-
> You no longer need to use `pip install -r requirements.txt`. Instead, you can simply install dependencies directly using:
|
64
|
-
>
|
65
|
-
> ```sh
|
66
|
-
> pip install .
|
67
|
-
> ```
|
68
|
-
|
69
|
-
> For Development Dependencies:
|
70
|
-
>
|
71
|
-
> To install development dependencies (like `pytest` and `pybind11-stubgen`), you can use the `--extra` option (assuming you defined them under dev):
|
72
|
-
>
|
73
|
-
> ```sh
|
74
|
-
> pip install .[dev]
|
75
|
-
> ```
|
76
|
-
>
|
77
|
-
> This will install both the main dependencies and the development dependencies defined in the dev section of `pyproject.toml`.
|
78
|
-
|
79
|
-
### Locally test build wheel
|
80
|
-
|
81
|
-
```sh
|
82
|
-
pip install --upgrade build twine wheel
|
83
|
-
```
|
84
|
-
|
85
|
-
```sh
|
86
|
-
python -m build
|
87
|
-
twine check dist/*
|
88
|
-
```
|
89
|
-
|
90
|
-
## C++
|
91
|
-
|
92
|
-
### Include order
|
93
|
-
|
94
|
-
The organization of C++ includes follows certain conventions that are similar in spirit to Python import conventions. Well-structured includes can improve readability, reduce compile times, and minimize dependencies. Here are the typical guidelines and best practices for organizing C++ includes:
|
95
|
-
|
96
|
-
C++ includes are generally organized in a specific order, often grouped and separated by blank lines. The typical order is as follows:
|
97
|
-
|
98
|
-
1. Header File for the Current Implementation File (if applicable)
|
99
|
-
2. Standard Library Headers (e.g., `<iostream>`, `<vector>`)
|
100
|
-
3. Third-Party Library Headers (e.g., `boost`, or other external dependencies)
|
101
|
-
4. Project-Specific Headers (e.g., your own modules or classes)
|
102
|
-
|
103
|
-
This organization helps to ensure that your file includes what it needs directly, and minimizes the chance of accidentally relying on transitive includes from other files.
|
104
|
-
|
105
|
-
```cpp
|
106
|
-
// Current implementation file's corresponding header
|
107
|
-
#include "my_class.h"
|
108
|
-
|
109
|
-
// Standard library headers
|
110
|
-
#include <iostream>
|
111
|
-
#include <vector>
|
112
|
-
#include <string>
|
113
|
-
|
114
|
-
// Third-party library headers
|
115
|
-
#include <boost/algorithm/string.hpp>
|
116
|
-
|
117
|
-
// Project-specific headers
|
118
|
-
#include "utils.h"
|
119
|
-
#include "data_processing.h"
|
120
|
-
```
|
121
|
-
|
122
|
-
### Reformat all C++ sources
|
123
|
-
|
124
|
-
```sh
|
125
|
-
cd src\cpp
|
126
|
-
for /R %f in (*.cpp *.hpp) do "C:\Program Files\LLVM\bin\clang-format.exe" -i "%f"
|
127
|
-
```
|
128
|
-
|
129
|
-
### Coverage (C++ OpenCppCoverage)
|
130
|
-
|
131
|
-
```sh
|
132
|
-
coverage.bat ~[real_world]
|
133
|
-
```
|
134
|
-
|
135
|
-
### Catch2 Tests
|
136
|
-
|
137
|
-
If the output prints UTF-8 characters the terminal needs to be set to UTF-8 mode on Windows:
|
138
|
-
|
139
|
-
```sh
|
140
|
-
chcp 65001
|
141
|
-
```
|
142
|
-
#### Running Tests
|
143
|
-
|
144
|
-
```sh
|
145
|
-
build\src\cpp\RelWithDebInfo\fastgpx_test.exe
|
146
|
-
```
|
147
|
-
|
148
|
-
#### Running Benchmarks
|
149
|
-
|
150
|
-
```sh
|
151
|
-
build\src\cpp\RelWithDebInfo\fastgpx_test.exe [!benchmark]
|
152
|
-
```
|
1
|
+
# Development
|
2
|
+
|
3
|
+
## Python
|
4
|
+
|
5
|
+
### Import Order
|
6
|
+
|
7
|
+
The typical organization of Python imports follows a structured convention to improve readability and maintainability of the code. This organization often adheres to the PEP 8 style guide, which is widely adopted in the Python community. Here is the recommended order and format:
|
8
|
+
|
9
|
+
Python imports are generally organized into three main sections, each separated by a blank line:
|
10
|
+
|
11
|
+
1. Standard Library Imports: These are modules that are part of Python's standard library, such as `os`, `sys`, `datetime`, etc.
|
12
|
+
|
13
|
+
2. Third-Party Imports: These are external libraries that are not part of the standard library, such as `numpy`, `requests`, etc.
|
14
|
+
|
15
|
+
3. Local Application or Project-Specific Imports: These are your own modules that are part of the project.
|
16
|
+
|
17
|
+
```py
|
18
|
+
# Standard library imports
|
19
|
+
import os
|
20
|
+
import sys
|
21
|
+
from datetime import datetime
|
22
|
+
|
23
|
+
# Third-party imports
|
24
|
+
import requests
|
25
|
+
import numpy as np
|
26
|
+
|
27
|
+
# Local application imports
|
28
|
+
from my_project.module import my_function
|
29
|
+
from . import another_module
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
### Python C Extension
|
34
|
+
|
35
|
+
Once set up, you can build the C++ extension with a simple `pip install .` or `pip install --editable .` for development builds.
|
36
|
+
|
37
|
+
```sh
|
38
|
+
pip install --editable .
|
39
|
+
```
|
40
|
+
|
41
|
+
```sh
|
42
|
+
pybind11-stubgen fastgpx -o src
|
43
|
+
|
44
|
+
pybind11-stubgen fastgpx --enum-class-locations "Precision:fastgpx.polyline" -o src
|
45
|
+
```
|
46
|
+
|
47
|
+
### Python Profiling
|
48
|
+
|
49
|
+
https://learn.microsoft.com/en-us/visualstudio/python/profiling-python-code-in-visual-studio?view=vs-2022
|
50
|
+
|
51
|
+
```sh
|
52
|
+
snakeviz profiling/fastgpx_polyline_encode.prof
|
53
|
+
```
|
54
|
+
|
55
|
+
```sh
|
56
|
+
snakeviz profiling/polyline_encode.prof
|
57
|
+
```
|
58
|
+
|
59
|
+
### pyproject.toml
|
60
|
+
|
61
|
+
> Installing Dependencies with pyproject.toml
|
62
|
+
>
|
63
|
+
> You no longer need to use `pip install -r requirements.txt`. Instead, you can simply install dependencies directly using:
|
64
|
+
>
|
65
|
+
> ```sh
|
66
|
+
> pip install .
|
67
|
+
> ```
|
68
|
+
|
69
|
+
> For Development Dependencies:
|
70
|
+
>
|
71
|
+
> To install development dependencies (like `pytest` and `pybind11-stubgen`), you can use the `--extra` option (assuming you defined them under dev):
|
72
|
+
>
|
73
|
+
> ```sh
|
74
|
+
> pip install .[dev]
|
75
|
+
> ```
|
76
|
+
>
|
77
|
+
> This will install both the main dependencies and the development dependencies defined in the dev section of `pyproject.toml`.
|
78
|
+
|
79
|
+
### Locally test build wheel
|
80
|
+
|
81
|
+
```sh
|
82
|
+
pip install --upgrade build twine wheel
|
83
|
+
```
|
84
|
+
|
85
|
+
```sh
|
86
|
+
python -m build
|
87
|
+
twine check dist/*
|
88
|
+
```
|
89
|
+
|
90
|
+
## C++
|
91
|
+
|
92
|
+
### Include order
|
93
|
+
|
94
|
+
The organization of C++ includes follows certain conventions that are similar in spirit to Python import conventions. Well-structured includes can improve readability, reduce compile times, and minimize dependencies. Here are the typical guidelines and best practices for organizing C++ includes:
|
95
|
+
|
96
|
+
C++ includes are generally organized in a specific order, often grouped and separated by blank lines. The typical order is as follows:
|
97
|
+
|
98
|
+
1. Header File for the Current Implementation File (if applicable)
|
99
|
+
2. Standard Library Headers (e.g., `<iostream>`, `<vector>`)
|
100
|
+
3. Third-Party Library Headers (e.g., `boost`, or other external dependencies)
|
101
|
+
4. Project-Specific Headers (e.g., your own modules or classes)
|
102
|
+
|
103
|
+
This organization helps to ensure that your file includes what it needs directly, and minimizes the chance of accidentally relying on transitive includes from other files.
|
104
|
+
|
105
|
+
```cpp
|
106
|
+
// Current implementation file's corresponding header
|
107
|
+
#include "my_class.h"
|
108
|
+
|
109
|
+
// Standard library headers
|
110
|
+
#include <iostream>
|
111
|
+
#include <vector>
|
112
|
+
#include <string>
|
113
|
+
|
114
|
+
// Third-party library headers
|
115
|
+
#include <boost/algorithm/string.hpp>
|
116
|
+
|
117
|
+
// Project-specific headers
|
118
|
+
#include "utils.h"
|
119
|
+
#include "data_processing.h"
|
120
|
+
```
|
121
|
+
|
122
|
+
### Reformat all C++ sources
|
123
|
+
|
124
|
+
```sh
|
125
|
+
cd src\cpp
|
126
|
+
for /R %f in (*.cpp *.hpp) do "C:\Program Files\LLVM\bin\clang-format.exe" -i "%f"
|
127
|
+
```
|
128
|
+
|
129
|
+
### Coverage (C++ OpenCppCoverage)
|
130
|
+
|
131
|
+
```sh
|
132
|
+
coverage.bat ~[real_world]
|
133
|
+
```
|
134
|
+
|
135
|
+
### Catch2 Tests
|
136
|
+
|
137
|
+
If the output prints UTF-8 characters the terminal needs to be set to UTF-8 mode on Windows:
|
138
|
+
|
139
|
+
```sh
|
140
|
+
chcp 65001
|
141
|
+
```
|
142
|
+
#### Running Tests
|
143
|
+
|
144
|
+
```sh
|
145
|
+
build\src\cpp\RelWithDebInfo\fastgpx_test.exe
|
146
|
+
```
|
147
|
+
|
148
|
+
#### Running Benchmarks
|
149
|
+
|
150
|
+
```sh
|
151
|
+
build\src\cpp\RelWithDebInfo\fastgpx_test.exe [!benchmark]
|
152
|
+
```
|
@@ -1,50 +1,50 @@
|
|
1
|
-
|
2
|
-
# GPX
|
3
|
-
|
4
|
-
## GPX for Developers
|
5
|
-
|
6
|
-
https://www.topografix.com/gpx_for_developers.asp
|
7
|
-
|
8
|
-
> The standard in the gpx files for the time zone format is not completely
|
9
|
-
> clear. For instance some applications generate time formats in the track
|
10
|
-
> points of the form
|
11
|
-
>
|
12
|
-
> <time>2008-07-18T16:07:50.000+02:00</time>
|
13
|
-
>
|
14
|
-
> this is slightly substandard because the standard as described in
|
15
|
-
> http://www.topografix.com/gpx.asp says that
|
16
|
-
>
|
17
|
-
> "Date and time in are in Univeral Coordinated Time (UTC), not local time!
|
18
|
-
> Conforms to ISO 8601 specification for date/time representation."
|
19
|
-
|
20
|
-
https://web.archive.org/web/20130725164436/http://tech.groups.yahoo.com/group/gpsxml/message/1090?l=1
|
21
|
-
|
22
|
-
## GPS Exchange Format (GPX): A Comprehensive Guide
|
23
|
-
|
24
|
-
https://mapscaping.com/gps-exchange-format-gpx/
|
25
|
-
|
26
|
-
## Assumed typical <time> representation in .GPX files
|
27
|
-
|
28
|
-
To simplify logic and maximize performance, maybe one can assume a more narrow
|
29
|
-
scope of ISO 8601.
|
30
|
-
|
31
|
-
By using the length of the string one can make assumption to the variation of
|
32
|
-
the format and directly extract the numeric components of the string. Probably
|
33
|
-
worth validating the separator characters as a minimal validation safety check
|
34
|
-
to eliminate pure junk input.
|
35
|
-
|
36
|
-
Variations observed:
|
37
|
-
* Only Extended Format.
|
38
|
-
* With or without milliseconds. (3 fractional decimals)
|
39
|
-
* Zulu hours are the norm, but timezone offsets might occur.
|
40
|
-
* Some mention of missing timezone notation all together.
|
41
|
-
While ISO 8601 describe this as local time, one can probably assume this is
|
42
|
-
an omission by the author and it really should be Zulu hours.
|
43
|
-
|
44
|
-
| Example | Length | |
|
45
|
-
|-------------------------------|--------|-------------------------------------|
|
46
|
-
| 2008-07-18T16:07:50.000+02:00 | 29 | Not per GPX definition. |
|
47
|
-
| 2008-07-18T16:07:50.000Z | 24 | |
|
48
|
-
| 2008-07-18T16:07:50+02:00 | 25 | Not per GPX definition. |
|
49
|
-
| 2008-07-18T16:07:50Z | 20 | |
|
50
|
-
| 2008-07-18T16:07:50 | 19 | Assume Zulu time? |
|
1
|
+
|
2
|
+
# GPX
|
3
|
+
|
4
|
+
## GPX for Developers
|
5
|
+
|
6
|
+
https://www.topografix.com/gpx_for_developers.asp
|
7
|
+
|
8
|
+
> The standard in the gpx files for the time zone format is not completely
|
9
|
+
> clear. For instance some applications generate time formats in the track
|
10
|
+
> points of the form
|
11
|
+
>
|
12
|
+
> <time>2008-07-18T16:07:50.000+02:00</time>
|
13
|
+
>
|
14
|
+
> this is slightly substandard because the standard as described in
|
15
|
+
> http://www.topografix.com/gpx.asp says that
|
16
|
+
>
|
17
|
+
> "Date and time in are in Univeral Coordinated Time (UTC), not local time!
|
18
|
+
> Conforms to ISO 8601 specification for date/time representation."
|
19
|
+
|
20
|
+
https://web.archive.org/web/20130725164436/http://tech.groups.yahoo.com/group/gpsxml/message/1090?l=1
|
21
|
+
|
22
|
+
## GPS Exchange Format (GPX): A Comprehensive Guide
|
23
|
+
|
24
|
+
https://mapscaping.com/gps-exchange-format-gpx/
|
25
|
+
|
26
|
+
## Assumed typical <time> representation in .GPX files
|
27
|
+
|
28
|
+
To simplify logic and maximize performance, maybe one can assume a more narrow
|
29
|
+
scope of ISO 8601.
|
30
|
+
|
31
|
+
By using the length of the string one can make assumption to the variation of
|
32
|
+
the format and directly extract the numeric components of the string. Probably
|
33
|
+
worth validating the separator characters as a minimal validation safety check
|
34
|
+
to eliminate pure junk input.
|
35
|
+
|
36
|
+
Variations observed:
|
37
|
+
* Only Extended Format.
|
38
|
+
* With or without milliseconds. (3 fractional decimals)
|
39
|
+
* Zulu hours are the norm, but timezone offsets might occur.
|
40
|
+
* Some mention of missing timezone notation all together.
|
41
|
+
While ISO 8601 describe this as local time, one can probably assume this is
|
42
|
+
an omission by the author and it really should be Zulu hours.
|
43
|
+
|
44
|
+
| Example | Length | |
|
45
|
+
|-------------------------------|--------|-------------------------------------|
|
46
|
+
| 2008-07-18T16:07:50.000+02:00 | 29 | Not per GPX definition. |
|
47
|
+
| 2008-07-18T16:07:50.000Z | 24 | |
|
48
|
+
| 2008-07-18T16:07:50+02:00 | 25 | Not per GPX definition. |
|
49
|
+
| 2008-07-18T16:07:50Z | 20 | |
|
50
|
+
| 2008-07-18T16:07:50 | 19 | Assume Zulu time? |
|