Skip to content

Conversation

@benjeffery
Copy link
Member

@benjeffery benjeffery commented Jun 6, 2025

Fixes #1124
Fixes #1018

@benjeffery
Copy link
Member Author

Mostly cribbed from https://github.com/terhorst/tskit_cython_example with a few modernisations and using the local tskit.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.62%. Comparing base (ef025a0) to head (a89df54).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3194   +/-   ##
=======================================
  Coverage   89.62%   89.62%           
=======================================
  Files          28       28           
  Lines       31969    31969           
  Branches     5873     5873           
=======================================
  Hits        28653    28653           
  Misses       1886     1886           
  Partials     1430     1430           
Flag Coverage Δ
c-tests 86.66% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 88.18% <ø> (ø)
python-tests 98.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Spotted a few things

lwtc = LightweightTableCollection()
lwtc.fromdict(pyts.dump_tables().asdict())
cdef tsk_treeseq_t ts
cdef int err = tsk_table_collection_build_index(lwtc.tables, 0) # this recently became necessary?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to build an index if we're getting a TreeSequence in as parameter? The indexes should be there already

check_tsk_error(ret)

print("Iterate forwards")
cdef int iter = tsk_tree_first(&tree)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iter might not be a great name, seems to hav some meaning in cytyhon?

check_tsk_error(iter)

print("Iterate backwards")
iter = tsk = tsk_tree_last(&tree)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here?

@benjeffery
Copy link
Member Author

Thanks - fixed up!

@jeromekelleher jeromekelleher added this pull request to the merge queue Jun 8, 2025
Merged via the queue into tskit-dev:main with commit 8137458 Jun 8, 2025
15 of 19 checks passed
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.

Cythonized example of LWT interface Add a cython example of using the LWT interface

2 participants