-
Notifications
You must be signed in to change notification settings - Fork 926
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort
requirements.txt
based on package name only (#3436)
* Sort `requirements.txt` based on package name only Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> * Remove now-unused custom `requirements.txt` sorter Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> * Ruff format kedro/templates/project/hooks/utils.py Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> * Pass the right argument to `fix_requirements` call Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> * Add `sort_requirements` until starters are updated Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> * Wrap lib call in existing method for compatibility Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu> --------- Signed-off-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
- Loading branch information
Showing
3 changed files
with
52 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
from pathlib import Path | ||
|
||
from kedro.templates.project.hooks.utils import ( | ||
|
||
setup_template_tools, | ||
sort_requirements, | ||
) | ||
from kedro.templates.project.hooks.utils import setup_template_tools, sort_requirements | ||
|
||
|
||
def main(): | ||
current_dir = Path.cwd() | ||
requirements_file_path = current_dir / "requirements.txt" | ||
pyproject_file_path = current_dir / "pyproject.toml" | ||
python_package_name = '{{ cookiecutter.python_package }}' | ||
python_package_name = "{{ cookiecutter.python_package }}" | ||
|
||
# Get the selected tools from cookiecutter | ||
selected_tools = "{{ cookiecutter.tools }}" | ||
example_pipeline = "{{ cookiecutter.example_pipeline }}" | ||
|
||
# Handle template directories and requirements according to selected tools | ||
setup_template_tools(selected_tools, requirements_file_path, pyproject_file_path, python_package_name, example_pipeline) | ||
setup_template_tools( | ||
selected_tools, | ||
requirements_file_path, | ||
pyproject_file_path, | ||
python_package_name, | ||
example_pipeline, | ||
) | ||
|
||
# Sort requirements.txt file in alphabetical order | ||
sort_requirements(requirements_file_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shouldn't this be a dev dependency?