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

flint.good can not be imported (python-flint 0.5) #102

Closed
TimBerberich opened this issue Nov 1, 2023 · 6 comments · Fixed by #103
Closed

flint.good can not be imported (python-flint 0.5) #102

TimBerberich opened this issue Nov 1, 2023 · 6 comments · Fixed by #103

Comments

@TimBerberich
Copy link

Hi all,
thanks for the nice python package. I stumbled over a potential bug in the new 0.5 release.
I did install python flint 0.5 via
pip install python-flint

I can import and use any sub module/function except for flint.good.
Calling
from flint import good
or
from flint.functions import good
throw Import errors. Importing showgood however works fine.

Best,
Tim

@oscarbenjamin
Copy link
Collaborator

Hi Tim, thanks for testing.

Is this something that you were using in previous releases of python-flint?

I have just tested that this works with 0.5.0:

from flint.functions.showgood import good

To make it importable at top-level it would need to be added here:

from .functions.showgood import showgood

@TimBerberich
Copy link
Author

Hi Oscar,
no I just started playing with flint and was following the tutorial where examples for good are shown that suggest it is in the namespace of flint:
https://fredrikj.net/python-flint/general.html?highlight=good#flint.good

The import from flint.functions.showgood worked fine in my case as well :)

@oscarbenjamin
Copy link
Collaborator

Okay, so there are three problems here.

  1. The docs website has not been updated since python-flint 0.3.0 (Bump version to 0.5.0 #84 (comment)).
  2. The doctests are not being checked for the rst docs.
  3. The good function was probably importable like from flint import good in previous python-flint releases.

@oscarbenjamin
Copy link
Collaborator

This is how the doctests can be run. They fail immediately:

$ pytest --doctest-glob='*.rst' doc/source/
======================================== test session starts ========================================
platform linux -- Python 3.11.3, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/oscar/current/active/python-flint
plugins: hypothesis-6.84.2, cov-4.1.0, split-0.8.1, timeout-2.1.0, doctestplus-1.0.0, xdist-3.3.1
collected 1 item                                                                                    

doc/source/general.rst F                                                                      [100%]

============================================= FAILURES ==============================================
_______________________________________ [doctest] general.rst _______________________________________
039     dps = 15           # real/complex precision (in digits)
040     cap = 10           # power series precision
041     threads = 1        # max number of threads used internally
042 
043 The user can mutate the properties directly, for example::
044 
045     >>> ctx.pretty = False
046     >>> fmpq(3,2)
047     fmpq(3,2)
048     >>> ctx.pretty = True
Expected:
    3/2
Got nothing

/home/oscar/current/active/python-flint/doc/source/general.rst:48: DocTestFailure
====================================== short test summary info ======================================
FAILED doc/source/general.rst::general.rst
========================================= 1 failed in 0.08s =========================================

No surprise there are the doctest is wrong (it shouldn't output anything):

>>> ctx.pretty = False
>>> fmpq(3,2)
fmpq(3,2)
>>> ctx.pretty = True
3/2

@TimBerberich
Copy link
Author

Thanks for all the effort !

@oscarbenjamin
Copy link
Collaborator

Thanks Tim.

This should be fixed in the next release.

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 a pull request may close this issue.

2 participants