Repository navigation
feat: Copy over the code from diffpy.srfit.structure to here - #1
Conversation
Copy src/diffpy/srfit/structure/ and its tests (test_diffpyparset, test_objcrystparset, test_sgconstraints, plus LaMnO3.stru) verbatim from diffpy.srfit upstream/main (8d8931a). No edits, so imports still point at diffpy.srfit.structure and are fixed in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace diffpy.srfit.structure imports and references with diffpy.cmistructure in the copied modules and tests, and make the package importable and testable: - __init__.py: restore the package header and __version__ import. - src/diffpy/__init__.py: add extend_path so diffpy.cmistructure does not shadow the rest of the diffpy namespace. - pyproject.toml: point the entry point at cmistructure_app:main. - requirements: declare diffpy.srfit, diffpy.structure, diffpy.srreal, and pyobjcryst for tests. - tests: add datafile and availability fixtures and tests/__init__.py; remove the template functions.py and its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diffpy.cmistructure has never been released, so it has no users to migrate. Drop constrainAsSpaceGroup, the three StretchModeParameter setConst forwarders in objcrystparset, their deprecation messages and diffpy.utils._deprecator imports, and the test for the constrainAsSpaceGroup warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename every camelCase function and method in the package to snake_case (e.g. canAdapt -> can_adapt, getScatterers -> get_scatterers, restrainBondLength -> restrain_bond_length, struToParameterSet -> stru_to_parameter_set), along with their call sites and tests. No deprecation aliases are kept since the package has not been released. Rewrite the public docstrings to the NumPy style: imperative one-line summary, typed Parameters/Returns/Raises sections with descriptions starting with "The", and the nonstandard "Managed Parameters" and "Inherited Attributes" sections folded into Attributes. Also replace ObjCrystMoleculeParSet.get_lattice's calls to newPar, which no longer exists on srfit's ParameterSet, with new_parameter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace abbreviations in the public API with full words, e.g. stru_to_parameter_set -> structure_to_parameter_set, stru -> structure, scat -> scatterer, res -> restraint, par -> parameter, cryst -> crystal, idx -> index, sg -> space_group, matoms -> mutated_atoms, angunits -> angle_units, sgpars -> space_group_parameters, and latpars/xyzpars/adppars -> lattice/xyz/adp_parameters. Parameters that have default values (sig, w, sgoffset, constrainlat, adpsymbols, isosymbol, ...) and the default container name "sgpars" are unchanged so keyword-argument callers keep working. Class and module names are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pyobjcryst and diffpy.structure are declared test and runtime dependencies, so the tests should fail rather than silently skip when they are missing. Remove the pyobjcryst_available and diffpy_structure_available fixtures, their skip checks, and the cctbx import guard in the already-disabled xtestCreateSpaceGroup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrite the assertions in test_diffpyparset, test_objcrystparset and test_sgconstraints as `assert actual_* == expected_*`, with the code under test on the actual side, and add C#/Expected comments for each logical stage. Related checks (e.g. which coordinates are fixed, which atoms moved) are compared as one dict or list so a failure reports every mismatch at once. What each test checks, including tolerances, is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge the diffpy.cmistructure header into the original diffpy.srfit header of each module and test moved from diffpy.srfit.structure. The Columbia University copyright and original author are kept, as the BSD license requires, and the header points to both LICENSE.rst and LICENSE_DANSE.rst. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The modules moved from diffpy.srfit.structure are covered by the DANSE license from Columbia University, which must be distributed with them. Copy it verbatim from diffpy.srfit; MANIFEST.in already includes LICENSE*.rst in the sdist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@sbillinge ready for review. Please check that the headers in the source and tests files have the copyright correctly formated. |
Replace calls that diffpy.structure has deprecated for removal in 4.0.0 with their snake_case equivalents: GetSpaceGroup -> get_space_group, positionFormulas -> position_formulas, UFormulas -> u_formulas, IsSpaceGroupIdentifier -> is_space_group_identifier and, in the tests, Lattice.setLatPar -> set_latt_parms. All of these exist in diffpy.structure 3.4.0 and later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Some problems with testing... investigating |
|
is it that we haven't published to CF one of the dependencies with the deprecated variable names? |
|
@sbillinge Yeah, something along those lines. In concept this migration is straightforward but in practice I need to think about it carefully. Im working with claude to come up with a good plan |
|
we don't need tests passing in principle to get this started. So don't stress oo much. As long as we don't break what is in produciton. |
|
@sbillinge Yeah you're right. I'm working on some srfit cleanup today to ensure we're good over there before proceeding here which I think is necessary to some extent. I think we are going to need a small release of srfit before much work can be done here. Otherwise, we'll make additions here, fixes in srfit, then will have to make changes here again which adds extra unnecessary work |
Port the srfit changes to structure/ made after 8d8931a (#217, #220, #226, #227) that d774950 did not already cover: - objcrystparset.py: add molecule restraints through register_soft_bounds so the recipe is notified, and call add_observer instead of the deprecated addObserver. - BVSRestraint and ObjCrystMoleculeRestraint: add __str__ so show() lists the restraint settings. - Docstrings: point at remove_soft_bounds instead of the deprecated unrestrain. - Tests: port srfit's three show() restraint tests and the capturestdout fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmistructure needs srfit 3.4.0 names (add_parameter, register_soft_bounds, add_observer), but conda-forge only has 3.3.1. Install the rc from PyPI in the workflows' run step until 3.4.0 is on conda-forge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Revert the 50a3c7b renames of .sgpars, .latpars, .xyzpars and .adppars (and their container names) per decision 8 of the split plan. diffpy.cmi examples use these names 45 times, and as container names they appear in parameter paths and fit results, so srfit cannot deprecate them cleanly. The other attribute renames (stru, scat, res, matoms, angunits, ...) stay, since srfit can forward those through properties. Also add tests that pin the four names and drop the unittest.main() leftovers from the structure test files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- pyproject.toml, cookiecutter.json: support Python 3.12-3.13 only, since diffpy.srreal has no Python 3.14 build and 3.11 is below srfit's minimum. - conda.txt, pip.txt: add pyobjcryst, a runtime dependency of objcrystparset.py. - pyproject.toml: fail tests when cmistructure calls its own deprecated names, matching srfit. - docs: replace the template API page with the cmistructure modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set requires-python, the classifiers and cookiecutter.json to 3.11-3.13, matching the other diffpy.cmi* packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
I took some liberty to
actual_* == expected_*with case namesAlso had to revert the max python version to 3.13 because of srreal