Skip to content
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

Discussing possible fusion with pypdfium2-team development fork #195

Open
mara004 opened this issue Dec 18, 2023 · 6 comments
Open

Discussing possible fusion with pypdfium2-team development fork #195

mara004 opened this issue Dec 18, 2023 · 6 comments

Comments

@mara004
Copy link
Contributor

mara004 commented Dec 18, 2023

As you might know already, I've been working on an overhaul of ctypesgen at
https://github.com/pypdfium2-team/ctypesgen/tree/pypdfium2

Here are some resources to get an overview of the design direction I've been going:1
https://github.com/pypdfium2-team/ctypesgen/blob/pypdfium2/README.md
https://github.com/pypdfium2-team/ctypesgen/blob/pypdfium2/docs/CHANGELOG.md#unreleased-v2
pypdfium2-team#1
master...pypdfium2-team:ctypesgen:pypdfium2

I believe the changes contain significant improvements/modernizations from both ctypesgen dev and embedder perspective, including logic corrections / bug fixes (e.g. to common headers / module linking / external preamble), and new features (e.g. symbol filters, style options).
Also I've modernized the test suite, started pathlib and f-string migration, and cleaned up many code passages (e.g. python printer, operations, library loader, preamble).
Particular goals are to value the Keep It Simple principle, relieve ctypesgen of most custom wrappers, stick to plain ctypes as much as possible, and avoid code smell.

If there's a way to find a common ground, it would be great if this development work could eventually (not quite yet) be merged back here to share the same base and avoid fragmentation. Note however that it would not be possible or reasonable to do so without significant backward incompatibility, which is tied to the overhaul, though we could talk about adding a few compat-oriented extensions (e.g. a string helper such as pypdfium2-team#1 (comment)) as long as there's a lean, pollution free way to integrate.

I know I might not be able to actively work on ctypesgen in the somewhat near future, yet I believe this were the more suitable base for future development, and would be glad if the work were not lost or done twice in separate places.
To any future developers, please consider looking through these changes first before starting on the "old" codebase independently.

I just thought I'd open this issue as a sort of bulletin board for discussion, although my availability to reply may be limited.


For some reference, here's also a selection of issues and PRs I committed to:

Feedback / info / ideas

PRs/Patches

Footnotes

  1. Unfortunately the readme/issue may be somewhat outdated/incomplete due to ongoing development, where there isn't really an easy way to keep it all up-to-date without having to spend too much time.

@mara004
Copy link
Contributor Author

mara004 commented Dec 21, 2023

Also an idea: You could divide this repo in two branches: One with our changes, where any future active development shall go to, while still backporting key fixes to the "oldschool" codebase, at least for a migration period.

Basically just what I'm currently doing with a fork and backport PRs such as #193, #189, #191, but fused into a single repo.
We wouldn't need to ditch the legacy codebase altogether if that's too much of a compatibility concern.

@nilason
Copy link
Collaborator

nilason commented Jan 5, 2024

@mara004 I'm terribly sorry for not have had the time to study your work on this, but I'm glad you don't give up!

I'm thinking of make a v1.x release branch after any minor eventual changes to master, to be able to more freely push more experimental code to master (better I think than creating an experimental branch). What is your opinion on this?

@mara004
Copy link
Contributor Author

mara004 commented Jan 5, 2024

Thanks, no worries!

I'm thinking of make a v1.x release branch after any minor eventual changes to master, to be able to more freely push more experimental code to master (better I think than creating an experimental branch). What is your opinion on this?

A v1 branch plus experimental master sounds fine to me.
I don't really mind how, just thought it might be good to keep an ability to push to the previous codebase.

@mara004
Copy link
Contributor Author

mara004 commented Jan 5, 2024

BTW, in case anyone wants to merge our changes at large, the Readme would need to be updated as it talks about the fork, yet it would be good to retain the new info (e.g. tips & tricks section).
Also you might want to restore some tool files which I removed as we don't use/maintain them.

@mara004
Copy link
Contributor Author

mara004 commented Jan 24, 2024

Here's a list of smaller fixes we might want to backport to the v1 codebase:

  • struct __slots__ fix to prevent assignment of invalid fields
  • ability to link relative modules, don't silently ignore import failure, remove bad POINTER override
  • remove variadic functions wrapper, we can simply assign .argtypes (presumably fixes variadics on macOS arm64)
  • handle __attribute__ ((...)) in defines (fixes cdefs.h syntax errors)
  • smarter pre-processor default

I'm not too convinced if we have to do this, though.
Perhaps it might be better to just focus efforts on the new branch and avoid touching v1 unless there's an actual, reasoned demand?
I don't want to end up rewriting too much of the new base...

@mara004
Copy link
Contributor Author

mara004 commented Jan 24, 2024

Three backports done: #205, #206, #207

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

No branches or pull requests

2 participants