aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
510 stars 86 forks source link

New version? 🤔 #419

Closed kloczek closed 1 month ago

kloczek commented 1 year ago

Looks like since last release which was ~10 months ago have been added +200 commits (https://github.com/aleaxit/gmpy/compare/gmpy2-2.1.5...master)

Do you have any plans to release new version? 🤔

skirpichev commented 1 year ago

And it would be nice to have wheels for CPython 3.12.

casevh commented 1 year ago

I am trying to release 2.2.0a1 in the next day or so. Just finishing up on the Windows builds.

kloczek commented 1 year ago

👍

casevh commented 11 months ago

I finally have completed Windows builds. I will release 2.2.0a1 as soon as I can.

casevh commented 11 months ago

I have published gmpy2 2.2.0a1.

I just realized that I missed including the source. I will release a2 in couple of days.

skirpichev commented 11 months ago

I just realized that I missed including the source.

Hmm, why you can't just add the source tarball? E.g. with twine upload.

BTW, releases could be automated, see e.g. the diofant workflow. (To release a new version, I tag the latest commit in the master branch and publish this release tag.) One obstacle for the gmpy - windows builds. But these artifacts could be added later by hand.

casevh commented 11 months ago

Thanks. I was always under the impression that publishing a release was a single event.

I have pushed the source tarball.

Thanks again for your help.

skirpichev commented 11 months ago

I was always under the impression that publishing a release was a single event.

In some sense. E.g. you can't change uploaded files. But you can completely remove some file. Or you can add a missing file.

brubsby commented 11 months ago

Might not be appropriate for this issue, but since it seemed related to the ongoing tasks mentioned in here, I figured I'd comment here rather than make a new one.

I've had trouble installing the new prerelease version. It's very possible I'm missing something obvious, but I unzipped the release 2.2.0a1 in my git folder, and tried to install it with PyCharm 2022.3's packaging tool (Windows), to this response:

Processing c:\gitprojects\gmpy-gmpy2-2.2.0a1
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: gmpy2
  Building wheel for gmpy2 (pyproject.toml): started
  Building wheel for gmpy2 (pyproject.toml): finished with status 'error'
Failed to build gmpy2

  error: subprocess-exited-with-error

  Building wheel for gmpy2 (pyproject.toml) did not run successfully.
  exit code: 1

  [27 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\gmpy2
  copying gmpy2\__init__.py -> build\lib.win-amd64-cpython-310\gmpy2
  running egg_info
  writing gmpy2.egg-info\PKG-INFO
  writing dependency_links to gmpy2.egg-info\dependency_links.txt
  writing requirements to gmpy2.egg-info\requires.txt
  writing top-level names to gmpy2.egg-info\top_level.txt
  reading manifest file 'gmpy2.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'COPYING'
  adding license file 'COPYING.LESSER'
  writing manifest file 'gmpy2.egg-info\SOURCES.txt'
  copying gmpy2\__init__.pxd -> build\lib.win-amd64-cpython-310\gmpy2
  running build_ext
  building 'gmpy2.gmpy2' extension
  creating build\temp.win-amd64-cpython-310
  creating build\temp.win-amd64-cpython-310\Release
  creating build\temp.win-amd64-cpython-310\Release\src
  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I./src -IC:\Python3\include -IC:\Python3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcsrc/gmpy2.c /Fobuild\temp.win-amd64-cpython-310\Release\src/gmpy2.obj /DSHARED=1
  gmpy2.c
  C:\GitProjects\gmpy-gmpy2-2.2.0a1\src\gmpy2.h(80): fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for gmpy2
ERROR: Could not build wheels for gmpy2, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.1.2 -> 23.2.1
[notice] To update, run: python.exe -m pip install --upgrade pip

I'm aware that PyCharm's packaging tool may not be appropriate here, but I figured I'd allow it a chance to perform correctly.

and it says it's attempting to run this command

C:\Python3\python.exe C:/Program Files/JetBrains/PyCharm Community Edition 2022.3/plugins/python-ce/helpers/packaging_tool.py install file://C:\GitProjects\gmpy-gmpy2-2.2.0a1

fwiw, gmp.h seems to be at least sitting in C:\GitProjects\gmpy-gmpy2-2.2.0a1\mingw64\shared\include and C:\GitProjects\gmpy-gmpy2-2.2.0a1\mingw64\static\include, so maybe I don't have my development environment set up correctly to build the windows binaries or something. When unzipping the release, I did get an error that it couldn't make a symlink for gmp.h, but then when I reran 7z as admin it didn't give me the error, so it may not be that either.

Alternatively, I was only grabbing the prerelease because it seemed to give access to mpz_prevprime for the first time, which I wanted to use for calculating OEIS sequence A031442. And my brain isn't quite adept enough at parsing gmp library code to comprehend what algorithm the actual implementation of mpz_prevprime is implementing. Otherwise it could possibly be less hassle for me to implement it in python myself. (I first tried with primesieve-python to do something like:

def previous_prime(val):
    iterator = primesieve.Iterator()
    iterator.skipto(val)
    return iterator.prev_prime()

but either primesieve itself or primesieve-python does not have bignum support)

Some assistance with either problem would help me greatly.

skirpichev commented 11 months ago

I unzipped the release 2.2.0a1 in my git folder, and tried to install it with PyCharm 2022.3's packaging tool (Windows), to this response:

It seems you are trying to build the module from sources. This is a tricky story on windows (see how our CI job does this and mingw64/msys2_build.txt). But there are binary wheels, which you could install with pip install gmpy2==2.2.0a1. Is this inappropriate for you, @brubsby, for some reason?

what algorithm the actual implementation of mpz_prevprime is implementing

This might be documented in the GMP manual, section "Algorithms".

brubsby commented 11 months ago

But there are binary wheels, which you could install with pip install gmpy2==2.2.0a1

Ah that worked! I didn't realize prereleases were distributed on pip as well.

skirpichev commented 11 months ago

I didn't realize prereleases were distributed on pip as well.

Yeah, on the GH releases page only source code is available, looks like a minor issue. It should be possible to upload here other assets (e.g. wheels). But I realize it's too difficult to do now without proper automation of the release process (see suggestion above).

b-kamphorst commented 9 months ago

Hey! It appears that the prerelease 2.2.0a1 has been available for some time. Do you have thoughts on when to fully release 2.2.0?

paddyroddy commented 7 months ago

Any news on a full 3.12 release on PyPI? numba recently released 3.12 support, so I'm keen to make the move

skirpichev commented 7 months ago

I would guess the major trouble is #352.