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

Refactor functions into submodule #67

Merged
merged 12 commits into from
Sep 7, 2023

Conversation

GiacomoPope
Copy link
Contributor

This PR aims to finish the work on refactoring to remove all include, fixing issue #15.

The last file, functions.pyx has been renamed to eval_helper.pyx and is used in doctests for various flint types.

@@ -351,7 +351,7 @@ cdef class acb(flint_scalar):
Complex sign function defined as a piecewise extension of
the real sign function.

>>> from flint import showgood
>>> from flint.types.eval_helper import showgood
Copy link
Collaborator

Choose a reason for hiding this comment

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

The docstring should show how users are expected to import something.

Does from flint import showgood not work with these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could import showgood as all the other types are so it's available from flint itself but I left it this way as my understanding it was more for debugging?

The change should be minor I hope, happy for you to make the call

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is shown widely in the docs so it should be treated as an end user function. Previously the docs always showed it as being imported from flint so we should preserve that for now (and continue to show that in the docs).

I think that from flint import showgood should continue to work and should be what is shown in the docstrings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'm happy to make the changes to fix this (tomorrow, sleep now). Won't be more than a few extra lines of code :)

@GiacomoPope
Copy link
Contributor Author

Considering showgood() is a user facing function which we want to import, I have put this in

  • src/flint/functions/showgood.pyx

and then I make this available in __init__.py on the module so

from flint import showgood

works as expected. flint/functions can then be used for similar user-facing util functions.

@oscarbenjamin
Copy link
Collaborator

This seems to duplicate the code from functions.pyx in two places.

Also an empty .pdx file has been added (I don't know what a .pdx file is).

@GiacomoPope GiacomoPope closed this Sep 7, 2023
@GiacomoPope GiacomoPope deleted the refactor-functions branch September 7, 2023 11:00
@GiacomoPope GiacomoPope restored the refactor-functions branch September 7, 2023 11:02
@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Sep 7, 2023

@oscarbenjamin I did something stupid when cleaning up and deleted the wrong branch (trying to do too many things) So sorry for the mess up.

@GiacomoPope GiacomoPope reopened this Sep 7, 2023
@oscarbenjamin
Copy link
Collaborator

This has a merge conflict now.

@GiacomoPope
Copy link
Contributor Author

Resolved, I can't keep up with all the versions!

@oscarbenjamin
Copy link
Collaborator

If this is adding a new package then it also needs to be add here:

python-flint/setup.py

Lines 66 to 73 in 24267a5

packages=[
'flint',
'flint.flintlib',
'flint.flint_base',
'flint.types',
'flint.utils',
'flint.test',
]

@oscarbenjamin
Copy link
Collaborator

Looks good. Thanks!

@oscarbenjamin oscarbenjamin merged commit 68249c8 into flintlib:master Sep 7, 2023
16 checks passed
@GiacomoPope GiacomoPope deleted the refactor-functions branch August 12, 2024 16:41
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.

2 participants