molpopgen / fwdpy11

Forward-time simulation in Python using fwdpp
https://molpopgen.github.io/fwdpy11
GNU General Public License v3.0
30 stars 6 forks source link

woes due to attrs #1332

Open molpopgen opened 2 months ago

molpopgen commented 2 months ago

The recent attrs release deprecates repr_ns. We use this feature to facilitate separating the fwdpy11 namespace across multiple Python files. Such separation is NOT really supported by the language, meaning that what we have done is a hack.

1330 pinned attrs to avoid the new release in order to get CI to work.

But we can't live with a ceiling pin like this, so we have to address the deprecation.

Experiments in #1331 show that the only think that breaks by simply removing all use of repr_ns is a little-used feature: recreating Python objects from metadata in tskit tree sequences. There is no effect on recreating mutations, etc.. Rather, recreating thing like ModelParams, which contains other fwdpy11 objects. The issue is that the objects will no longer contain their namespace in their __repr__, resulting in NameError. Maintaining current behavior seems difficult in the best case.

molpopgen commented 2 months ago

The solution is a bit painful! We will have to require that our attrs classes have manual implementations of __repr__.