-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Implement packaging using pyproject.toml
#476
Implement packaging using pyproject.toml
#476
Conversation
@NicolasHug I'm currently having trouble installing Surprise with Poetry. This would be a great improvement! Thanks @abhi8893 ! |
@NicolasHug This solved the problem for me! Please merge and make a new release. thanks @abhi8893 |
pyproject.toml
Outdated
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
] | ||
license = { "text" = "GPLv3+" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license = { "text" = "GPLv3+" } | |
license = { "file" = "LICENSE.md" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The license is not GPLv3+, so just point it to the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
@@ -1,5 +1,3 @@ | |||
from pkg_resources import get_distribution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from pkg_resources import get_distribution | |
from pkg_resources import get_distribution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion here in this PR: #476 (comment)
@@ -1,5 +1,3 @@ | |||
from pkg_resources import get_distribution | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion here in this PR: #476 (comment)
@@ -47,4 +45,4 @@ | |||
"model_selection", | |||
] | |||
|
|||
__version__ = get_distribution("scikit-surprise").version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__version__ = get_distribution("scikit-surprise").version | |
__version__ = get_distribution("scikit-surprise").version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add back get_distribution(). I don't think you want to hardcode the version number here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, there are 2 considerations:
- If we rely on
pkg_resources
(which comes fromsetuptools
) insidesurprise
, then it becomes a direct dependency ofsurprise
. Depending on the python distribution,setuptools
may or may not be bundled with python. Hence to avoid this, I declare version directly insurprise.__init__.py
- Most popular packages, like
scikit-learn
follow the same style: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/__init__.py
Let me know if this makes sense 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for the explanation. That makes sense. 👍
In that case, I would recommend changing the docstring in setup.py
in the section Change __version__
to reflect that the version is now in __init__.py
.
This is a valid change, because in pyproject.toml
you specified that version
is dynamic
.
You can delete |
…e in a single step
Thanks @rodrigc for reviewing! I have incorporated the comments. On the versioning part, I have a differing view, but let me know what you think 🙂 |
Good job on this PR. |
Thanks a lot for merging this and making a new release so quickly @NicolasHug! Confirming it installs flawlessly now, even with |
Nice job @abhi8893 and @NicolasHug ! |
Description
scikit-surprise
currently relies on the legacysetup.py
to describe the python package build. While this is needed for including cythonized extensions, most of the config can be moved topyproject.toml
.This would probably solve open installation issues: #466, #468, #470 etc
This PR does the following:
build
to dev requirementssetup.cfg
surprise.__init__.py
setup.py
, and transfer most conf topyproject.toml
[test]
requirements installedMerging this will gave back the community a really good recommender system library! 🙂