Skip to content

Conversation

@wtbarnes
Copy link
Owner

@wtbarnes wtbarnes commented Jan 5, 2026

This bumps the minimum supported Python version to 3.12 in accordance with SPEC0 and adds testing for Python 3.14.

To support Python 3.14, this PR also gets rid of the dependency on the mendeleev package which was previously being used to compute the period of a given element. The reasoning for getting rid of this dependency was twofold: 1. mendeleev was not compatible with Python 3.14 and 2. the function used for looking up the period was considerably slower than this simple implementation. In the end, it didn't make sense to pick up this dependency when only a very small part of the package was being used.

This PR makes two API changes: a function in fiasco.util.periodic_table_period which computes the period for a given element and a new property period on Ion that provides the period of the element of that ion.

@wtbarnes wtbarnes changed the title Bump minimum Python version to 3.12, test on 3.14 Bump minimum Python version to 3.12, add ability to calculate periodic table period Jan 5, 2026
@wtbarnes wtbarnes marked this pull request as draft January 6, 2026 04:48
@wtbarnes
Copy link
Owner Author

wtbarnes commented Jan 6, 2026

It seems as though something has changed from Python 3.13 to 3.14 that causes the contribution function comparison tests to fail for a few of the example ions.

Looking a little more closely at Fe IX 171.073 Å, it seems this is due to differences in the level populations calculation. As an example, here is the level population as a function of temperature for that transition at a constant density of $10^{10}$ $\mathrm{cm}^{-3}$ as calculated using Python 3.13

image

and here is the same calculation done using Python 3.14

image

I do not yet know why these are different or why these would only yield such drastically different results for only a few transntions.

These failures seem to persist across all supported versions of the database for Fe IX 171.073 and 188.496. In v10 and v11, the Ca XV 200.972 test also fails.

@wtbarnes wtbarnes marked this pull request as ready for review January 6, 2026 18:51
@wtbarnes
Copy link
Owner Author

wtbarnes commented Jan 6, 2026

This was a "fun" exercise. It turns out that, for whatever reason, in Python 3.14, applying an in-place operation to a matrix in which I'm also applying an operation to the indices also applies an in-place operation to those indices, e.g. if A is a matrix and i,j are indices,

A[i-1,j-1] += 10

will also modify i and j in place. Why this happens in 3.14 and not previous versions of Python I do not know.

Weirdly, I don't seem to be able to reproduce this in any simple way. It could be due to how I'm returning the indices being used from the database.

@wtbarnes wtbarnes merged commit ad5ef0a into main Jan 6, 2026
16 checks passed
@wtbarnes wtbarnes deleted the bumpy-python-version branch January 6, 2026 20:17
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.

2 participants