Opened 2 years ago

Last modified 3 months ago

#29863 new task

Meta-ticket: Cython 3.0.0 (unreleased)

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.8
Component: packages: standard Keywords: upgrade, cython
Cc: Kwankyu Lee, William Stein, Vincent Delecroix, Travis Scrimshaw, Tobias Diez Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/mkoeppe/meta_ticket__cython_3_0_0__unreleased_ (Commits, GitHub, GitLab) Commit: 6c338f8050c77f97d8b597d855b41547e7c06c22
Dependencies: #26254, #32832, #34257 Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

This ticket is for experimenting with an update to Cython 3, which is at 3.0.0 alpha 10 as of 2022-07. No release schedule has been published.

https://github.com/cython/cython/blob/master/CHANGES.rst

  • #34257 Add missing cdef method declarations (for Cython 3)
  • #26254 Use Cython directive binding=True to get signatures in help for cythonized built-in methods
  • #32832 cython: Eliminate use of custom patches
  • #30511 Type hints (__annotations__) and coercion/categories/Cython

See also:

Change History (27)

comment:1 Changed 2 years ago by Samuel Lelièvre

Keywords: upgrade cython added

comment:2 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:3 Changed 22 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:4 Changed 17 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:5 Changed 12 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:6 Changed 9 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:7 Changed 4 months ago by Matthias Köppe

Cc: Kwankyu Lee added
Description: modified (diff)
Summary: Upgrade Cython to 3.0.0 (unreleased)Meta-ticket: Cython 3.0.0 (unreleased)

comment:8 Changed 4 months ago by Matthias Köppe

Description: modified (diff)

comment:9 Changed 4 months ago by Matthias Köppe

Cc: William Stein added
Description: modified (diff)

comment:10 Changed 4 months ago by Matthias Köppe

Description: modified (diff)

comment:11 Changed 4 months ago by Matthias Köppe

Dependencies: #26254, #32832
Description: modified (diff)

comment:12 Changed 4 months ago by Matthias Köppe

Branch: u/mkoeppe/meta_ticket__cython_3_0_0__unreleased_

comment:13 Changed 4 months ago by Matthias Köppe

Cc: Vincent Delecroix added
Commit: 02ce9971b7d60867dc59db3dea439b58dcdcdadb

pplpy build fails:

    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from ppl_decl cimport *
  ^
  ------------------------------------------------------------

  ppl/bit_arrays.pxd:1:0: 'ppl_decl.pxd' not found

  Error compiling Cython file:

Last 10 new commits:

bea228bTry with localized import
89b8081Inline all other imports from expression
9bbf574Fix a few tests
803804fand one more test
a23ffe9Tiny edits
570058cMerge remote-tracking branch 'origin/u/mkoeppe/update_cython_to_0_29_29' into public/26254
02d6282Merge remote-tracking branch 'origin/develop' into public/26254
bca67b0Merge #26254
f537175build/pkgs/cython: Use 3.0.0a10
02ce997build/pkgs/cython/patches/trashcan.patch: Remove

comment:14 Changed 4 months ago by Matthias Köppe

[sagelib-9.7.beta6]   Error compiling Cython file:
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6]   ...
[sagelib-9.7.beta6]               sage: p = next_prime(2^32)
[sagelib-9.7.beta6]               sage: GF(p)(int(p+1))
[sagelib-9.7.beta6]               1
[sagelib-9.7.beta6]           """
[sagelib-9.7.beta6]           mpz_set_si(self.value, value)
[sagelib-9.7.beta6]           mpz_mod(self.value, self.value, self.__modulus.sageInteger.value)
[sagelib-9.7.beta6]                                                                    ^
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]   sage/rings/finite_rings/integer_mod.pyx:1986:66: Cannot convert Python object to '__mpz_struct *'

comment:15 Changed 4 months ago by Matthias Köppe

[sagelib-9.7.beta6]   Error compiling Cython file:
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6]   ...
[sagelib-9.7.beta6]           """
[sagelib-9.7.beta6]           Lfunction.__init__(self, name, what_type_L, dirichlet_coefficient,  period, Q, OMEGA, gamma,lambd, pole,residue)
[sagelib-9.7.beta6]           self._repr += " with integer Dirichlet coefficients"
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]       # override
[sagelib-9.7.beta6]       cdef void __init_fun(self, char *NAME, int what_type, dirichlet_coeff, long long Period, double q,  c_Complex w, int A, double *g, c_Complex *l, int n_poles, c_Complex *p, c_Complex *r):
[sagelib-9.7.beta6]           ^
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]   sage/libs/lcalc/lcalc_Lfunction.pyx:500:9: C method '_Lfunction_I__init_fun' not previously declared in definition part of extension type 'Lfunction_I'

comment:16 Changed 4 months ago by Matthias Köppe

[sagelib-9.7.beta6]   Error compiling Cython file:
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6]   ...
[sagelib-9.7.beta6]           """
[sagelib-9.7.beta6]           return Matroid._repr_(self) + " with " + str(self.bases_count()) + " bases"
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]       # support for parent BasisExchangeMatroid
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]       cdef bint __is_exchange_pair(self, long x, long y) except -1:      # test if current_basis-x + y is a basis
[sagelib-9.7.beta6]           ^
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]   sage/matroids/basis_matroid.pyx:268:9: C method '_BasisMatroid__is_exchange_pair' not previously declared in definition part of extension type 'BasisMatroid'

[sagelib-9.7.beta6]   Error compiling Cython file:
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6]   ...
[sagelib-9.7.beta6]                   b = frozenset(B)
[sagelib-9.7.beta6]                   if len(b) != self._matroid_rank:
[sagelib-9.7.beta6]                       raise ValueError("basis has wrong cardinality.")
[sagelib-9.7.beta6]                   if not b.issubset(self._groundset):
[sagelib-9.7.beta6]                       raise ValueError("basis is not a subset of the groundset")
[sagelib-9.7.beta6]                   self.__pack(self._b, b)
[sagelib-9.7.beta6]                                  ^
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]   sage/matroids/basis_matroid.pyx:224:32: Cannot convert 'bitset_t' to Python object
[sagelib-9.7.beta6] 

comment:17 Changed 4 months ago by Matthias Köppe

[sagelib-9.7.beta6]   Error compiling Cython file:
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6]   ...
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]       AUTHOR:
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]       - Xavier Caruso (2013-03)
[sagelib-9.7.beta6]       """
[sagelib-9.7.beta6]       cdef int __normalize(self) except -1:
[sagelib-9.7.beta6]           ^
[sagelib-9.7.beta6]   ------------------------------------------------------------
[sagelib-9.7.beta6] 
[sagelib-9.7.beta6]   sage/rings/polynomial/polynomial_element.pyx:11912:9: C method '_Polynomial_generic_dense_inexact__normalize' not previously declared in definition part of extension type 'Polynomial_generic_dense_inexact'

comment:18 Changed 4 months ago by git

Commit: 02ce9971b7d60867dc59db3dea439b58dcdcdadbfd2e122cc0b8d7cba07efdcfab3e54436f26aec1

Branch pushed to git repo; I updated commit sha1. New commits:

fd2e122src/sage/libs/lcalc/lcalc_Lfunction.pxd: Add missing cdef method declarations

comment:19 Changed 4 months ago by git

Commit: fd2e122cc0b8d7cba07efdcfab3e54436f26aec14e146322579eb9375a3eb9dda973bd6ae12e85d3

Branch pushed to git repo; I updated commit sha1. New commits:

4e14632src/sage/matroids/{basis,linear}_matroid.pxd: Add missing cdef method declarations

comment:20 Changed 4 months ago by git

Commit: 4e146322579eb9375a3eb9dda973bd6ae12e85d346af90e0348e31e23fa80d6b4256e870de40cbc8

Branch pushed to git repo; I updated commit sha1. New commits:

46af90esrc/sage/rings/polynomial/polynomial_element.pxd: Add missing cdef method declaration

comment:21 Changed 4 months ago by Matthias Köppe

Cc: Travis Scrimshaw added

Help wanted with Cannot convert 'bitset_t' to Python object and Cannot convert Python object to '__mpz_struct *'

comment:22 Changed 4 months ago by Matthias Köppe

Description: modified (diff)

comment:23 Changed 4 months ago by Matthias Köppe

Dependencies: #26254, #32832#26254, #32832, #34257
Description: modified (diff)

comment:24 Changed 4 months ago by git

Commit: 46af90e0348e31e23fa80d6b4256e870de40cbc86c338f8050c77f97d8b597d855b41547e7c06c22

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1f9ee80src/sage/libs/lcalc/lcalc_Lfunction.pxd: Add missing cdef method declarations
034094csrc/sage/matroids/{basis,linear}_matroid.pxd: Add missing cdef method declarations
9d89bdfsrc/sage/rings/polynomial/polynomial_element.pxd: Add missing cdef method declaration
727d101Merge #34257
6c338f8build/pkgs/pplpy/patches: Add https://gitlab.com/videlec/pplpy/-/merge_requests/20

comment:25 in reply to:  13 Changed 4 months ago by Matthias Köppe

Replying to mkoeppe:

pplpy build fails:

    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from ppl_decl cimport *
  ^
  ------------------------------------------------------------

  ppl/bit_arrays.pxd:1:0: 'ppl_decl.pxd' not found

  Error compiling Cython file:

PR: https://gitlab.com/videlec/pplpy/-/merge_requests/20

comment:26 Changed 4 months ago by Matthias Köppe

Cc: Tobias Diez added

comment:27 Changed 3 months ago by Matthias Köppe

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.