Skip to content

Ready for 2026.2.0 PyPI/GitHub release #121

Closed

Description

@cadenmyers13

PyPI/GitHub rc-release preparation checklist:

  • All PRs/issues attached to the release are merged.
  • All the badges on the README are passing.
  • License information is verified as correct. If you are unsure, please comment below.
  • Locally rendered documentation contains all appropriate pages, tutorials, and other human-written text is up-to-date with any changes in the code.
  • All API references are included. To check this, run conda install scikit-package and then package build api-doc. Review any edits made by rerendering the docs locally.
  • Installation instructions in the README, documentation, and the website are updated.
  • Successfully run any tutorial examples or do functional testing with the latest Python version.
  • Grammar and writing quality are checked (no typos).
  • Install pip install build twine, run python -m build and twine check dist/* to ensure that the package can be built and is correctly formatted for PyPI release.
  • Dispatch matrix testing to test the release on all Python versions and systems. If you do not have permission to run this workflow, tag the maintainer and say @maintainer, please dispatch matrix testing workflow.

Please tag the maintainer (e.g., @username) in the comment here when you are ready for the PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here:

PyPI/GitHub full-release preparation checklist:

  • Create a new conda environment and install the rc from PyPI (pip install <package-name>==??)
  • License information on PyPI is correct.
  • Docs are deployed successfully to https://<github-username-or-orgname>/<package-name>.
  • Successfully run all tests, tutorial examples or do functional testing.

Please let the maintainer know that all checks are done and the package is ready for full release.

conda-forge release preparation checklist:

  • Ensure that the full release has appeared on PyPI successfully.
  • New package dependencies listed in conda.txt and tests.txt are added to meta.yaml in the feedstock.
  • Close any open issues on the feedstock. Reach out to the maintainer if you have questions.
  • Tag the maintainer for conda-forge release.

Post-release checklist

  • Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments.
  • Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures.

Activity

  1. cadenmyers13 commented on Nov 2, 2026

    @cadenmyers13
    ContributorAuthor

    Hi @vincefn ! Our new package diffpy.cmirietveld depends on pyobjcryst's features that have not been released yet. We would like to push out a release. Are there any features/updates you would like to add to the release? Also, let me know if I've handled the version syntax correctly. Maybe it should be 2026.2.0.

  2. vincefn commented on Nov 2, 2026

    @vincefn
    Collaborator

    Maybe have a look at #101 - if you can validate the nanobind version at the same time, it would be great (then it should be 2026.2.0 indeed). Maybe you can test this cmirietveld with that branch.

  3. sbillinge commented on Nov 3, 2026

    @sbillinge
    Contributor

    Let's push out a 2026.2.0-rc0and test everything. @vincefn is the nanobind work that needs to better all merged into main?

  4. changed the title [-]Ready for 2026.1.1 PyPI/GitHub release[/-] [+]Ready for 2026.2.0 PyPI/GitHub release[/+] on Nov 3, 2026
  5. cadenmyers13 commented on Nov 3, 2026

    @cadenmyers13
    ContributorAuthor

    Maybe have a look at #101 - if you can validate the nanobind version at the same time, it would be great (then it should be 2026.2.0 indeed). Maybe you can test this cmirietveld with that branch.

    @SYMSCAE Are you able to help with this?

  6. sbillinge commented on Nov 15, 2026

    @sbillinge
    Contributor

    @vincefn @cadenmyers13 @clemisch the CI build failed on the 2026.2.0-rc.0 macos-15-intel build. I think we will drop this shortly as they will stop having this runner, but it serves our users with legacy macs until it goes away. We could either try and figure this out, or drop it from the current build. I don't mind either way tbh. The legacy users will have access to everything up to 2026.1.0 which has a python 3.14 build, so it will be around for ages to come. What are your thoughts?

  7. sbillinge commented on Nov 15, 2026

    @sbillinge
    Contributor

    btw, for the record, it 2026.2.0-rc.0 built successfully on linux, windows and macos-latest

  8. vincefn commented on Nov 16, 2026

    @vincefn
    Collaborator

    Strange failure, nothing specific to the arch. I don't understand how the mismatch ReflectionProfilePseudoVoigtAnisotropic ReflectionProfilePseudoVoigt can actually happen given the code...
    Though indeed macos intel is effectively obsolete.. I'll re-run the job 🤞

  9. vincefn commented on Nov 16, 2026

    @vincefn
    Collaborator

    Ah, when re-running, the macos/intel build+test passes, but the wheel test fails for ubuntu/py3.15 and macos/3.13 and 3.15, for the same test.
    So I guess we'll have to figure this one out...

  10. vincefn commented on Nov 16, 2026

    @vincefn
    Collaborator

    Ok, this seems to be real and needs to be corrected - here is claude's analysis:

    Failure in the 2026.2.0-rc.0 build run

    The failed jobs all fail on the same test, and it fails only intermittently:

    • the cibw-wheels-macos-15-intel build (attempt 1, py3.14); the rerun passed
    • test-wheels-3.15-ubuntu-latest, test-wheels-3.15-macos-15-intel, test-wheels-3.13-macos-15-intel
    FAILED tests/test_reflectionprofile.py::TestReflectionProfile::test_set_profile_copies_reusable_template
    AssertionError: <ReflectionProfilePseudoVoigt ...> is not an instance of <class 'ReflectionProfilePseudoVoigtAnisotropic'>
    

    Root cause: nanobind reuses a stale wrapper after C++ frees the object

    1. setUp holds self.profile = self.ppd.GetProfile(), a wrapper for the phase's default ReflectionProfilePseudoVoigt.
    2. ppd.SetProfile(template) → ObjCryst PowderPatternDiffraction::SetProfile runs delete mpReflectionProfile. self.profile now dangles, but nanobind still has it registered in its instance map under that address.
    3. second.SetProfile(template) → the new copy may be allocated at the freed address.
    4. second.GetProfile() → nanobind 3.1.0 nb_type_put finds an existing instance at that address. Its type is a subclass of the requested static type (ReflectionProfile), so nanobind returns the stale PseudoVoigt wrapper.

    Whether the address gets reused depends on heap state, so the result varies between runs and between Python/arch combinations. Boost.Python created a new wrapper on each call, so it did not have this aliasing. The dangling pointer itself was already there.

    Reproduced locally with the rc0 wheels (arm64 and x86_64)

    • The test's exact steps repeated 300×: wrong type returned 4/300 times.
    • Single-phase GetProfile()/SetProfile() loop while keeping the old wrappers: a stale wrapper was returned 1990/2000 times. Same type, so there is no error, but the result is silently wrong and uses freed memory.

    This is a general problem: C++ deletes an object that Python still references

    • The Remove* bindings avoid it by passing del=false, which leaks the object but never frees it: RemoveScatterer/RemoveScatteringPower (nb_crystal.cpp), Molecule.RemoveAtom/Bond/BondAngle/DihedralAngle (nb_molecule.cpp).
    • Paths with the same problem:

    Fix direction (in the bindings, not per-method upstream patches)

    • Audit every Python-reachable C++ call that frees objects.
    • Never free an object Python may still reference. Either keep it alive (like del=false), or, if a wrapper exists (nb::find), transfer ownership to that wrapper. Single-call alternative: an ObjCryst SetProfile(p, del) or a "release" API.
    • Add regression tests: hold a wrapper, replace or remove the C++ object, then check that the identity and type returned afterwards are correct.
  11. sbillinge commented on Nov 16, 2026

    @sbillinge
    Contributor

    Thanks @vincefn. I guess this may affect other variables too, so let's do a careful inventory, along the lines that Claude suggests. @SYMSCAE or @clemisch are you able to look at this?

  12. vincefn commented on Nov 16, 2026

    @vincefn
    Collaborator

    Yes, this is the tip of the iceberg for the lack of proper joint c++/python ownership management. Something already present in boost, but different wrapper management just hid this with some minor leaks.
    A completely proper fix would use a common c++/python reference counting and associated gc.

  13. SYMSCAE commented on Nov 16, 2026

    @SYMSCAE
    Contributor

    It seems the more optimal way is to modify objcryst and pass shared_ptr across the language boundary. Or we can simply pass a independent copy for GetProfile instead? That will change behaviour though.

  14. vincefn commented on Nov 16, 2026

    @vincefn
    Collaborator

    I'm working on modifying objcryst and fixing this. 4 hour train in China..
    Seems completely tackling this with proper reference counting would be a little more tricky, so this will have to be done later.

  15. added a commit that references this issue on Nov 22, 2026
    c4d4436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions