Skip to content
Closed
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
73 changes: 73 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,76 @@ jobs:
export LUA_CPATH="$PWD/stage/usr/lib/?.so;;"
export DSEAMS_INSTALL_ROOT="$PWD/stage"
lua example_lua/library/installed.lua

readers:
name: chemfiles and readcon
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc
with:
toolchain: stable
- uses: mamba-org/setup-micromamba@f457c30a868e4760d3a6fcea5f25dc655b8edf39 # v3.2.1
with:
environment-name: yoda
create-args: >-
cxx-compiler
meson
ninja
pkg-config
eigen
libblas
liblapack
lua=5.4
cmake
openssl
make
cache-environment: true
- name: Install chemfiles 0.10.4 and readcon-core v0.14.10
shell: bash -el {0}
run: |
set -euxo pipefail
curl -fsSL -o chemfiles.tar.gz https://github.com/chemfiles/chemfiles/archive/refs/tags/0.10.4.tar.gz
tar -xzf chemfiles.tar.gz
cmake -S chemfiles-0.10.4 -B chemfiles-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
-DCMAKE_C_COMPILER="${CC:-gcc}" \
-DCMAKE_CXX_COMPILER="${CXX:-g++}" \
-DBUILD_SHARED_LIBS=ON
cmake --build chemfiles-build --parallel
cmake --install chemfiles-build
# 0.10.4 installs a CMake package and no pkg-config file.
mkdir -p "$CONDA_PREFIX/lib/pkgconfig"
printf '%s\n' \
"prefix=${CONDA_PREFIX}" \
'libdir=${prefix}/lib' \
'includedir=${prefix}/include' \
'' \
'Name: chemfiles' \
'Description: Library for reading and writing chemistry files' \
'Version: 0.10.4' \
'Libs: -L${libdir} -lchemfiles' \
'Cflags: -I${includedir}' \
> "$CONDA_PREFIX/lib/pkgconfig/chemfiles.pc"
cargo install cargo-c --locked
# v0.14.10 is the readcon-core revision in the seams-core wrap
# this tree builds. When that wrap moves, this pin must track
# seams-core's floor (>=0.16.2, the floor in seams-core v2.14.1).
git clone --depth 1 --branch v0.14.10 https://github.com/lode-org/readcon-core.git
cargo cinstall --release --prefix "$CONDA_PREFIX" \
--libdir lib --pkgconfigdir lib/pkgconfig \
--manifest-path readcon-core/Cargo.toml
pkg-config --modversion chemfiles
pkg-config --modversion readcon-core
- name: Configure, require both readers, and test
shell: bash -el {0}
run: |
set -euxo pipefail
meson setup bbdir --prefix=/usr --libdir=lib --wrap-mode=nofallback \
-Dwith_chemfiles=enabled -Dwith_readcon=enabled
meson compile -C bbdir
export LUA_PATH="$PWD/lua/?.lua;;"
export LUA_CPATH="$PWD/bbdir/?.so;;"
lua -e 'local d = require("dseams"); assert(d.has_chemfiles() == true); assert(d.has_readcon() == true)'
meson test -C bbdir -v --print-errorlogs
7 changes: 7 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ cff-version: 1.2.0
message: "If you use this software, please cite it using the metadata below."
title: "yodaStruct: Lua and Fennel front end for d-SEAMS"
type: software
# [[[cog
# import re
# from pathlib import Path
# version = re.search(r"version:\s*'([^']+)'", Path("meson.build").read_text(encoding="utf-8")).group(1)
# cog.outl(f'version: "{version}"')
# ]]]
version: "2.10.0"
# [[[end]]]
date-released: "2026-09-06"
license: MIT
repository-code: "https://github.com/d-SEAMS/yodaStruct"
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+engine-reader-query.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`dseams.has_chemfiles` and `dseams.has_readcon` follow the macros on the linked seams-core, including a readcon-core wrap when no system library is installed.
1 change: 1 addition & 0 deletions changelog.d/+readers.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`dseams.has_chemfiles` and `dseams.has_readcon` report whether this build can read PDB, GRO, and DCD files through chemfiles and `.con` files through readcon-core.
6 changes: 6 additions & 0 deletions ci/version/files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copies of the release version in meson.build.
# Regenerate: python3 -m cogapp -I ci/version -r @ci/version/files.txt
nix/package.nix
CITATION.cff
towncrier.toml
dseams-2.10.0-1.rockspec
37 changes: 37 additions & 0 deletions cog.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Cocogitto release driver. Towncrier owns CHANGELOG.md.
# Prepare: cog bump --auto (or --patch / --minor / --major / --version X.Y.Z)
# The tag push is the maintainer's. Publishing to LuaRocks is luarocks upload.

from_latest_tag = true
ignore_merge_commits = true
disable_changelog = true
disable_bump_commit = false
tag_prefix = "v"
branch_whitelist = ["main", "master"]

pre_bump_hooks = [
"python3 -m cogapp -I ci/version -r @ci/version/files.txt",
"towncrier build --yes --version {{version}}",
]

post_bump_hooks = [
"git --no-pager show --stat HEAD",
"echo \"Prepared v{{version}}. Push the version commit and tag v{{version}}, then luarocks upload the renamed rockspec.\"",
]

[commit_types]
feat = { changelog_title = "Features" }
fix = { changelog_title = "Bug Fixes" }
perf = { changelog_title = "Performance" }
refactor = { changelog_title = "Refactoring" }
docs = { changelog_title = "Documentation" }
test = { changelog_title = "Tests" }
build = { changelog_title = "Build System" }
ci = { changelog_title = "CI" }
chore = { changelog_title = "Miscellaneous" }
style = { changelog_title = "Style" }
revert = { changelog_title = "Reverts" }

[changelog]
path = "CHANGELOG.md"
authors = [{ username = "HaoZeke", signature = "Rohit Goswami" }]
60 changes: 60 additions & 0 deletions docs/orgmode/contributing/developer/faq.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#+TITLE: Developer FAQ
#+OPTIONS: toc:nil todo:nil num:nil author:nil title:nil
#+STARTUP: content

* Developer FAQ

** Why are chemfiles and readcon-core optional?

LAMMPS dumps and XYZ are compiled into seams-core. PDB, GRO, and DCD
need chemfiles. ~.con~ needs readcon-core. Only seams-core probes for
them. A separate ~dependency()~ in this project would be cached as
not found and would skip the readcon-core wrap. When a library is
missing and the wrap is not used, that reader is left out and the
rest of the library still builds. ~dseams.has_chemfiles()~ and
~dseams.has_readcon()~ are the ~SEAMS_HAS_CHEMFILES~ and
~SEAMS_HAS_READCON~ macros from the engine that was linked.

** How do I turn the readers on?

Install chemfiles and readcon-core so ~pkg-config --modversion~ sees
~chemfiles~ and ~readcon-core~, then configure with
~-Dwith_chemfiles=enabled -Dwith_readcon=enabled~. Those options do
not search for the libraries. They fail configure when seams-core
left the matching macro unset. ~auto~, the default, accepts whatever
the engine built.

With the default wrap mode and no system readcon-core, seams-core
builds its readcon-core wrap and ~has_readcon()~ is true. ~--wrap-mode=nofallback~
leaves ~.con~ out unless a system library is found. There is no
chemfiles wrap. The wrap revision in this tree is readcon-core
v0.14.10. chemfiles 0.10.4 matches the calls in seams-core. When the
wrap moves, the installed readcon-core must track seams-core's floor
(>=0.16.2 in seams-core v2.14.1).

** Where is the version written?

Once, in the ~version:~ field of ~meson.build~. ~docs/source/conf.py~
reads that field for the Sphinx release. Every other copy is listed
in ~ci/version/files.txt~ and regenerated with cogapp. Cocogitto's
~tag_prefix~ is ~v~, so the git tag is ~vX.Y.Z~.

** Who writes the changelog?

Towncrier. Fragments live in ~changelog.d/~ (the existing towncrier
directory). ~towncrier build --version X.Y.Z~ writes ~CHANGELOG.md~
and removes the fragments. Do not hand-edit a released section above
the towncrier marker.

** Why are these pages Org?

~docs/orgmode/~ is the source. ~docs/export.el~ publishes RST for
Sphinx. Hand-edited RST drifts from the Org. Release notes stay in
~CHANGELOG.md~, not in a second Markdown file.

** What does LuaRocks publish?

The rockspec ~dseams-2.10.0-1.rockspec~ describes the package and
builds it with Meson. ~luarocks upload~ sends that rockspec to the
LuaRocks registry. The upload is the publish step. See
[[file:release.org][Release process]].
59 changes: 59 additions & 0 deletions docs/orgmode/contributing/developer/index.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#+TITLE: Developer Guide
#+OPTIONS: toc:nil todo:nil num:nil author:nil title:nil
#+STARTUP: content

* Developer Guide

Day-to-day work on the Lua and Fennel library (~require("dseams")~).
The release steps are in [[file:release.org][Release process]].

** Environment

A C++20 compiler, Meson 1.3 or newer, Ninja, pkg-config, Lua 5.3 or
5.4 (not 5.5), Eigen 3.4, and BLAS/LAPACK. Optional readers are
~chemfiles~ (PDB, GRO, DCD) and ~readcon-core~ (`.con`), found by
pkg-config. The Nix development shell is ~nix develop~.

#+begin_src bash
meson setup bbdir --wrap-mode=nofallback
meson compile -C bbdir
#+end_src

** Common tasks

| Task | Command |
|------+---------|
| Configure and build | ~meson setup bbdir --wrap-mode=nofallback && meson compile -C bbdir~ |
| Full test suite | ~meson test -C bbdir -v --print-errorlogs~ |
| Reader tests | ~meson test -C bbdir -v --suite readers~ |
| Readers required | ~meson setup bbdir -Dwith_chemfiles=enabled -Dwith_readcon=enabled~ |
| Changelog preview | ~towncrier build --draft~ |
| Version copies | ~python3 -m cogapp -I ci/version -r @ci/version/files.txt~ |
| Commit check | ~cog check v2.10.0..HEAD~ |
| Bump dry-run | ~cog bump --dry-run~ |
| Org to RST | ~emacs --batch --load export.el~ from ~docs/~ |
| HTML docs | ~sphinx-build -b html docs/source docs/build~ |
| Source rock | ~luarocks pack dseams-2.10.0-1.rockspec~ |

** Documentation

Reader pages and this guide are Org under ~docs/orgmode/~.
~docs/export.el~ writes RST under ~docs/source/~.
Do not edit the RST by hand.
Sphinx builds HTML from that RST and from Doxygen XML of
~src/include/internal/lua_api.hpp~.

#+begin_src bash
cd docs && emacs --batch --load export.el
sphinx-build -b html docs/source docs/build
#+end_src

#+begin_export rst
.. toctree::
:maxdepth: 2
:caption: Details

testing
release
faq
#+end_export
128 changes: 128 additions & 0 deletions docs/orgmode/contributing/developer/release.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#+TITLE: Release Process
#+OPTIONS: toc:nil todo:nil num:nil author:nil title:nil
#+STARTUP: content

* Release Process

One release version, written in the ~version:~ field of ~meson.build~.
~docs/source/conf.py~ reads it for Sphinx, so the book is not a second
copy. Every other copy sits between cogapp markers in a file listed
in ~ci/version/files.txt~: ~nix/package.nix~, ~CITATION.cff~,
~towncrier.toml~, and ~dseams-2.10.0-1.rockspec~.
Regenerate them with cogapp (the Python package), the same command
rgpot runs from ~ci/version/files.txt~. That ~cog~ script is not
cocogitto. Cocogitto's command is ~cog~ and its config is
~cog.toml~, with ~tag_prefix = "v"~.

#+begin_src bash
python3 -m cogapp -I ci/version -r @ci/version/files.txt
#+end_src

Git tags are ~vX.Y.Z~. Towncrier owns ~CHANGELOG.md~. Fragments under
~changelog.d/~ are the only input for the next notes block. Do not
hand-edit a ~## [X.Y.Z]~ section above the towncrier marker, and do
not add a Markdown release manual.

*Canonical changelog*: repository-root ~CHANGELOG.md~.

Tooling:

| Tool | Role |
|------+------|
| [[https://docs.cocogitto.io][cocogitto]] (~cog~) | Conventional-commit bump, version commit, annotated tag ~vX.Y.Z~ |
| [[https://towncrier.readthedocs.io][towncrier]] | ~CHANGELOG.md~ from ~changelog.d/~ |
| cogapp (~python3 -m cogapp~) | Rewrite the copies in ~ci/version/files.txt~ |
| Meson | Configure, compile, and test the library |
| LuaRocks | Pack and upload the rockspec to the LuaRocks registry |

** Changelog fragments

Add a fragment under ~changelog.d/~ for each user-visible change.
The orphan prefix is ~+~ when there is no issue number.

#+begin_src bash
printf '%s\n' 'Short user-facing note.' > changelog.d/+short-name.added.md
towncrier build --draft
#+end_src

Types in ~towncrier.toml~: ~added~, ~changed~, ~deprecated~, ~removed~,
~fixed~, ~security~.

** Commit check

Cocogitto checks a revision range. Merge commits are ignored
(~ignore_merge_commits~ in ~cog.toml~).

#+begin_src bash
cog check v2.10.0..HEAD
#+end_src

** From a clean clone to a published rock

1. Clone and build.

#+begin_src bash
git clone https://github.com/d-SEAMS/yodaStruct.git
cd yodaStruct
meson setup bbdir --wrap-mode=nofallback
meson compile -C bbdir
meson test -C bbdir -v --print-errorlogs
#+end_src

2. Preview the notes and the bump. Neither command publishes.

#+begin_src bash
towncrier build --draft
cog bump --dry-run
cog check v2.10.0..HEAD
#+end_src

3. Refresh the version copies and pack a source rock. Packing does
not upload.

#+begin_src bash
python3 -m cogapp -I ci/version -r @ci/version/files.txt
luarocks pack dseams-2.10.0-1.rockspec
#+end_src

~luarocks pack~ on that rockspec fetches ~source.tag~. That tag is
the published release, not unpushed commits. To pack the checkout
you have, copy the rockspec, set ~source.url~ to ~git+file://~ plus
the absolute path of this clone and ~source.branch~ to ~HEAD~'s
branch, and ~luarocks pack~ that copy.

4. Cut the release locally. Write the new version into the
~version:~ field of ~meson.build~ first. ~cog bump~ then runs the
~pre_bump_hooks~ in ~cog.toml~:

- ~python3 -m cogapp -I ci/version -r @ci/version/files.txt~
- ~towncrier build --yes --version {{version}}~

Then it commits and tags ~vX.Y.Z~.

#+begin_src bash
cog bump --version X.Y.Z
#+end_src

Rename ~dseams-2.10.0-1.rockspec~ to ~dseams-X.Y.Z-1.rockspec~ when
the version changed, put that path in ~ci/version/files.txt~, and
amend the version commit so the rockspec name matches the
~version~ field.

5. Publish. These two commands are the publishing steps. Do not run
them as a dry-run.

#+begin_src bash
git push origin HEAD --follow-tags
luarocks upload dseams-X.Y.Z-1.rockspec
#+end_src

~luarocks upload~ needs an API key from luarocks.org. It is the
registry publish for this binding. A tag alone does not upload
the rock.

** After the tag

Confirm the tag ~vX.Y.Z~ points at the version commit, that
~CHANGELOG.md~ has that section, and that the LuaRocks page for
~dseams~ shows the upload.
Loading
Loading