moleditpy_pmeff-plugin

Packaging & release

This repo ships two artifacts from one version tag:

  1. The MoleditPy plugin — a pmeff_plugin_<version>.zip attached to a GitHub Release (and the moleditpy-plugins registry is notified), matching the other MoleditPy plugin repos.
  2. The standalone pmeff PyPI package — a NumPy-only force field usable outside MoleditPy.

Single source of truth

pmeff_plugin/forcefield.py is the canonical engine. The pmeff package is derived from it:

Both are produced by:

python scripts/sync_forcefield.py

The committed copies let the repo build as-is; the test suite (test_pmeff_package.py::test_copied_engine_matches_source) fails if they drift, so edit pmeff_plugin/forcefield.py, then re-run the sync script.

Public API (pmeff)

import pmeff

# RDKit path (pip install "pmeff[rdkit]") — Mol in, same Mol back, relaxed:
mol, result = pmeff.optimize_mol(mol)

# Pure-NumPy path (pip install pmeff) — arrays in, coords out:
coords, result = pmeff.optimize_coords(atomic_numbers, bonds, coords)

Cutting a release

Bump PLUGIN_VERSION in pmeff_plugin/__init__.py, then either:

The release.yml workflow then, in order:

  1. release — verifies the tag matches PLUGIN_VERSION, builds the plugin zip, creates the GitHub Release, and notifies the moleditpy-plugins registry.
  2. pypi — re-syncs the engine, builds the sdist + wheel, attaches them to the GitHub Release, and publishes pmeff to PyPI. (The binaries are attached before the PyPI step, so they land on the release even if the PyPI upload fails.)
  3. sync-back — re-runs the sync script on main and, if the committed pmeff/forcefield.py / pmeff/_version.py don’t already match the release (e.g. the tag was cut without syncing locally first), commits the refreshed copies back to main ([skip ci], so it doesn’t re-trigger). In the normal case — where you synced before tagging — this no-ops.

So PLUGIN_VERSION stays the single source of truth, and the repo’s derived package files are kept in sync automatically at release time.

Building / uploading locally

python scripts/sync_forcefield.py
python -m build            # -> dist/pmeff-<version>.tar.gz + .whl
python -m twine check dist/*
python -m twine upload dist/*

PyPI trusted publishing (one-time)

The workflow publishes via OIDC (no API token stored). Before the first CI release, add a pending publisher on PyPI for project pmeff: