single-cell-data / TileDB-SOMA

Python and R SOMA APIs using TileDB’s cloud-native format. Ideal for single-cell data at any scale.
https://tiledbsoma.readthedocs.io
MIT License
90 stars 25 forks source link

[python] Python 3.12 support #3001

Open johnkerl opened 1 month ago

johnkerl commented 1 month ago

For issue #1849 -- which has a long history.

See also #2999 and [sc-53002].

This needs https://github.com/single-cell-data/SOMA/pull/222

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.65%. Comparing base (4e3b70f) to head (8c5f857). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3001 +/- ## ========================================== + Coverage 83.54% 83.65% +0.11% ========================================== Files 51 51 Lines 5434 5434 ========================================== + Hits 4540 4546 +6 + Misses 894 888 -6 ``` | [Flag](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/3001/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | Coverage Δ | | |---|---|---| | [python](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/3001/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `83.65% <ø> (+0.11%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/3001/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | Coverage Δ | | |---|---|---| | [python_api](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/3001/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `83.65% <ø> (+0.11%)` | :arrow_up: | | [libtiledbsoma](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/3001/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `∅ <ø> (∅)` | |
thetorpedodog commented 1 month ago

From the build log:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/__w/TileDB-SOMA/TileDB-SOMA/venv-soma/lib/python3.10/site-packages/tiledbsoma/__init__.py", line 103, in <module>
    from ._collection import Collection
  File "/__w/TileDB-SOMA/TileDB-SOMA/venv-soma/lib/python3.10/site-packages/tiledbsoma/_collection.py", line 3[7](https://github.com/single-cell-data/TileDB-SOMA/actions/runs/10895777089/job/30234556256#step:18:8), in <module>
    from ._dataframe import DataFrame
  File "/__w/TileDB-SOMA/TileDB-SOMA/venv-soma/lib/python3.10/site-packages/tiledbsoma/_dataframe.py", line 17, in <module>
    from tiledbsoma import _new_shape_feature_flag_enabled
ImportError: cannot import name '_new_shape_feature_flag_enabled' from partially initialized module 'tiledbsoma' (most likely due to a circular import) (/__w/TileDB-SOMA/TileDB-SOMA/venv-soma/lib/python3.[10](https://github.com/single-cell-data/TileDB-SOMA/actions/runs/10895777089/job/30234556256#step:18:11)/site-packages/tiledbsoma/__init__.py)

This is because at the point this line is executed, the symbol _new_shape_feature_flag_enabled is not yet available. The line

https://github.com/single-cell-data/TileDB-SOMA/blob/a96c72d0854e535a79063562391498a77dbcead4/apis/python/src/tiledbsoma/__init__.py#L138

needs to be moved above all the imports. (Alternately, it might make sense to create a tiledbsoma._flags module so that there’s no circular dependency between submodules and the tiledbsoma/__init__.py file.

johnkerl commented 1 month ago

needs to be moved above all the imports

@thetorpedodog thank you!!! I got some 'new style lint' here -- I don't know why, I didn't change any linter versions -- and was forced to move imports :(

There's something weird to debug here -- I'll see if I can make everything in the CI toolchain happy simultaneously -- thank you!!!

Also I'll try the _flags module idea -- this sounds promising -- thank you! :)

johnkerl commented 1 month ago

@thetorpedodog

And re

There's something weird to debug here -- I'll see if I can make everything in the CI toolchain happy simultaneously -- thank you!!!

I have traced that to here:

https://github.com/single-cell-data/TileDB-SOMA/pull/3004/files#r1763424424

iosonofabio commented 3 weeks ago

Hi guys, thanks for your amazing package.

I understand this is in flux as we write - as a power user I would kindly like to ask if there's anything I can do to help push this through - I really need it and workarounds are a decent pain.

(As I understand, now there is a buggy typechecker stalling CI stalling 3.12 adoption, which itself was released 12 months ago. If inaccurate feel free to correct)

johnkerl commented 3 weeks ago

@iosonofabio thank you! Your assessment is correct -- current status is here: https://github.com/single-cell-data/TileDB-SOMA/issues/1849#issuecomment-2358420564 and @ryan-williams will be moving this forward