-
Notifications
You must be signed in to change notification settings - Fork 910
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
Move default template to static pyproject.toml
#2569
Conversation
Is there any reason we wouldn't do this? Given that we have (a) Relatedly, I think doing |
We can definitely keep What we can do is to keep the library code in
With this, when people do What I think we should not do is leave the runtime dependencies in And if we're keeping the
What do you think @antonymilne? (And everyone else) |
ac168d9
to
5dbd901
Compare
Fully agree with this. Assuming that's what we do, personally I'm fine with any of these solutions:
As far as I can tell the advantage of 1 is it's familiar and splits off dev requirements. The advantage of 2 is it's one fewer file and it's even more familiar (as gives essentially same behaviour as now). The advantage of 3 is it feels cleaner and there's two fewer files. Did I miss any other factors here? The solution I think I'd avoid is the one you have in the code now:
I think this is confusing because to a user there's two different looking commands: I don't have a strong preference between 1, 2, 3 above but might be worth doing some quick user research to see what people make of it. e.g. maybe actually |
Personally prefer the third option; since we already have requirements in I also think it's a bit hypocritical to be trying to simplify the project template, but unnecessarily keeping extra files for roundabout requirements management. |
093000e
to
cdfb2ea
Compare
Adopted option 3 in @antonymilne's comment: now everything lives in Notice that folks still can still freeze their dependencies if they want, since
|
cdfb2ea
to
98105ec
Compare
Not the best PR to discuss this but I added a dependency on tomli (the predecessor of stdlib tomllib https://docs.python.org/3/library/tomllib.html) before realizing we were using another third-party toml. Going forward I think it will be better to settle on tomli because it will be included in Python 3.11 onwards, so for this PR I can
|
I think this is ready for at least a first review pass. Not so much on the diff (it will be difficult to read, although you're more than welcome to do so), but a bit of QA ( |
kedro/templates/project/{{ cookiecutter.repo_name }}/pyproject.toml
Outdated
Show resolved
Hide resolved
A while ago we decided to use dependabot to manage and bump dependencies when possible (#1810). But if |
Apparently dependabot works with However, notice that this PR does not remove |
Can we then update the dependabot config as part of that PR? |
I don't know the reason why we chose this
What exactly do you mean by 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.
Apart from moving the ipython
and jupyter
requirements to dev requirements I'm happy with these changes. I would add this clearly to the release notes and perhaps add a small "migration" paragraph explaining these changes, because I feel like they're pretty unnoticeable to end-user but will cause confusion when they suddenly can't find their requirements.txt
files anymore.
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.
I'm a huge fan of these changes, great work 👏
But I think we need to work out exactly what implications it has on various kedro commands and how we should handle that. I recommend searching for requirements.txt
to see exactly where it appears in kedro source, but at a glance this change will affect:
- several error messages/hints (including the
kedro jupyter
one I noted already, but there's many others) kedro build-reqs
(deprecated but still awkward)kedro build-docs
(similarly)kedro micropkg
(severely in the case that you have per-pipeline requirements.txt, which I think is very rare but possible)
The problem with altering error messages/hints is that the message would need to work for both the old requirements.txt template and the new pyproject.toml one. Or we could put in some logic that detects the version of your kedro template (it's in metadata) and displays the appropriate error messages.
The problem with commands themselves is more difficult because these actually rely on the structure of your project having a requirements.txt file. Leaving aside more fundamental questions about whether these command should really work like that or exist at all (when it comes to micropackaging, my opinion tends to be "no"), if we make this change to the template in kedro 0.18.x we'd need to update those commands to work for both old and new template styles, which is tricky.
Unless I'm missing something I think the options would be:
- change these commands to handle both old and new project templates
- postpone these changes to 0.19
I hope I am missing something because I really like these changes, but unfortunately they turn out to have quite wide-ranging implications which are not so simple to resolve in a non-breaking way.
And I have no opinion on the toml library really - happy to go with whatever you think is best. |
If we keep both dependencies I think it could lead to complications and confusion. I am ok with the third option it would keep the codebase consistent for now, in follow-up PRs we can switch our tests to tomli. |
Thanks all for the comments!
Absolutely! Just left a note there so I don't forget.
Instead of using
And on @antonymilne's comment:
Yeah I think this is a really good point. If we merge this too early as it stands now, there's probably going to be conflicts of this sort. It also resonates with @merelcht other point:
Maybe we should circle back to option (2) in @antonymilne's earlier comment, hence to keep So, summary of changes needed here, if folks agree:
And then give a second pass to the documentation and release notes. |
That sounds like a good plan, thanks @astrojuanlu ! |
Yep, sounds like a good resolution to me also. I'd just add that you should do a search in the source code for references to One very minor thing out of curiosity: why the need for |
Good point, thanks!
To workaround this long standing pip-tools bug 😢 jazzband/pip-tools#204 |
Okay, it's almost there but I have to halt this now. The remaining unit and e2e test failures have to do with |
This comment was marked as duplicate.
This comment was marked as duplicate.
6eba02a
to
3fc5cc3
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3fc5cc3
to
12cde3d
Compare
96c9af0
to
ea2033a
Compare
After gh-2414 is merged, I'm going to try to rework this as follows:
In the interest of not having to wait until pre-0.19, I'll try to go as far as possible while not breaking backwards compatibility, adding fallbacks where needed, and then have the actual breaking changes in 0.19. I prefer not to send a PR to |
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Uses `requirements.txt` for dev requirements in project template. Fix gh-2280. Fix gh-2519. Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
flake8 is the only linter that does not allow configuration in pyproject.toml, so we rename the file to to avoid confusion with the legacy setup.py and make it clear that it only holds the configuration of a single tool. Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
Signed-off-by: Juan Luis Cano Rodríguez <[email protected]>
9cf8c5d
to
df87e80
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Conversation here is too long because we bounced several ideas and also there are too many conflicts. Closing in favor of gh-2853. |
Description
Beginning of gh-2280. Note that this should be complemented by a similar PR in https://github.com/kedro-org/kedro-starters/, and is conditioned by the outcomes of gh-2388. But at least it shows how it would be done. Happy to postpone this PR to a later stage if needed.
Missing: documentation updates and testing all the workflows mentioned in the
README.md
.Development notes
src/requirements.txt
,src/setup.py
andsrc/tests
to the root of the project, essentially rendering the Kedro project into a normal Python library with src-layout, as mentioned in Make all starters usepyproject.toml
#2280 (comment).pyproject.toml
#2280 by consolidating project metadata inpyproject.toml
(decreasing the number of files by 1), while keepingrequirements.txt
for dev requirements (fixing Designate a better place for development requirements in Kedro projects #2519).environment.yml
in the templateREADME.md
, and replaces that by a very short explanation of library requirements vs development requirements.setup.cfg
, which only holds theflake8
configuration, to.flake8
, to remove confusion with the legacysetup.py
and discourage users from adding more stuff there (everything should go topyproject.toml
these days).pip install .[pandas.CSVDataSet]
that is going away soon withpip install kedro-datasets[pandas.CSVDataSet]
.src/requirements.txt
everywhere byrequirements.txt
(error messages and documentation mostly).I recommend using the GitHub functionality to pick what commits to review, especially to remove the last one.
The net result is that this decreases the number of files in the template by 1.
In the end, the workflow for users looks like this:
pip install -r requirements.txt
pip install -e/--editable .
pip install -e .[docs]
The
README.md
file was updated accordingly.Checklist
RELEASE.md
file