Msprime: Remove tskit compatability layer?

Created on 6 May 2020  路  5Comments  路  Source: tskit-dev/msprime

To avoid breaking people's code while we split msprime from tskit, we have a compatibility shim in __init__.py which imports tskit classes into the msprime namespace. So, for people who used things like msprime.TableCollection their code would still work.

For 1.0, we need to decide whether we keep supporting this or not. The pros for removing are, we'll need to do it at some point, and if we don't do it at 1.0, then when can we do it? The break from tskit was at version 0.7.

The cons are that we will break some code that's out there. I don't think there's a lot of code out there that uses msprime.TableCollection etc though, so I'd be surprised if it broke much.

990 removed all dependence on old classes like msprime.TableCollection, etc from the test suite.

All 5 comments

Usual thing to do here is throw out a warning for a couple of releases, saying when the deprecated stuff will be removed.

Hmm - how would you warn if people use these things though? We're just importing, .e.g., tskit.TreeSequence and putting it into the msprime namespace. I don't see how we could warn when people use them, without having something convoluted. I don't want to just spam people with warning that (almost certainly) isn't relevant to them at import time.

Agreed that only should warn on usage. You can do that by setting a custom __getattr__on the module. Happy to do this.

Cool, that would be be great.

This would be a good one to clear up once tskit 0.3.0 is shipped @benjeffery, and the APIs are fresh in our heads.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

petrelharp picture petrelharp  路  4Comments

jeromekelleher picture jeromekelleher  路  8Comments

eldonb picture eldonb  路  5Comments

jeromekelleher picture jeromekelleher  路  7Comments

jeromekelleher picture jeromekelleher  路  11Comments