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

Consolidate all requirements #2597

Merged
merged 8 commits into from Jul 18, 2023
Merged

Consolidate all requirements #2597

merged 8 commits into from Jul 18, 2023

Conversation

astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented May 22, 2023

Description

Fix gh-2588.

Development notes

  • Moved dependency/requirements.txt to pyproject.toml, removed relevant code from setup.py
  • Moved test_requirements.txt to setup.py (where all the optional dependencies live at the moment)
  • Removed all references to test_requirements.txt and dependency/requirements.txt in CI
  • Adjusted various dependencies

Notice that I had to partially revert https://github.com/quantumblacklabs/private-kedro/pull/365 (private link). I did a quick test and the change seemed innocuous, but we should make sure that there are no problems when making a release (see original rationale https://github.com/quantumblacklabs/private-kedro/pull/352#issuecomment-564948371 also private)

Tested on Gitpod (Linux) on 3.7, 3.8, 3.9, and 3.10 ✔️ pip check always successful after pip install .[all,test] (no conflicting requirements).

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change in the RELEASE.md file
  • Added tests to cover my changes

@astrojuanlu

This comment was marked as resolved.

@astrojuanlu

This comment was marked as resolved.

@astrojuanlu astrojuanlu mentioned this pull request May 29, 2023
5 tasks
@sbrugman
Copy link
Contributor

sbrugman commented Jun 13, 2023

error in project_dummy setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected package name at the start of dependency specifier

Might be solved by upgrading setuptools (otherwise the requirements syntax is probably invalid).

Great to see progress on moving to pyproject.toml. Would be amazing if Kedro, the first-party Kedro plugins and the starter templates set the right standard (unfortunately not there yet)!

@astrojuanlu
Copy link
Member Author

Thanks for the encouragement @sbrugman! Indeed that's the idea, we want to move everything to modern packaging standards. This is the way 🚀

@astrojuanlu astrojuanlu force-pushed the dev/fix-requirements branch 3 times, most recently from 4e7d2a8 to 42145d5 Compare July 10, 2023 23:32
@sbrugman

This comment was marked as off-topic.

@astrojuanlu

This comment was marked as off-topic.

@astrojuanlu

This comment was marked as resolved.

@astrojuanlu astrojuanlu marked this pull request as ready for review July 11, 2023 07:20
@merelcht

This comment was marked as resolved.

@astrojuanlu
Copy link
Member Author

🤷🏽 pylint-dev/pylint#8845

I'm not waiting for pylint to fix this though, will ignore this for good

@astrojuanlu astrojuanlu force-pushed the dev/fix-requirements branch 4 times, most recently from a024621 to 0bba85f Compare July 12, 2023 15:50
@astrojuanlu
Copy link
Member Author

I removed import sorting from pylint since we were using isort anyway. All tests passing 👍🏽


if reqs_path.is_file():
old_reqs = reqs_path.read_text().splitlines()
new_reqs = []
for req in old_reqs:
if req.startswith("kedro"):
new_reqs.append(kedro_reqs)
if req.startswith("kedro") and Requirement(req).name.lower() == "kedro":
Copy link
Member Author

Choose a reason for hiding this comment

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

The logic before was to replace kedro with all kedro dependencies. In a way, something like pip install kedro --dependencies-only (which doesn't exist I believe).

Now I'm just removing kedro, because this is only for our tests and the behave environment has the development version of kedro preinstalled already.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also I made one improvement: parsing the requirement name so we are only dropping kedro and not, say, kedro-datasets or kedro-airflow. This was incorrect before.

@@ -139,10 +132,77 @@ def _collect_requirements(requires):
}

extras_require["all"] = _collect_requirements(extras_require)
extras_require["test"] = [
Copy link
Member Author

Choose a reason for hiding this comment

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

These are more or less the same as kedro-datasets[all], but since we're removing datasets from framework soon, I just copy pasted test_requirements.txt here and didn't aim to substantially change what we're doing. Most of these can go away in 0.19.0.

Copy link
Member

@merelcht merelcht left a comment

Choose a reason for hiding this comment

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

Thank you for making this change @astrojuanlu ⭐ I'm glad the requirements are cleaned up like this. I would add this change to the release notes as well.

@merelcht

This comment was marked as resolved.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
kedro is preinstalled in the behave environment,
so this should not be needed.
In exchange, requirements.txt files can always be read
by setuptools automatic parsing.

See McK-Private/private-kedro#352 (comment)
for motivation of the original logic.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Fix gh-2588.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Copy link
Contributor

@SajidAlamQB SajidAlamQB left a comment

Choose a reason for hiding this comment

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

Thank you @astrojuanlu!

@astrojuanlu astrojuanlu merged commit 4eb6d87 into main Jul 18, 2023
35 checks passed
@astrojuanlu astrojuanlu deleted the dev/fix-requirements branch July 18, 2023 09:04
noklam pushed a commit that referenced this pull request Jul 24, 2023
* Empty

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Avoid adding problematic lines to requirements.txt

kedro is preinstalled in the behave environment,
so this should not be needed.
In exchange, requirements.txt files can always be read
by setuptools automatic parsing.

See McK-Private/private-kedro#352 (comment)
for motivation of the original logic.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Consolidate all requirements

Fix gh-2588.

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Fix dependencies

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Ignore import order in pylint in favour of isort

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Do not replace kedro plugins in e2e tests

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Fix dependabot config

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

* Add release notes

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>

---------

Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
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.

Install Kedro, plugin, and test requirements in a single pip install command
5 participants