Skip to content

Test Python 3.14#203

Merged
ofek merged 1 commit into
ofek:masterfrom
DimitriPapadopoulos:3.14
Oct 21, 2025
Merged

Test Python 3.14#203
ofek merged 1 commit into
ofek:masterfrom
DimitriPapadopoulos:3.14

Conversation

@DimitriPapadopoulos

Copy link
Copy Markdown
Contributor

No description provided.

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 8, 2025

Copy link
Copy Markdown
Contributor Author

It looks like hatch itself is failing with Python 3.14:

│ ❱ 199 │   │   for context in app.runner_context([selected_envs[0]]):         │
╰──────────────────────────────────────────────────────────────────────────────╯
IndexError: list index out of range

I cannot find a relevant hatch issue. I'll rebease to make sure we use the newly released Python 3.14.0 instead of 3.14.0-rc.3.

@ofek

ofek commented Oct 8, 2025

Copy link
Copy Markdown
Owner

I think this needs to be set since there has not yet been a release that modifies the default https://hatch.pypa.io/latest/config/internal/testing/#matrix

@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 2 times, most recently from 06e8816 to f49f3b0 Compare October 8, 2025 19:54
Comment thread hatch.toml Outdated
@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 4 times, most recently from b8404f4 to 870af6f Compare October 9, 2025 07:24
Comment thread hatch.toml Outdated
@ofek

ofek commented Oct 9, 2025

Copy link
Copy Markdown
Owner

Well, at least we got past that error!

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

Strange that this error only occurs with Python 3.14:

      In file included from src/curve.c:1:
      src/curve.h:4:10: fatal error: 'gmp.h' file not found
          4 | #include "gmp.h"
            |          ^~~~~~~
      1 error generated.
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/lib
export INCLUDE_PATH=$INCLUDE_PATH:/opt/homebrew/include

Looks like a build issue of fastecdsa itself,

@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 2 times, most recently from c29fdd1 to d313661 Compare October 9, 2025 17:28
@acul71

acul71 commented Oct 16, 2025

Copy link
Copy Markdown

In file included from src/curve.c:1:
src/curve.h:4:10: fatal error: 'gmp.h' file not found
4 | #include "gmp.h"
| ^~~~~~~
1 error generated.

See if this helps

https://py-libp2p.readthedocs.io/en/latest/contributing.html#macos-setup

brew install cmake pkgconfig gmp

# On macOS, help the build command find and link against the gmp library:

CFLAGS="`pkg-config --cflags gmp`" LDFLAGS="`pkg-config --libs gmp`" python3 -m pip install -e ".[dev]"

#############

Hello I'm Luca from py-libp2p waiting for the `coincurve` new release for python v3.14 (needed for windows)

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 17, 2025

Copy link
Copy Markdown
Contributor Author

This had already been pointed out in #203 (comment).

The whole remaining question is where exactly to define these environment variables.

@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 3 times, most recently from a31bfd0 to 6bb0ae2 Compare October 17, 2025 11:36
Comment thread .github/workflows/build.yml Outdated
# https://stackoverflow.com/questions/68827486/cannot-link-gmp-library-not-found-for-lgmp
LIBRARY_PATH /opt/homebrew/lib
INCLUDE_PATH /opt/homebrew/include

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure this is the best location for defining these variables, but I cannot find anything better. Suggestions?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This doesn't appear to be valid syntax, how is this working? 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess the parser is permissive. Fixed.

Comment thread hatch.toml Outdated
Comment on lines +12 to +13
[[envs.hatch-test.matrix]]
python = ["3.14", "3.13", "3.12", "3.11", "3.10", "3.9"]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Try removing this because of the new release https://github.com/pypa/hatch/releases/tag/hatch-v1.15.0

Comment thread .github/workflows/build.yml Outdated
# https://stackoverflow.com/questions/68827486/cannot-link-gmp-library-not-found-for-lgmp
LIBRARY_PATH /opt/homebrew/lib
INCLUDE_PATH /opt/homebrew/include

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This doesn't appear to be valid syntax, how is this working? 😅

@ofek

ofek commented Oct 19, 2025

Copy link
Copy Markdown
Owner

Fixing the syntax error appears to have broken the build somehow, wow! Can you add that back and print out those environment variables? As you mentioned, the parser must be lenient because I just tried https://raw.githubusercontent.com/ofek/coincurve/6bb0ae22705d0cef2e2774ddfc66f6922b729b16/.github/workflows/build.yml:

>>> import pyperclip,yaml
>>> s=yaml.safe_load(pyperclip.paste())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
...
  File "C:\Users\ofek\AppData\Local\Programs\Python\Python312\Lib\site-packages\yaml\scanner.py", line 291, in stale_possible_simple_keys
    raise ScannerError("while scanning a simple key", key.mark,
yaml.scanner.ScannerError: while scanning a simple key
  in "<unicode string>", line 41, column 3:
      LIBRARY_PATH /opt/homebrew/lib
      ^
could not find expected ':'
  in "<unicode string>", line 42, column 3:
      INCLUDE_PATH /opt/homebrew/include
      ^

@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 3 times, most recently from 482e5e7 to e210a0d Compare October 19, 2025 18:59
@DimitriPapadopoulos

Copy link
Copy Markdown
Contributor Author

Fixed by using CFLAGS and LDFLAGS instead of INCLUDE_PATH and LIBRARY_PATH.

@ofek

ofek commented Oct 19, 2025

Copy link
Copy Markdown
Owner

Nice, thanks a lot! Do you think we could set those conditionally just on the jobs that were failing?

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 19, 2025

Copy link
Copy Markdown
Contributor Author

This really is a workaround that I hope to get rid of, see AntonKueltz/fastecdsa#114. And I still fail to understand why the build fails with Python 3.14 only. I suspect Python 3.14 might pull a different version of a dependency. So I'm not certain we should set the variables conditionally.

@DimitriPapadopoulos

Copy link
Copy Markdown
Contributor Author

I've moved the definition of the environment variables to the specific step that needs them:

- name: Run static analysis
run: hatch fmt --check

However, I haven't found a way to define the variables conditionally.

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 19, 2025

Copy link
Copy Markdown
Contributor Author

Is there a way to retrieve the details of what hatch fmt --check does under the hood? The difference between Python 3.13 and 3.14 originates in there, but the output is not verbose enough to observe what could be the cause.

@ofek

ofek commented Oct 19, 2025

Copy link
Copy Markdown
Owner

hatch -v ... should do it

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 20, 2025

Copy link
Copy Markdown
Contributor Author

Unfortunately hatch -v ... seems to fix the issue for some reason - unless updates deep inside GitHub Actions or runners fixed the issue.

I'll try again without -v.

@DimitriPapadopoulos
DimitriPapadopoulos force-pushed the 3.14 branch 3 times, most recently from 741bd42 to 73e570f Compare October 20, 2025 14:19
@DimitriPapadopoulos

Copy link
Copy Markdown
Contributor Author

@ofek Somehow, macOS issues fixed themselves. I guess a bug has been fixed somewhere in CI software/runners.

@ofek ofek left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for persevering through the weirdness!

@ofek
ofek merged commit 7829b29 into ofek:master Oct 21, 2025
37 checks passed
@ofek

ofek commented Oct 21, 2025

Copy link
Copy Markdown
Owner

@ofek

ofek commented Oct 21, 2025

Copy link
Copy Markdown
Owner

@DimitriPapadopoulos

DimitriPapadopoulos commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

I'm not sure how to interpret this:

  • The exact reasons behind cache hits/misses are irrelevant — we should be able to handle both any way.
  • I'm not sure how cache hits/misses have an impact on finding the GMP library, or not. What's in a cache? Does the cache include environment variables such as CFLAGS/LDFLAGS?
  • Why the failure with Python 3.14 only? Because it's the only case missing a GitHub Action cache? But then, how did it work in the first place with other versions of Python?

@DimitriPapadopoulos

Copy link
Copy Markdown
Contributor Author

Any way, I reapplied 117ffab in #214.

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.

3 participants