Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Ptr Editor

PyPI PyPI - Python Version PyPI - License Coookiecutter - Wolt


Documentation: https://juice-soc-public.io.esa.int/python/ptr-editor/main/

Source Code: https://gitlab.esa.int/juice-soc-public/python/ptr-editor

PyPI: https://pypi.org/project/ptr-editor/


Installation

Basic Installation

pip install ptr-editor

Optional Features

CLI Module

To use the command-line interface (optional), install with CLI dependencies:

pip install "ptr-editor[cli]"

Then you can use commands like:

ptr-editor validate path/to/file.ptx

Configuration

Logging

ptr-editor shows its warnings, and those of quick-spice-manager (which downloads the SPICE kernels: an unreachable server, a fallback to cached kernels, a failed download), without any setup: as HTML in Jupyter, on stderr elsewhere. Your own loguru handlers are kept.

import ptr_editor

ptr_editor.set_logger_level("ERROR")                       # errors only
ptr_editor.set_logger_level("INFO", "quick_spice_manager")  # the kernels' progress too

You can also set ptr-editor's level with a .env file:

  1. Copy the example environment file:

    cp .env.example .env
    
  2. Edit .env and set your desired log level:

    PTR_EDITOR_LOG_LEVEL=INFO
    

Valid log levels are: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL

Alternatively, you can set the environment variable directly:

export PTR_EDITOR_LOG_LEVEL=DEBUG

Or in Python before importing ptr_editor:

import os
os.environ["PTR_EDITOR_LOG_LEVEL"] = "DEBUG"
import ptr_editor

Development

  • Clone this repository
  • Requirements:
    • uv
    • Python 3.11+
  • Create a virtual environment and install the dependencies, by:
cd ptr-editor
uv sync --all-groups

Running

The package is mainly intended to be used as a library within jupyter notebooks or python scripts.

To quickly start a jupyter notebook with the package installed, you can use:

uv run jupyter lab tutorial

note: for this to work you need to have installed the package with uv as above.

Testing

uv run pytest

Documentation

The user manual is the Jupyter Book in tutorial/: a quick start, a guide by task, examples, a cheat sheet and the API reference (built from the docstrings). The GitLab CI publishes it on every push to main at https://juice-soc-public.io.esa.int/python/ptr-editor/main/. To build it locally:

just docs          # multi-page HTML  ->  tutorial/_build/html/index.html
just docs-single   # one HTML page    ->  tutorial/_build/singlehtml/index.html
just docs-pdf      # PDF              ->  tutorial/_build/pdf/ptr-editor.pdf
just docs-downloads  # the site as published, with the manual to download (one
                     # self-contained HTML page and the PDF, named with the version)
                     # in tutorial/_build/html/downloads/, linked from the front page

Every build executes the notebooks first. The PDF and the downloads print the single page with headless Chromium: run uv run --group docs playwright install chromium once, and keep the network on (the figures load plotly.js from its CDN; in the downloadable page they are images, and the page opens offline).

The notebooks are also tests: uv run pytest tutorial runs the ones listed in tutorial/_toc.yml.

Developer notes (AGM internals, reverse-engineering method, testing strategy) are in docs/dev/. They are not published.

Releasing

Manual release

Releases are done with the command, e.g. incrementing patch:

uv run just bump patch
# also push, of course:
git push origin main --tags

this will update the changelog, commit it, and make a corresponding tag.

as the CI is not yet configured for publish on pypi it can be done by hand:

uv build
uv publish --build path/to/wheel

Automatic release - to be fixed

Trigger the Draft release workflow (press Run workflow). This will update the changelog & version and create a GitHub release which is in Draft state.

Find the draft release from the GitHub releases and publish it. When a release is published, it'll trigger release workflow which creates PyPI release and deploys updated documentation.

Updating with copier

To update the skeleton of the project using copier:

uvx copier update --defaults

Pre-commit

Pre-commit hooks run all the auto-formatting (ruff format), linters (e.g. ruff and mypy), and other quality checks to make sure the changeset is in good shape before a commit/push happens.

You can install the hooks with (runs for each commit):

pre-commit install

Or if you want them to run only for each push:

pre-commit install -t pre-push

Or if you want e.g. want to run all checks manually for all files:

pre-commit run --all-files

How this project is developed

ptr-editor is developed with the help of AI coding assistants (large language models). They are used to write and refactor code, tests and documentation, under the direction of the developers, who review every change. What keeps it correct is the test suite, not the tool: it covers the public API, runs every docstring example and tutorial notebook, and checks the attitude behaviour against the AGM itself (OSVE). If something looks wrong, please report it.


This project was generated using a fork of the wolt-python-package-cookiecutter template.

Metadata

Release files for ptr-editor 1.0.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptr-editor 1.0.0a2
File Size Uploaded Provenance Actions
ptr_editor-1.0.0a2.tar.gz 680.7 kB Without provenance Details for ptr_editor-1.0.0a2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ptr-editor 1.0.0a2
File Interpreter ABI Platform Actions
ptr_editor-1.0.0a2-py3-none-any.whl Python 3 none any Details for ptr_editor-1.0.0a2-py3-none-any.whl

Total release size: 1.4 MB

Release files / ptr_editor-1.0.0a2.tar.gz

Download URL ptr_editor-1.0.0a2.tar.gz
Size 680.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d10e9dc7117f741575111f03d8625db5ec17604dcee23d874efa9a202344180d
BLAKE2b-256 checksum
How to use checksums
081a9dfbaf56ea9d45afae8aacca7ecc47fdba74e84651890ccd35845cf1b5be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ptr_editor-1.0.0a2-py3-none-any.whl

Download URL ptr_editor-1.0.0a2-py3-none-any.whl
Size 761.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43ebedd0c74a280e4ce66d97c3d7128205a484231e9f22bccf667396d5256e5b
BLAKE2b-256 checksum
How to use checksums
b777caadf158d5d913879df03f222463ac2a278a66af5d425ef6fa6d6439f84a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ptr-editor 1.0.0a2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page