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

C library #80

Closed
Koeng101 opened this issue Aug 5, 2024 · 3 comments
Closed

C library #80

Koeng101 opened this issue Aug 5, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Koeng101
Copy link
Owner

Koeng101 commented Aug 5, 2024

https://github.com/vladimirvivien/go-cshared-examples

I think it is important that dnadesign is usable with C. This is primarily so it can be embedded into a python package for use with AI systems. Systems where performance is really important can still be C - but it would be very nice to have basic functions for unique features to be callable from Python!

This should start fairly simple, but expand from there.

@Koeng101 Koeng101 added the enhancement New feature or request label Aug 5, 2024
@Koeng101
Copy link
Owner Author

Koeng101 commented Aug 5, 2024

This will probably be with cffi, because of the support for using specifically the C ABI.

@Koeng101
Copy link
Owner Author

Koeng101 commented Aug 8, 2024

https://github.com/go-python/gopy this looks very promising

@Koeng101
Copy link
Owner Author

Koeng101 commented Aug 8, 2024

looks like it has a difficult time with channels and multiple returns:

ignoring python incompatible method: bio.func (*github.com/koeng101/dnadesign/lib/bio.Parser[github.com/koeng101/dnadesign/lib/bio/fasta.Record, github.com/koeng101/dnadesign/lib/bio/fasta.Header]).ParseToChannel(ctx context.Context, channel chan<- github.com/koeng101/dnadesign/lib/bio/fasta.Record, keepChannelOpen bool) error: func(ctx context.Context, channel chan<- github.com/koeng101/dnadesign/lib/bio/fasta.Record, keepChannelOpen bool) error: gopy: type is channel type
ignoring python incompatible method: bio.func (*github.com/koeng101/dnadesign/lib/bio.Parser[github.com/koeng101/dnadesign/lib/bio/fastq.Read, github.com/koeng101/dnadesign/lib/bio/fastq.Header]).ParseWithHeader() ([]github.com/koeng101/dnadesign/lib/bio/fastq.Read, github.com/koeng101/dnadesign/lib/bio/fastq.Header, error): func() ([]github.com/koeng101/dnadesign/lib/bio/fastq.Read, github.com/koeng101/dnadesign/lib/bio/fastq.Header, error): gopy: too many results to return: func() ([]github.com/koeng101/dnadesign/lib/bio/fastq.Read, github.com/koeng101/dnadesign/lib/bio/fastq.Header, error)

I think the play will be to write a completely separate package that just imports everything and makes nicely compatible C functions that can alternatively be compiled with vanilla -buildmode=c-shared, or with gopy.

@Koeng101 Koeng101 mentioned this issue Aug 8, 2024
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant