Repository: tskit-dev/msprime (language: python)

Issue:
Update to tskit C 1.0
Should be fairly straightforward.


Discussion / hints:

Fix patch:
diff --git a/git-submodules/tskit b/git-submodules/tskit
index ee5fdb3c9..76b658163 160000
--- a/git-submodules/tskit
+++ b/git-submodules/tskit
@@ -1,1 +1,1 @@
-Subproject commit ee5fdb3c9c8f52f7aa6c1de3a9689606583138e6
+Subproject commit 76b658163101c2d4c82843665e521e139b74d738
diff --git a/lib/dev-tools/dev-cli.c b/lib/dev-tools/dev-cli.c
index bc2542b09..2aa621c51 100644
--- a/lib/dev-tools/dev-cli.c
+++ b/lib/dev-tools/dev-cli.c
@@ -830,7 +830,7 @@ run_simulate(
         if (ret != 0) {
             fatal_msprime_error(ret, __LINE__);
         }
-        ret = tsk_treeseq_init(&tree_seq, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&tree_seq, &tables, TSK_TS_INIT_BUILD_INDEXES);
         if (ret != 0) {
             fatal_tskit_error(ret, __LINE__);
         }
diff --git a/lib/msprime.c b/lib/msprime.c
index 613e2a8c1..c491b6029 100644
--- a/lib/msprime.c
+++ b/lib/msprime.c
@@ -3446,7 +3446,7 @@ msp_process_input_trees(msp_t *self)
     memset(&ts, 0, sizeof(ts));
     memset(&tree, 0, sizeof(tree));
 
-    ret = tsk_treeseq_init(&ts, self->tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, self->tables, TSK_TS_INIT_BUILD_INDEXES);
     if (ret != 0) {
         ret = msp_set_tsk_error(ret);
         goto out;
@@ -7178,7 +7178,7 @@ msp_set_simulation_model_fixed_pedigree(msp_t *self)
     const tsk_size_t num_nodes = self->tables->nodes.num_rows;
     pedigree_t *pedigree = &self->pedigree;
 
-    ret = tsk_treeseq_init(&ts, self->tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, self->tables, TSK_TS_INIT_BUILD_INDEXES);
     if (ret != 0) {
         ret = msp_set_tsk_error(ret);
         goto out;
diff --git a/lib/subprojects/tskit.wrap b/lib/subprojects/tskit.wrap
index 454fa26b2..777b1874a 100644
--- a/lib/subprojects/tskit.wrap
+++ b/lib/subprojects/tskit.wrap
@@ -1,6 +1,6 @@
 [wrap-file]
-directory = tskit-0.99.15
+directory = tskit-1.0.0
 
-source_url = https://github.com/tskit-dev/tskit/releases/download/C_0.99.15/tskit-0.99.15.tar.xz
-source_filename = tskit-0.99.15.tar.xz
-source_hash = 83c38e78c1f508cfae9096d89b46421f58b63e1ca71cc1e5c6f981552f33ef87
+source_url = https://github.com/tskit-dev/tskit/releases/download/C_1.0.0/tskit-1.0.0.tar.xz
+source_filename = tskit-1.0.0.tar.xz
+source_hash = f8a085fc6ef170706b76a307e18be4ab425f31a1f50fa9765ab2c2d81eef65c2
diff --git a/msprime/_msprimemodule.c b/msprime/_msprimemodule.c
index 13e0d5aaf..b32d474bb 100644
--- a/msprime/_msprimemodule.c
+++ b/msprime/_msprimemodule.c
@@ -3189,7 +3189,7 @@ msprime_log_likelihood_arg(PyObject *self, PyObject *args, PyObject *kwds)
 
     /* Note: this will be inefficient here if we're building indexes for large
      * tables. */
-    err = tsk_treeseq_init(&ts, tables->tables, TSK_BUILD_INDEXES);
+    err = tsk_treeseq_init(&ts, tables->tables, TSK_TS_INIT_BUILD_INDEXES);
     if (err != 0) {
         handle_tskit_library_error(err);
         goto out;
diff --git a/requirements/CI-complete/requirements.txt b/requirements/CI-complete/requirements.txt
index ebd87c269..e4c70ea19 100644
--- a/requirements/CI-complete/requirements.txt
+++ b/requirements/CI-complete/requirements.txt
@@ -14,4 +14,4 @@ jsonschema<4.0
 python_jsonschema_objects==0.4.1
 scipy==1.7.3
 stdpopsim==0.1.2
-tskit==0.4.0
+tskit==0.5.0


Test patch:
diff --git a/lib/tests/test_ancestry.c b/lib/tests/test_ancestry.c
index 071598933..dd2e2fc56 100644
--- a/lib/tests/test_ancestry.c
+++ b/lib/tests/test_ancestry.c
@@ -1219,7 +1219,7 @@ test_mixed_hudson_dtwf(void)
     ret = msp_finalise_tables(&msp);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
     tsk_treeseq_print_state(&ts, _devnull);
     tsk_treeseq_free(&ts);
@@ -1285,7 +1285,7 @@ test_mixed_hudson_smc(void)
     ret = msp_finalise_tables(&msp);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
     tsk_treeseq_print_state(&ts, _devnull);
     tsk_treeseq_free(&ts);
@@ -1357,7 +1357,7 @@ run_gc_simulation(double sequence_length, double gc_rate, double tract_length,
     msp_free(&msp);
 
     /* Make sure we can build a tree sequence out of the result */
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
     tsk_treeseq_free(&ts);
 
@@ -2852,7 +2852,7 @@ test_simulation_replicates(void)
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         ret = mutgen_generate(&mutgen, 0);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
-        ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         tsk_treeseq_print_state(&ts, _devnull);
         mutgen_print_state(&mutgen, _devnull);
@@ -3052,7 +3052,7 @@ verify_simulate_from(int model, rate_map_t *recomb_map,
         CU_ASSERT_TRUE(msp_is_completed(&msp));
         ret = msp_finalise_tables(&msp);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
-        ret = tsk_treeseq_init(&final, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&final, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
 
         ret = tsk_tree_init(&tree, &final, 0);
diff --git a/lib/tests/test_core.c b/lib/tests/test_core.c
index ac0747e87..06239bf66 100644
--- a/lib/tests/test_core.c
+++ b/lib/tests/test_core.c
@@ -125,9 +125,9 @@ static void
 test_tskit_version(void)
 {
     /* Make sure we don't have any accidental changes to the tskit submodule. */
-    CU_ASSERT_EQUAL(TSK_VERSION_MAJOR, 0);
-    CU_ASSERT_EQUAL(TSK_VERSION_MINOR, 99);
-    CU_ASSERT_EQUAL(TSK_VERSION_PATCH, 15);
+    CU_ASSERT_EQUAL(TSK_VERSION_MAJOR, 1);
+    CU_ASSERT_EQUAL(TSK_VERSION_MINOR, 0);
+    CU_ASSERT_EQUAL(TSK_VERSION_PATCH, 0);
 }
 
 static void
diff --git a/lib/tests/test_likelihood.c b/lib/tests/test_likelihood.c
index ca853be49..7a08e8945 100644
--- a/lib/tests/test_likelihood.c
+++ b/lib/tests/test_likelihood.c
@@ -53,7 +53,7 @@ test_likelihood_errors(void)
     ret = tsk_mutation_table_add_row(
         &tables.mutations, 0, 1, -1, TSK_UNKNOWN_TIME, "C", 1, NULL, 0);
     CU_ASSERT_FATAL(ret >= 0);
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     /* Ne <= 0 is an error */
@@ -91,7 +91,7 @@ test_likelihood_zero_edges(void)
         &tables.nodes, TSK_NODE_IS_SAMPLE, 0.0, TSK_NULL, TSK_NULL, NULL, 0);
     CU_ASSERT_FATAL(ret >= 0);
 
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     /* Zero edges should give a likelihood of zero */
@@ -115,7 +115,7 @@ test_likelihood_zero_edges(void)
     ret = tsk_mutation_table_add_row(
         &tables.mutations, 0, 0, -1, TSK_UNKNOWN_TIME, "C", 1, NULL, 0);
     CU_ASSERT_FATAL(ret >= 0);
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     /* Zero edges should give a likelihood of zero */
@@ -225,7 +225,7 @@ test_likelihood_three_leaves(void)
 
     tsk_population_table_add_row(&tables.populations, NULL, 0);
 
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     for (i = 0; i < 3; i++) {
@@ -330,7 +330,7 @@ test_likelihood_two_mrcas(void)
 
     tsk_population_table_add_row(&tables.populations, NULL, 0);
 
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     for (i = 0; i < 3; i++) {
@@ -440,7 +440,7 @@ test_likelihood_material_overhang(void)
     CU_ASSERT_FATAL(ret >= 0);
 
     tsk_population_table_add_row(&tables.populations, NULL, 0);
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     for (i = 0; i < 3; i++) {
@@ -564,7 +564,7 @@ test_likelihood_material_gap(void)
     CU_ASSERT_FATAL(ret >= 0);
 
     tsk_population_table_add_row(&tables.populations, NULL, 0);
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     for (i = 0; i < 3; i++) {
@@ -698,7 +698,7 @@ test_likelihood_recombination_in_material_gap(void)
     CU_ASSERT_FATAL(ret >= 0);
 
     tsk_population_table_add_row(&tables.populations, NULL, 0);
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
     for (i = 0; i < 3; i++) {
diff --git a/lib/tests/test_pedigrees.c b/lib/tests/test_pedigrees.c
index b40614e27..d188c77e3 100644
--- a/lib/tests/test_pedigrees.c
+++ b/lib/tests/test_pedigrees.c
@@ -87,7 +87,7 @@ verify_complete_pedigree_simulation(
     ret = msp_finalise_tables(&msp);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
 
-    ret = tsk_treeseq_init(&ts, &tables_copy, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables_copy, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
     ret = tsk_tree_init(&tree, &ts, 0);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
@@ -150,7 +150,7 @@ verify_pedigree(double recombination_rate, unsigned long seed,
     verify_complete_pedigree_simulation(&tables, recombination_rate);
 
     /* Is this a valid tree sequence? */
-    ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+    ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
     CU_ASSERT_EQUAL_FATAL(ret, 0);
     /* tsk_table_collection_print_state(&tables, stdout); */
 
@@ -439,7 +439,7 @@ test_replicates(void)
         CU_ASSERT_EQUAL(ret, MSP_EXIT_MODEL_COMPLETE);
         msp_verify(&msp, 0);
 
-        ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         ret = tsk_tree_init(&tree, &ts, 0);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
@@ -501,7 +501,7 @@ test_replicates_ancient_samples(void)
         ret = msp_finalise_tables(&msp);
         CU_ASSERT_EQUAL(ret, 0);
 
-        ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         ret = tsk_tree_init(&tree, &ts, 0);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
@@ -563,7 +563,7 @@ test_replicates_early_exit(void)
             CU_ASSERT_EQUAL(total_offspring, 50);
         }
 
-        ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         ret = tsk_tree_init(&tree, &ts, 0);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
@@ -609,7 +609,7 @@ test_replicates_exit_coalescence(void)
         CU_ASSERT_EQUAL(ret, MSP_EXIT_COALESCENCE);
         msp_print_state(&msp, _devnull);
 
-        ret = tsk_treeseq_init(&ts, &tables, TSK_BUILD_INDEXES);
+        ret = tsk_treeseq_init(&ts, &tables, TSK_TS_INIT_BUILD_INDEXES);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
         ret = tsk_tree_init(&tree, &ts, 0);
         CU_ASSERT_EQUAL_FATAL(ret, 0);
diff --git a/requirements/CI-tests-conda/requirements.txt b/requirements/CI-tests-conda/requirements.txt
index 64c5c3293..9328e3320 100644
--- a/requirements/CI-tests-conda/requirements.txt
+++ b/requirements/CI-tests-conda/requirements.txt
@@ -3,6 +3,6 @@
 # but demes will pull in the latest so we pin here.
 jsonschema<4.0
 gsl
-tskit==0.4.0
+tskit==0.5.0
 stdpopsim==0.1.2
 demes==0.2.1
diff --git a/requirements/CI-tests-pip/requirements.txt b/requirements/CI-tests-pip/requirements.txt
index 6f8009a28..16133e0cc 100644
--- a/requirements/CI-tests-pip/requirements.txt
+++ b/requirements/CI-tests-pip/requirements.txt
@@ -9,4 +9,4 @@ pytest-xdist==2.4.0
 jsonschema<5.0
 python_jsonschema_objects==0.4.1
 scipy==1.7.3
-tskit==0.4.0
+tskit==0.5.0
diff --git a/tests/test_lowlevel.py b/tests/test_lowlevel.py
index 4aa110870..ff620293c 100644
--- a/tests/test_lowlevel.py
+++ b/tests/test_lowlevel.py
@@ -440,7 +440,7 @@ def test_gsl_error_handler(self):
     def test_tsk_library_version(self):
         tsk_version = _msprime.get_tskit_c_version()
         # Update this when the tskit C library version changes
-        assert tsk_version == (0, 99, 15)
+        assert tsk_version == (1, 0, 0)
 
 
 def get_random_population_models(n):