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

Small updates to enable Cython 3 #1145

Merged
merged 3 commits into from
Oct 28, 2023
Merged

Small updates to enable Cython 3 #1145

merged 3 commits into from
Oct 28, 2023

Conversation

hmaarrfk
Copy link
Contributor

Mostly it seems that cython wants you to declare things as noexcept

Closes #1140

I'm going to see if I can report the bug to cython, but it is hard for me to create a minimum reproducible example

Mostly it seems that cython wants you to declare things as `noexcept`

Closes PyAV-Org#1140

I'm going to see if I can report the bug to cython, but it is hard for
me to create a minimum reproducible example
@hmaarrfk
Copy link
Contributor Author

Tested locally and cython 0.29.36 and it seems to compile and function just as well.

Comment on lines 52 to 53
# Cython 3 seems to have trouble with cdef tuples, so we use a list
# it complains about some const identifier not being able to get assigned
Copy link

Choose a reason for hiding this comment

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

FWIW, this issue was fixed in Cython 3.0.1, so this workaround can probably be removed.

Copy link
Member

Choose a reason for hiding this comment

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

If this isn't needed can we prune it please?

@moi90
Copy link
Contributor

moi90 commented Sep 3, 2023

It works for me locally, too. I hope this gets merged soon!

@rvanlaar
Copy link
Contributor

rvanlaar commented Sep 9, 2023

What's needed to get this merged?

rvanlaar added a commit to rvanlaar/QTVR that referenced this pull request Sep 13, 2023
With PyAV's bindings to FFMPEG it's trivial to offload decoding to
FFMPEG.

While fun, it wasn't feasible to write a decoder for every format used
in QTVR files. The self writter decoders also had slight color
differences with respect to FFMPEG.

Note:
    PyAV needs to be installed by hand, see the README for more
information.

Long story short, there are two issues:

1. Regular PyAV from PyPI doesn't expose `bits_per_coded_sample` on codecs.
    PR 1162 resolves the issue:
    PyAV-Org/PyAV#1162

2. PyAV can't be build easily.
    Missing is Cython 3 support from the source.
    Apply this PR PyAV-Org/PyAV#1145
@jlaine
Copy link
Member

jlaine commented Oct 27, 2023

What's needed to get this merged?

Co-maintainers, see #1186

@@ -107,9 +107,16 @@ def extract(path, **kwargs):
c_string_encoding='ascii',
)

context = options.create_context()
context = Context(
Copy link
Member

Choose a reason for hiding this comment

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

How do these changes relate to the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cython3 removed create_context, not sure when so I looked at the old implementation of create_context and copied it here.

Copy link

Choose a reason for hiding this comment

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

Do we have to add this in the dev folder? There no such folder available inside transformers

@jlaine
Copy link
Member

jlaine commented Oct 27, 2023

Can you point us to some Cython docs explaining why these changes are required, and if there are others we need to look out for?

@hmaarrfk
Copy link
Contributor Author

I'm not sure there is much to point to:

  1. Cython wanted to optimize more so they ask that you write noexcept. Search for noexcept in https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html
  2. There was a bug that I reported upstream [BUG] assignment of read-only member -- occurs with cython tuple optimizations cython/cython#5558 that got fixed.
  3. I'm not sure how I found the create_context was removed. sometimes I dig deep into code. I don't have a good reference for how I did this months ago

@SpecLad
Copy link

SpecLad commented Oct 27, 2023

Can you point us to some Cython docs explaining why these changes are required, and if there are others we need to look out for?

It's explained here: https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#exception-values-and-noexcept

@hmaarrfk
Copy link
Contributor Author

i'm not sure why the tests are failing.

@WyattBlue WyattBlue merged commit ad05d90 into PyAV-Org:main Oct 28, 2023
16 of 21 checks passed
WyattBlue pushed a commit to rawler/PyAV that referenced this pull request Nov 25, 2023
scrool added a commit to scrool/SYSTRAN.faster-whisper that referenced this pull request Nov 26, 2023
To pull in changes PyAV-Org/PyAV#1145 that
fixes bug in installation on Cython 3.02 (Fedora 39 and python 3.12).
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.

Pip install is failing to build due to av/logging.pyx error
7 participants