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

Speedup, refactoring and modernization #76

Merged
merged 40 commits into from
Aug 30, 2023
Merged

Speedup, refactoring and modernization #76

merged 40 commits into from
Aug 30, 2023

Conversation

fjwillemsen
Copy link
Member

@fjwillemsen fjwillemsen commented Aug 25, 2023

Hi all! A while ago I implemented python-constraint in Kernel Tuner, an auto-tuning framework where we need to obtain all solutions on user-specified parameters and constraints before starting optimization. python-constraint works great, but it had some room for improvement, especially performance-wise.
I thus decided to fork python-constraint and make some changes, the following:

  • Cythonized the package
  • Added the OptimizedBacktracking solver based on issue #62
  • Added type-hints to improve Cythonization
  • Added the MaxProd and MinProd constraints
  • Improved pre-processing for the MaxSum constraint
  • Optimized the Function constraint
  • Added getSolutionsOrderedList and getSolutionsAsListDict functions for efficient result shaping
  • Overall optimization of common bottlenecks
  • Split the codebase into multiple files for convenience
  • Switched from setup.py to pyproject.toml
  • Achieved and requires test coverage of at least 65%
  • Added nox for local testing against all supported Python versions
  • Added ruff for codestyle testing
  • Dropped Python 3.4, 3.5, 3.6, 3.7 support

In all, this results in a huge speedup of >150x on a benchmark of 112 synthetic searchspaces:
image

I'd like to hear what the mainainers think about these changes and would be happy to see them integrated! Before releasing this, I think it would be a good idea to revise the package publishing process, and consider switching to GitHub Actions (I can help with this). If there are any questions, please let me know!

…ll outside GIL; optimized non-forwardchecking instead
…nvalid outcomes, added preprocessing to MaxProdConstraint
@scls19fr
Copy link
Member

Hi @fjwillemsen

Very pleased to see such a contribution. I'm no longuer maintaining this repository. I sent you and invite to be member of https://github.com/python-constraint/ GH org and also grant you write access to https://github.com/python-constraint/python-constraint/
Feel free to take the lead on the project and improve it.
If you need something more just let me know.

Kind regards

Sébastien

@fjwillemsen
Copy link
Member Author

@scls19fr thank you very much, I'll do my best :)
Perhaps it is not practical, but given that you will no longer maintain, could you make me owner instead of member? It appears I currently do not have access to the repository secrets, which prohibits a release on PyPI

@scls19fr
Copy link
Member

Done.

@scls19fr
Copy link
Member

https://pypi.org/project/python-constraint/ belongs to @niemeyer so I can't give you access.
You can either ask him or create a new PyPi project python-constraint2 or 3 for example.

@fjwillemsen
Copy link
Member Author

Thank you! I have contacted @niemeyer via email, for continuity it would be ideal to keep it on the same package, I hope this will be possible.
Thank you very much for all of your contributions to python-constraint throughout the years!

@fjwillemsen fjwillemsen merged commit cd42626 into python-constraint:master Aug 30, 2023
@scls19fr
Copy link
Member

Great work! Thanks @fjwillemsen
Renaming master branch to main should also be considered
https://github.com/github/renaming

@fjwillemsen
Copy link
Member Author

Good suggestion! Renamed master branch to main

@fjwillemsen fjwillemsen deleted the speedup branch August 30, 2023 06:39
@fjwillemsen
Copy link
Member Author

My emails to @niemeyer regarding PyPI access seem to go unanswered. @scls19fr could you perhaps get in touch with @niemeyer, or provide me with an alternative means of contact? My contact details are on my website.

@scls19fr
Copy link
Member

what about a new name?
python-constraint2 or 3 or something else.
So we could be totally free.
I think it will be the simplest solution.

@fjwillemsen
Copy link
Member Author

Yes, definitely, I had already created a python-constaint2 for beta testing. However, python-constraint had 148,000 downloads in the past month, which is a very solid user base I would prefer not to abandon if we have a choice.

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.

None yet

2 participants