Skip to content

replaced lib.transformations with transformations package #5062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

orbeckst
Copy link
Member

@orbeckst orbeckst commented Jun 11, 2025

Fixes #5061

Changes made in this Pull Request:

  • removed old lib.transformations code
  • use transformations package instead (which is the updated version of our old vendored code)
  • Makes transformations a core dependency.
  • moved our only addition (transformations.rotaxis() to mdamath.rotaxis()) and left a deprecated version in lib.transformations

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.


📚 Documentation preview 📚: https://mdanalysis--5062.org.readthedocs.build/en/5062/

- removed old lib.transformations code
- use transformations package instead (which is the updated version of
  our old vendored code): updated imports everywhere
- moved our only addition (transformations.rotaxis() to mdamath.rotaxis()) and left a
  deprecated version in lib.transformations
- blackened files
@orbeckst orbeckst force-pushed the remove-transformations branch from 9dc6308 to 83a8e77 Compare June 11, 2025 01:41
@orbeckst orbeckst requested a review from Copilot June 11, 2025 01:55
Copilot

This comment was marked as outdated.

@orbeckst orbeckst requested a review from Copilot June 11, 2025 03:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the vendored lib.transformations C code with the external transformations package, migrates a custom rotaxis implementation into lib.mdamath, and leaves a deprecated wrapper in the old namespace.

  • Removed the compiled _transformations extension and switched all imports to use the transformations package.
  • Moved rotaxis into lib.mdamath and added a deprecation test for the old location.
  • Updated tests to call into the installed package and documented the change in the CHANGELOG.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testsuite/MDAnalysisTests/utils/test_transformations.py Switched parameterized tests to use t.transformations.* and commented out obsolete Python-level tests
package/setup.py Deleted the MDAnalysis.lib._transformations extension from build configuration
package/pyproject.toml Added transformations to dependencies without pinning a version
package/MDAnalysis/lib/mdamath.py Added a new rotaxis function with docs and versionchanged note
package/CHANGELOG Recorded the replacement of vendored code and deprecation of lib.transformations
Comments suppressed due to low confidence (1)

testsuite/MDAnalysisTests/utils/test_transformations.py:399

  • Commenting out entire test blocks silently removes coverage; use pytest.mark.skip or xfail to indicate intentional deprecation while still reporting on coverage.
# @pytest.mark.parametrize(

@orbeckst orbeckst force-pushed the remove-transformations branch from 25f8085 to 72c64c8 Compare June 11, 2025 06:34
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.11%. Comparing base (8b0be5f) to head (bd88561).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5062      +/-   ##
===========================================
+ Coverage    93.62%   94.11%   +0.48%     
===========================================
  Files          177      177              
  Lines        22001    21331     -670     
  Branches      3114     3021      -93     
===========================================
- Hits         20599    20075     -524     
+ Misses         947      847     -100     
+ Partials       455      409      -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +48 to +49
transformations:
default: 'transformations'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought adding transformations here would install it as part of CI but I still see it as pypi installed https://github.com/MDAnalysis/mdanalysis/actions/runs/15578157334/job/43867072733?pr=5062#step:7:269

  transformations                   2025.1.1      pypi_0                   pypi    

What should I be doing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got time this weekend, will look into it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to expand, I suspect that there is something deeper with the way in which conda recognises the package. We should check this before making the switch, otherwise we might end up with and rdkit pypi situation, except from a non-optional package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I noticed and maybe is relevant, is that the conda-forge package does not appear to be maintained: the latest packaged version is 2022.9.26.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh...

Do we want to put another orphan package on our shoulders (until we remove transformations in 3.0)?

Or do we want to go back and just vendor the 2025.x code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be as easy as merging a bunch of PRs https://github.com/conda-forge/transformations-feedstock/pulls ... or not ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say it is an orphan packaged, because PyPI is up to date and there has been a 2025 release. So I think the main issue is with the conda-forge feedstock, which we could take over?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @RMeli - the recipe seems rather simple so it might not be too much of a hassle for us to take it on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: when I tried mamba install transformations in my developer env, it tried downgrading numpy. So I am just confirming what you've been saying: the conda-forge version of transformations needs to be updated for us to be useful.


  Package              Version  Build            Channel           Size
─────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────

  + transformations  2022.9.26  py312hc7c0aa3_2  conda-forge       80kB

  Downgrade:
─────────────────────────────────────────────────────────────────────────

  - numpy                2.2.6  py312h72c5963_0  conda-forge     Cached
  + numpy               1.26.4  py312heda63a1_0  conda-forge     Cached

@orbeckst orbeckst requested review from RMeli, IAlibay and ljwoods2 June 11, 2025 15:41
Copy link
Member

@RMeli RMeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @orbeckst, always great to remove so much code without losing functionality.

@orbeckst orbeckst force-pushed the remove-transformations branch from 213310f to 4df6847 Compare June 11, 2025 20:18
Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to put a soft block so that we can work out what's up with the pypi install taking precedence over conda. Just so we don't see another rdkit-style pypi issue.

@orbeckst orbeckst force-pushed the remove-transformations branch from 4df6847 to bd88561 Compare June 11, 2025 20:44
@orbeckst
Copy link
Member Author

orbeckst commented Jun 12, 2025 via email

@IAlibay
Copy link
Member

IAlibay commented Jun 12, 2025

Who would start the process of getting on the cf feedstock recipe?

I have opened an issue on the feedstock, let's see what happens.

@orbeckst
Copy link
Member Author

orbeckst commented Jun 12, 2025 via email

@RMeli
Copy link
Member

RMeli commented Jun 12, 2025

I have opened an issue on the feedstock, let's see what happens.

Thanks @IAlibay! I'd be OK to be added as a maintainer if needed.

@hmacdope
Copy link
Member

While we wait for the transformations people to respond so we can migrate, I have had a crack at updating the numpy C interface for transformations.c to modern NPY C API in #5068 such that things build correctly again.

Seems to be working?

@RMeli
Copy link
Member

RMeli commented Jun 23, 2025

Thanks @hmacdope! Sounds good to me to fix the issue quickly with #5068 while we wait for the conda package to be sorted.

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.

compile failure due to numpy issues in transformations.c
4 participants