Metadata-Version: 2.3
Name: nxdebugger
Version: 0.1.2
Summary: Thread-free Debug Adapter Protocol debugger for NX MOM Python
Author: Christoph Brandau
Author-email: Christoph Brandau <c.brandau91@gmail.com>
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# Debugging NX with VS Code

This debugger communicates with VS Code directly through the Debug Adapter
Protocol (DAP). It does not load `debugpy`, `pydevd`, Cython extensions, or
debugger background threads into the NX process. This makes it suitable for the
short-lived Python subinterpreter used by the NX MOM adapter.

## Start

1. Close every running NX process. This is important after an earlier
   `debugpy` process-ID attach because its modules remain loaded until that
   process exits.
2. Start the post run in NX. `MOM_start_of_program` waits up to 60 seconds
   for VS Code.
3. Open **Run and Debug** in VS Code, select
   **NX: Thread-free DAP Debugger**, and press `F5`.
4. Set breakpoints in the post file or imported Python modules.

To post normally, start NX without `NX_DAP_DEBUG=1`. No port is opened and
the post does not wait for a debugger in that mode.

## Supported features

- Breakpoints, conditions, hit conditions, and logpoints
- Continue, Step Into, Step Over, and Step Out
- Call Stack, Locals, Globals, and nested values
- Watch expressions and Debug Console evaluation
- Break on raised Python exceptions
- Synchronous cleanup from `MOM_end_of_program` and through `atexit`

## Limitations

The adapter deliberately operates only on the current MOM Python thread. A
Pause request is therefore processed at the next Python trace event. Python
cannot be interrupted immediately while NX spends a long time in native C/C++
code. The initial implementation supports one Python thread.

Diagnostics are written to `nx_dap_debugger.log` next to the debugger files.

## Package releases

Gitea Actions tests and builds the package on pull requests. Publishing a Gitea
release additionally publishes the distributions to the Gitea PyPI registry.
The package version is taken from the release tag; both `v0.1.0` and `0.1.0`
result in package version `0.1.0`.

Push the release tag without changing the version in `pyproject.toml`:



Then create and publish a Gitea release for that tag. Draft releases do not
publish a package.

Before publishing, create a personal access token for the repository owner with
the `write:package` scope and store it as the repository Actions secret
`PYPI_TOKEN`.
