-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
[IMP] Migrate to poetry to manage package #329
Conversation
ad72751
to
7afd6a3
Compare
Install version from OCA/pylint-odoo#329 with a more modern packaging method, avoiding errors with setuptools
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.
In general terms, poetry is pure pleasure.
Besides, it fixes what #328 was trying to fix (and didn't).
You have my blessing.
7afd6a3
to
d04aa09
Compare
@yajo changes made. Thanks! |
Install version from OCA/pylint-odoo#329 with a more modern packaging method, avoiding errors with setuptools
Please could you review @moylop260? |
Install version from OCA/pylint-odoo#329 with a more modern packaging method, avoiding errors with setuptools
Install version from OCA/pylint-odoo#329 with a more modern packaging method, avoiding errors with setuptools
@@ -0,0 +1,1013 @@ | |||
[[package]] |
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.
How did you make this file?
What extra considerations should we take now with this new way for each release?
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.
This file is managed by poetry. This is the file poetry uses to resolve all the dependencies for the environment and pin them to a specific version.
The only thing to take into account in a new release would be bumping the version in the pyproject.toml
file. However, I think you can even enable another plugin in poetry to enable this automatically from git tags. @yajo knows this better 😄
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.
Yes, you can use https://github.com/mtkennerly/poetry-dynamic-versioning/
|
||
after_success: | ||
- coveralls | ||
- python setup.py sdist # Build ChangeLog file from git log |
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.
Where is building the package to upload to pypi?
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.
Oh sorry. I think I saw your comment there and assumed that step only enabled the changelog generation from git, so I deleted it.
We can build and push with poetry publish
I will be adding this.
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.
We can either use poetry build
to build the package and use the current deploy stage to push it, or use poetry publish --build
which will do both in one step. Which do you prefer @moylop260?
This seems to break our doobda tests when running 11.0 and 12.0 with python 3.6 (instead of 3.5), it works fine when installing the pypi pylint-odoo version 3.7.1:
|
Thanks @ap-wtioit |
I pushed the fix, you can undo the pin if you prefer. |
Ok 👍 Thanks! |
Sorry, I didn't get you What pinned version? |
Currently, the |
Ok, I got it The reason is that this project is used for all projects of the OCA We liked avoid it using only pinned version and bumping version using a new PR in order to check all is fine with the CI or fix the compatibility matter. So, you can bump version in this PR in order to check all is working well or fix it if it is not |
Ok, thanks @moylop260 With f049dd4, So, in this case, it would limit to versions |
Well, taking a better look at it, the only About this #329 (comment) which approach do you prefer to follow then? |
Sorry, I'm not familiar neither poetry and I see this PR hard to maintain from me in the time @guewen What do you think? |
Sorry, Overall, it is a change to make it easier to maintain IMHO, specially with the changes in PEP standards I mention above and that will only cause more problems over time. I understand this is a big change, so it's up to you if it is worth it to invest in a tool like this 🙂 |
Remove setup.py and setup.cfg These tools are becoming old and deprecated, and can introduce errors: - https://pip.pypa.io/en/latest/cli/pip_install/#controlling-setup-requires - https://setuptools.readthedocs.io/en/latest/userguide/dependency_management.html?highlight=dependencies#id3 - pypa/setuptools#1320 (comment) Python-poetry can replace that, making it easier to manage dependencies
Also fix test module to allow being discovered by unittest
Remove auto generation of change log (temporary) Remove install script (all dependencies handled by poetry)
Solves import error for higher versions as functions are renamed
8a69151
to
0742409
Compare
I have created a new python packages here: I just deleted the requirement to Now it is used only from tox in order to create the fancy auto-generated "ChangeLog" based on commits and tags So, it should not be a problem Could you check if it fix your current issue FYI we will copy many things from that project to pylint-odoo I have checked pylint, flake8, pre-commit and other projects and they are using the out-of-the-box packages way |
Install version from OCA/pylint-odoo#329 with a more modern packaging method, avoiding errors with setuptools (cherry picked from commit 68fd24e)
The fix from #328 is incomplete.
The problem still persists and will remain (and possibly escalate) while using deprecated packaging methods.
As mentioned in the following references:
It is recommended to update the packaging method not to depend on things like the
setup_requires
keyword, but instead manage the build dependencies from apyproject.toml
file.To avoid complications when migrating to a different Python packaging method, poetry can facilitate the move.
It can fully replace
setup.py
andsetup.cfg
, while still integrating with current tools likeuniitest
andtox
.With this PR, I try to make that transition, while keeping the current functionality.
The only current functionality I didn't manage to incorporate here was the automatic changelog generation from git. If it is an important thing to keep, it can be done with most up-to-date tools based on https://www.conventionalcommits.org/en/v1.0.0/, like https://commitizen-tools.github.io/commitizen/ to read from git history and generate the changelog, like now. It would need some configuration to adapt it to the current OCA commit guidelines, but it could be done and would allow a bunch of cool features like https://commitizen-tools.github.io/commitizen/#commitizen-features
WDYT @moylop260?
@Tecnativa
TT29203
ping @yajo