-
Notifications
You must be signed in to change notification settings - Fork 23
Cython3 migration #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Cython3 migration #200
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0b97ed1
update install instructions
timosachsenberg 5311ec6
Update TODO for current roadmap
timosachsenberg d4d462f
Migrate to Cython 3 only
timosachsenberg e7a0ae7
Remove workflow file changes
timosachsenberg c8cf06e
Merge branch 'master' into cython3-migration
timosachsenberg b6ed04b
Remove MIGRATION_PLAN.MD (#203)
Copilot 9ac153a
Merge branch 'master' into cython3-migration
timosachsenberg ede1c3d
Update CI matrix to remove old Cython versions
poshul afd035a
Remove obsolete Cython version check in test_enums (#206)
Copilot 543b750
Merge branch 'master' into cython3-migration
timosachsenberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,34 @@ | ||
| Activate the project in "development mode" first: | ||
| Development setup | ||
| ================= | ||
|
|
||
| $ python setup.py develop | ||
| The recommended way to work on `autowrap` is to use a virtual environment, | ||
| install the package in editable mode, and run the tests from the project root. | ||
|
|
||
| For testing run | ||
| 1. Create and activate a virtual environment (optional but recommended): | ||
|
|
||
| $ py.test tests | ||
| $ python -m venv .venv | ||
| $ source .venv/bin/activate # on Windows: .venv\Scripts\activate | ||
|
|
||
| 2. Install `autowrap` with development dependencies: | ||
|
|
||
| $ python -m pip install -U pip | ||
| $ python -m pip install -e .[dev] | ||
|
|
||
| (Use `python3` instead of `python` if needed on your system.) | ||
|
|
||
| 3. Run the test suite from the project root: | ||
|
|
||
| $ pytest tests/ -v | ||
|
|
||
| For local coverage, you can also use: | ||
|
|
||
| $ ./run_test_coverage.sh | ||
|
|
||
| 4. Verify the CLI is available: | ||
|
|
||
| $ autowrap --help | ||
|
|
||
| These commands have been verified to work with the current `pyproject.toml` | ||
| configuration and are the preferred starting point for developing on `autowrap`. | ||
|
|
||
| from the projects directory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,36 @@ | ||
| - mehr klassen wrappen | ||
| Autowrap TODO | ||
| ============= | ||
|
|
||
| - attribut zugriff ! ( ->ProteinIdentification::ProteinGroup z.b.) | ||
| - Internal code generator refactor | ||
|
|
||
| - wrap-attach auch für klassen ! | ||
| Consider splitting `CodeGenerator` into smaller, focused classes | ||
| (e.g. for class generation, iterator support, reference handling) | ||
| to improve maintainability and make future extensions easier. | ||
|
|
||
| - codegen refak: | ||
| extra klasse fürs eigentliche codegen. | ||
| ziel: via vererbung auch iteratoren udn ref-zugriffen wrappen | ||
| - Improved iterator support | ||
|
|
||
| - iteratoren und referenzen (siehe ungen) | ||
| Support parameterized iterator ranges (e.g. methods like | ||
| `beginRT(rtmin)` / `endRT(rtmax)` annotated with `wrap-iter-begin` | ||
| / `wrap-iter-end`) and expose them as dedicated Python iterator or | ||
| range methods instead of only supporting parameterless `begin()` / | ||
| `end()`. | ||
|
|
||
| - DPosition(mit numerischen template argument) | ||
| - Reference semantics for methods returning references | ||
|
|
||
| - statische methoden direkt an die klassen hängen, bevor "wrap-inherits" | ||
| aufgelöst wird ! | ||
| For methods that return references to other wrapped objects, explore | ||
| using holder / proxy objects (using the existing | ||
| `AutowrapRefHolder` / `AutowrapPtrHolder` infrastructure) to model | ||
| true reference semantics, rather than always copying values into new | ||
| wrapper instances. The goals are: | ||
|
|
||
| - config extra cimport statments | ||
| - Preserve the lifetime of the referred-to object safely. | ||
| - Allow attribute/method access on the referenced object to affect | ||
| the original C++ object where appropriate. | ||
|
|
||
| - begin(), end() mit param, eg | ||
| beginRT(rtmin) # wrap-iter-begin rtrange | ||
| endRT(rtmax) # wrap-iter-end rtrange | ||
| - Safe wrapping of non-const iterators | ||
|
|
||
| -> methode rtrange(rtmin, rtmax) | ||
|
|
||
| - neu: ClassGenerator (zum code erzeugen), | ||
| RefProxyClassGenerator, IterProxyClassGenerator | ||
|
|
||
| ideen: | ||
|
|
||
| 1) wenn methode M von X eine Ref auf Y zurückgibt: | ||
|
|
||
| idee: reference holder objekt als pointer sollte mit cython | ||
| (cython schiebt variable dekl im c++ code nach vorne, z.b | ||
| T & x; | ||
| was so nicht geht, da referenz ja initalisierte werdne muss | ||
| statt desen: | ||
| holder[T] * X; | ||
|
|
||
| und später: | ||
|
|
||
| X.setReference(wrapped.inst.method_which_returns_ref(..)) | ||
|
|
||
| als holder im wrappeb object. | ||
| original objekt als shared_ptr mitspeichern damit die gespeicherte | ||
| refernz (hoffentlich) erhalten bleibt. | ||
|
|
||
| ----------- | ||
|
|
||
| - alle wrapped objekte haben shared_ptr | ||
| - methode M returns Proxy mit shared_ptr to X und name von M | ||
| - proxy wrapped methoden von R durch impliziten aufruf der methode M | ||
|
|
||
| der einfach heit halber: proxy objekt hat keine methoden die | ||
| referenzen auf zu wrappende objekte zurückliefern | ||
| ansonsten: --- chaining !? | ||
|
|
||
|
|
||
| 2) sicheres wrappen von non const iteratoren: | ||
|
|
||
| - iterobject speichert shared_ptr auf das orignal objekt | ||
|
|
||
| - iterobject speicher iterator selbst, damit kann man | ||
| methoden des referenzierten objekts deim iterobjekt anhängen | ||
| und so bleiben inplace modifiationen erhalten | ||
| Investigate iterator wrappers that store both a reference to the | ||
| original container and the iterator state, so that in-place | ||
| modifications through iterator access are reflected in the | ||
| underlying C++ container (instead of always iterating over copies). | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from Cython.Compiler.Version import version as cython_version | ||
|
|
||
|
|
||
| def test_cython_major_version_at_least_3() -> None: | ||
| major_str = str(cython_version).split(".")[0] | ||
| assert int(major_str) >= 3 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "A.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "B.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "C.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "Cycle0.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "Cycle1.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "Cycle2.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
|
|
||
| cdef extern from "D.h": | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # cython: language_level=2 | ||
| # cython: language_level=3 | ||
| cdef extern from "abc.hpp": | ||
|
|
||
| cdef cppclass Base[X]: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.