Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
tags:
- 'v*'

env:
# Set to 'true' to upload the fusion-engine-client-core Python package to PyPI on a release, in addition to
# fusion-engine-client. CI builds the core package on every push either way.
PUBLISH_CORE_TO_PYPI: 'false'

jobs:
# Check code style.
check_style:
Expand Down Expand Up @@ -457,6 +462,7 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
python/requirements-core.txt
python/requirements.txt
python/requirements-dev.txt

Expand All @@ -474,12 +480,16 @@ jobs:
run: |
python -m pytest

- name: Build A Python Distribution
# Build both the full fusion-engine-client package and the fusion-engine-client-core package from the same
# source, so they have the same version. The core package goes in its own directory, so it is only uploaded to
# PyPI if PUBLISH_CORE_TO_PYPI is enabled.
- name: Build Python Distributions
if: ${{ !env.ACT }}
run: |
pip install build twine
python -m build
twine check dist/*
FUSION_ENGINE_CLIENT_CORE=1 python -m build --outdir dist-core
twine check dist/* dist-core/*

- name: Upload Artifact
if: ${{ !env.ACT && matrix.python-version == '3.13' }}
Expand All @@ -488,6 +498,13 @@ jobs:
name: python_dist
path: python/dist

- name: Upload Core Artifact
if: ${{ !env.ACT && matrix.python-version == '3.13' }}
uses: actions/upload-artifact@v4
with:
name: python_core_dist
path: python/dist-core

# Check autogenerated signal definitions.
test_signal_defs:
name: GNSS Signal Definitions
Expand Down Expand Up @@ -531,6 +548,13 @@ jobs:
name: python_dist
path: python/dist

- name: Get Python Core Distribution Artifact
if: env.PUBLISH_CORE_TO_PYPI == 'true'
uses: actions/download-artifact@v4
with:
name: python_core_dist
path: python/dist-core

- name: Create Release
id: create_release
uses: actions/create-release@latest
Expand Down Expand Up @@ -559,3 +583,11 @@ jobs:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: python/dist/
verbose: true

- name: Upload The Python Core Distribution To PyPI
if: env.PUBLISH_CORE_TO_PYPI == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: python/dist-core/
verbose: true
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,15 @@ See [Point One FusionEngine Python Client](python) for complete details and usag
#### Install From PyPI

1. Install Python 3.8 (or later) and pip.
2. Install the `fusione-engine-client` module, including all analysis and data processing tools:
2. Install the `fusion-engine-client` module, including all analysis and data processing tools:
```bash
python3 -m pip install fusion-engine-client[all]
python3 -m pip install fusion-engine-client
```
- Note: If you wish to only install data parsing support, and do not want to install plotting and other requirements
used by the analysis tools in `bin/`, you may omit `[all]` and run `python3 -m pip install fusion-engine-client`
- Note: If you only need to encode and decode FusionEngine messages, and do not want to install plotting and other
requirements used by the analysis tools, you may install the `fusion-engine-client-core` package from source
instead. It contains the same Python code, but does not install the analysis requirements or the `p1_*`
command-line applications other than `p1_capture`, `p1_filter`, and `p1_print`. See [Point One FusionEngine Python
Client](python) for details.
3. Run any of the applications in `bin/`. For example, to plot results from a `*.p1log` file from a Point One device:
```bash
p1_display /path/to/log/file_or_directory
Expand Down
23 changes: 22 additions & 1 deletion python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ FusionEngine message specification.
- This will install the library code, and will also the applications in `fusion_engine_client/applications/`
onto your system `PATH` so you can run them at the command line (e.g., `p1_display.py` will be available on
the command line as `p1_display`).
- If you only need to encode and decode FusionEngine messages (e.g., on an embedded system), you may install the
`fusion-engine-client-core` package from source instead. See
[Install From Source](#install-from-source-use-in-another-python-project).
3. Run any of the applications described in [Applications](#applications). For example, to plot results from a `*.p1log`
file from a Point One device:
```bash
Expand All @@ -136,14 +139,31 @@ FusionEngine message specification.
```
3. Install the `fusione-engine-client` module, including all analysis and data processing tools:
```bash
python3 -m pip install -e /path/to/fusion-engine-client
python3 -m pip install -e /path/to/fusion-engine-client/python
```
- This will install the library code, and will also all of the applications in `fusion_engine_client/applications/`
onto your system `PATH` so you can run them at the command line (e.g., `p1_display.py` will be available on
the command line as `p1_display`).
- Note the additional `-e` argument (optional), which tells `pip` to install `fusion-engine-client` as editable.
This means that it will reference the local directory instead of copying the source code. That way, if you update
the code (`git pull`), your Python installation will automatically use the new version.
- If you only need to encode and decode FusionEngine messages (e.g., on an embedded system), you may install the
`fusion-engine-client-core` package instead. It contains the same `fusion_engine_client` Python code, but only
installs the requirements needed by the `messages`, `parsers`, and `utils` packages, and the `p1_capture`,
`p1_filter`, and `p1_print` command-line applications. It does not install the requirements for the analysis and
display tools, or the other `p1_*` applications. Install one package or the other, never both. Both packages
contain `fusion_engine_client`, so uninstalling one would break the other.

To install the `fusion-engine-client-core` package, set `FUSION_ENGINE_CLIENT_CORE=1`:
```bash
FUSION_ENGINE_CLIENT_CORE=1 python3 -m pip install -e /path/to/fusion-engine-client/python
```
To build a core package from a git URL, use `pip wheel --no-cache-dir`, then install the resulting wheel. pip's
wheel cache does not account for the environment variable, so it may reuse a previously built full wheel:
```bash
FUSION_ENGINE_CLIENT_CORE=1 python3 -m pip wheel --no-cache-dir --no-deps -w dist \
"git+https://github.com/PointOneNav/fusion-engine-client.git#subdirectory=python"
```
4. Run any of the applications described in [Applications](#applications). For example, to plot results from a `*.p1log`
file from a Point One device:
```bash
Expand All @@ -166,6 +186,7 @@ FusionEngine message specification.
```bash
python3 -m pip install -r requirements.txt
```
- If you only need to encode and decode FusionEngine messages, you may install `requirements-core.txt` instead.
4. Run any of the applications described in [Applications](#applications). For example, to plot results from a `*.p1log`
file from a Point One device:
```bash
Expand Down
12 changes: 12 additions & 0 deletions python/requirements-core.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Requirements for the `fusion-engine-client-core` package: FusionEngine messages, parsers, and utilities only.
aenum>=3.1.1
# Note: Using the Point One fork of gpstime until the patch to download the leap
# seconds file from alternate servers is merged:
# https://gitlab.com/jrollins/gpstime/-/merge_requests/2
p1-gpstime>=0.6.3.dev1
numpy>=1.16.0
construct>=2.10.0
# Note: Not used by the `messages` package, but required by `utils.argument_parser`.
argparse-formatter>=1.4
# Note: Not used by the `messages` package, but required by `p1_capture` and the applications that use it.
colorama>=0.4.4
12 changes: 3 additions & 9 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
aenum>=3.1.1
# Note: Using the Point One fork of gpstime until the patch to download the leap
# seconds file from alternate servers is merged:
# https://gitlab.com/jrollins/gpstime/-/merge_requests/2
p1-gpstime>=0.6.3.dev1
numpy>=1.16.0
construct>=2.10.0
# Requirements for the full `fusion-engine-client` package. To install only the requirements for the
# `fusion-engine-client-core` package (messages, parsers, and utilities), use `requirements-core.txt` instead.
-r requirements-core.txt

# Required for analysis and example applications only. Not used by the `messages` package.
argparse-formatter>=1.4
colorama>=0.4.4
# Note: orjson is optional for plotly, but it serializes the figure data several times faster than the
# standard Python json library.
orjson>=3.9.0
Expand Down
89 changes: 67 additions & 22 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,24 @@ def find_version(*file_paths):
raise RuntimeError("Unable to find version string.")


def build_core():
# A source distribution of the core package records its name in `PKG-INFO`, so a wheel built from it is a core
# wheel even when the environment variable is not set (e.g., `pip install --no-binary`).
if os.path.exists('PKG-INFO'):
with open('PKG-INFO', 'rt') as f:
if re.search(r"^Name: fusion[-_]engine[-_]client[-_]core$", f.read(), re.M):
return True
return os.environ.get('FUSION_ENGINE_CLIENT_CORE', '') not in ('', '0')


version = find_version('fusion_engine_client', '__init__.py')

# By default, build the full `fusion-engine-client` package. If `FUSION_ENGINE_CLIENT_CORE=1` is set, build the
# `fusion-engine-client-core` package instead. It contains the same code, but only requires the packages needed to
# encode and decode messages, and only installs the command-line applications that need nothing more (`p1_capture`,
# `p1_filter`, and `p1_print`). Install one or the other, never both, since they both contain `fusion_engine_client`.
core = build_core()

message_requirements = set([
'aenum>=3.1.1',
# Note: Using the Point One fork of gpstime until the patch to download the leap
Expand All @@ -23,15 +39,19 @@ def find_version(*file_paths):
'p1-gpstime>=0.6.3.dev1',
'numpy>=1.16.0',
'construct>=2.10.0',
# Note: Messages do not need this, but `utils.argument_parser` does, and applications that only use messages still
# use that parser. It is small and has no requirements of its own.
'argparse-formatter>=1.4',
# Note: Messages do not need this either, but `p1_capture` (and the applications that use it) do. It is small and
# has no requirements of its own.
'colorama>=0.4.4',
])

tools_requirements = set([
'argparse-formatter>=1.4',
'scipy>=1.5.0',
])

display_requirements = set([
'colorama>=0.4.4',
'orjson>=3.9.0',
'palettable>=3.3.0',
# Note: Plotly 7 bundles a MapLibre build whose web worker is an ES module, which Chrome refuses
Expand All @@ -47,13 +67,52 @@ def find_version(*file_paths):

all_requirements = message_requirements | tools_requirements | display_requirements | dev_requirements

# Applications that only need the core requirements. Both packages install these.
core_console_scripts = [
'p1_capture = fusion_engine_client.applications.p1_capture:main',
'p1_filter = fusion_engine_client.applications.p1_filter:main',
'p1_print = fusion_engine_client.applications.p1_print:main',
]

if core:
name = 'fusion-engine-client-core'
install_requires = message_requirements
console_scripts = core_console_scripts
extras_require = {}
description_note = """
This package contains only the requirements needed to encode and decode FusionEngine messages, and the `p1_capture`,
`p1_filter`, and `p1_print` applications. To use the analysis and display tools and the other `p1_*` applications,
install `fusion-engine-client` instead. Do not install both packages.
"""
else:
name = 'fusion-engine-client'
install_requires = all_requirements
console_scripts = core_console_scripts + [
'p1_display = fusion_engine_client.applications.p1_display:main',
'p1_extract = fusion_engine_client.applications.p1_extract:main',
'p1_lband_extract = fusion_engine_client.applications.p1_lband_extract:main',
'p1_proxy = fusion_engine_client.applications.p1_proxy:main',
]
extras_require = {
# Kept for backwards compatibility.
'all': [],
'dev': [],
'display': [],
'tools': [],
}
description_note = """
If you only need to encode and decode FusionEngine messages, you may build the `fusion-engine-client-core` package from
source instead, which contains the same code without the analysis and display requirements. Do not install both
packages.
"""

setup(
name='fusion-engine-client',
name=name,
version=version,
description='Point One FusionEngine Library',
long_description="""\
long_description=f"""\
Point One FusionEngine protocol support for real-time interaction and control, plus post-processing data analysis tools.

{description_note}
See https://github.com/PointOneNav/fusion-engine-client for full details. See https://pointonenav.com/docs/
for the latest FusionEngine message specification.
""",
Expand Down Expand Up @@ -85,26 +144,12 @@ def find_version(*file_paths):
download_url=f'https://github.com/PointOneNav/fusion-engine-client/archive/refs/tags/v{version}.tar.gz',
packages=find_packages(where='.'),
entry_points={
'console_scripts': [
'p1_capture = fusion_engine_client.applications.p1_capture:main',
'p1_display = fusion_engine_client.applications.p1_display:main',
'p1_extract = fusion_engine_client.applications.p1_extract:main',
'p1_filter = fusion_engine_client.applications.p1_filter:main',
'p1_lband_extract = fusion_engine_client.applications.p1_lband_extract:main',
'p1_print = fusion_engine_client.applications.p1_print:main',
'p1_proxy = fusion_engine_client.applications.p1_proxy:main',
]
'console_scripts': console_scripts,
},
python_requires='>=3.6',
setup_requires=[
'wheel>=0.36.2',
],
install_requires=list(all_requirements),
extras_require={
# Kept for backwards compatibility.
'all': [],
'dev': [],
'display': [],
'tools': [],
},
install_requires=sorted(install_requires),
extras_require=extras_require,
)
Loading