Skip to content

feat: deprecate the camelCase methods and short attribute names in diffpy.srfit.structure - #241

Open
cadenmyers13 wants to merge 1 commit into
diffpy:mainfrom
cadenmyers13:structure-names-dep
Open

cadenmyers13 wants to merge 1 commit into
diffpy:mainfrom
cadenmyers13:structure-names-dep

Conversation

@cadenmyers13

Copy link
Copy Markdown
Contributor

Lots of deprecation work. Please see table below for old and new names.

All deprecated names still work and raise a DeprecationWarning pointing to the same name in diffpy.cmistructure. The new names are added to diffpy.srfit.structure with the same spelling as in diffpy.cmistructure.

Methods

Module Class Before (deprecated) After
basestructureparset BaseStructureParSet canAdapt can_adapt
basestructureparset BaseStructureParSet getLattice get_lattice
basestructureparset BaseStructureParSet getScatterers get_scatterers
srrealparset SrRealParSet useSymmetry use_symmetry
srrealparset SrRealParSet usingSymmetry using_symmetry
cctbxparset CCTBXCrystalParSet getSpaceGroup get_space_group
sgconstraints BaseSpaceGroupParameters addParameter add_parameter
objcrystparset ObjCrystScattererParSet isDummy is_dummy
objcrystparset ObjCrystScattererParSet hasScatterers has_scatterers
objcrystparset StretchModeParameter addAtoms add_atoms
objcrystparset ObjCrystMoleculeParSet canAdapt can_adapt
objcrystparset ObjCrystMoleculeParSet useSymmetry use_symmetry
objcrystparset ObjCrystMoleculeParSet usingSymmetry using_symmetry
objcrystparset ObjCrystMoleculeParSet getLattice get_lattice
objcrystparset ObjCrystMoleculeParSet getScatterers get_scatterers
objcrystparset ObjCrystMoleculeParSet wrapRestraints wrap_restraints
objcrystparset ObjCrystMoleculeParSet wrapStretchModeParameters wrap_stretch_mode_parameters
objcrystparset ObjCrystMoleculeParSet restrainBondLength restrain_bond_length
objcrystparset ObjCrystMoleculeParSet restrainBondLengthParameter restrain_bond_length_parameter
objcrystparset ObjCrystMoleculeParSet restrainBondAngle restrain_bond_angle
objcrystparset ObjCrystMoleculeParSet restrainBondAngleParameter restrain_bond_angle_parameter
objcrystparset ObjCrystMoleculeParSet restrainDihedralAngle restrain_dihedral_angle
objcrystparset ObjCrystMoleculeParSet restrainDihedralAngleParameter restrain_dihedral_angle_parameter
objcrystparset ObjCrystMoleculeParSet addBondLengthParameter add_bond_length_parameter
objcrystparset ObjCrystMoleculeParSet addBondAngleParameter add_bond_angle_parameter
objcrystparset ObjCrystMoleculeParSet addDihedralAngleParameter add_dihedral_angle_parameter

Attributes

Module Class Before (deprecated) After
diffpyparset DiffpyLatticeParSet .angunits .angle_units
objcrystparset ObjCrystCrystalParSet .angunits .angle_units
objcrystparset ObjCrystScattererParSet .scat .scatterer
objcrystparset ObjCrystMoleculeRestraint .res .restraint
objcrystparset StretchModeParameter .matoms .mutated_atoms
sgconstraints SpaceGroupParameters .sg .space_group
cctbxparset CCTBXScattererParSet .strups .structure_parameter_set
cctbxparset CCTBXScattererParSet .idx .index
cctbxparset CCTBXUnitCellParSet .strups .structure_parameter_set

Bug fixes

Method Before After
ObjCrystMoleculeParSet.get_lattice Always raised AttributeError (called the missing newPar) Returns the placeholder lattice
ObjCrystMoleculeParSet.wrap_stretch_mode_parameters Raised AttributeError for any molecule with stretch modes (called the missing AddAtoms) Wraps each bond-length and bond-angle stretch mode as a Parameter

…ffpy.srfit.structure

Add snake_case names matching diffpy.cmistructure for the 36 camelCase
methods diffpy#236 left out, with @deprecated forwarders, and deprecated
properties for angunits, scat, res, matoms, sg, strups and idx. Move
internal callers and regular tests to the new names.

Fix ObjCrystMoleculeParSet.get_lattice (called the missing newPar) and
wrap_stretch_mode_parameters (called the missing AddAtoms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cadenmyers13

Copy link
Copy Markdown
Contributor Author

@sbillinge ready for review

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.19403% with 197 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.96%. Comparing base (507aa4e) to head (234943c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tests/deprecated/test_structure_deprecations.py 47.88% 148 Missing ⚠️
tests/test_objcrystparset.py 4.54% 42 Missing ⚠️
tests/test_sgconstraints.py 0.00% 4 Missing ⚠️
tests/deprecated/test_pdf_deprecations.py 0.00% 2 Missing ⚠️
tests/test_diffpyparset.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
- Coverage   84.95%   81.96%   -3.00%     
==========================================
  Files          44       46       +2     
  Lines        4886     5400     +514     
==========================================
+ Hits         4151     4426     +275     
- Misses        735      974     +239     
Files with missing lines Coverage Δ
tests/test_diffpyparset.py 89.58% <0.00%> (ø)
tests/deprecated/test_pdf_deprecations.py 59.33% <0.00%> (ø)
tests/test_sgconstraints.py 11.65% <0.00%> (+0.07%) ⬆️
tests/test_objcrystparset.py 9.84% <4.54%> (-0.36%) ⬇️
tests/deprecated/test_structure_deprecations.py 54.22% <47.88%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant