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

🩹 added patch command for subworkflows #2861

Merged
merged 29 commits into from
Nov 25, 2024
Merged

🩹 added patch command for subworkflows #2861

merged 29 commits into from
Nov 25, 2024

Conversation

ctuni
Copy link
Contributor

@ctuni ctuni commented Mar 18, 2024

Related to issue: #1891

Is there a straightforward way to test this?

This comment was marked as outdated.

@ctuni ctuni changed the base branch from master to dev March 18, 2024 11:21
@ctuni ctuni linked an issue Mar 18, 2024 that may be closed by this pull request
@ctuni ctuni requested a review from mashehu March 18, 2024 11:31

This comment was marked as resolved.

@ctuni ctuni removed the request for review from mashehu March 18, 2024 12:03
@mashehu
Copy link
Contributor

mashehu commented Mar 18, 2024

for testing you can do similar things to https://github.com/nf-core/tools/blob/master/tests/modules/patch.py

@mirpedrol
Copy link
Member

Hello! @ctuni are you planning to work on this PR, otherwise I would like to take over and finish it up :)

@ctuni
Copy link
Contributor Author

ctuni commented Nov 15, 2024

Hello! Thank you for reviving this, please go ahead and let me know if I can help with anything!

@ewels ewels added this to the 3.1 milestone Nov 21, 2024
@ewels
Copy link
Member

ewels commented Nov 21, 2024

@ctuni this might help your future development work 😉

pip install pre-commit
pre-commit install

It'll run ruff and other tests as part of git commit and fix formatting errors before you push..

@ewels ewels changed the title added patch command for subworkflows 🩹 added patch command for subworkflows Nov 21, 2024
@mirpedrol mirpedrol requested a review from mashehu November 25, 2024 11:23
Copy link
Contributor

@mashehu mashehu left a comment

Choose a reason for hiding this comment

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

Changelog entry is missing

nf_core/__main__.py Outdated Show resolved Hide resolved
Comment on lines +26 to +45
if subworkflow.is_patched:
# If the subworkflow is patched, we need to apply
# the patch in reverse before comparing with the remote
tempdir_parent = Path(tempfile.mkdtemp())
tempdir = tempdir_parent / "tmp_subworkflow_dir"
shutil.copytree(subworkflow.component_dir, tempdir)
try:
new_lines = ComponentsDiffer.try_apply_patch(
subworkflow.component_type,
subworkflow.component_name,
subworkflow.org,
subworkflow.patch_path,
tempdir,
reverse=True,
)
for file, lines in new_lines.items():
with open(tempdir / file, "w") as fh:
fh.writelines(lines)
except LookupError:
# This error is already reported by subworkflow_patch, so just return
Copy link
Contributor

Choose a reason for hiding this comment

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

wtihout checking, this feels like we would also use the same logic inn modules_changes. can we make a components_changes superfunction?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is part of a bigger restructure where we have a components lint instead of splitting modules and subworkflows

tests/subworkflows/test_patch.py Outdated Show resolved Hide resolved
@mirpedrol mirpedrol merged commit 4e4bbaa into nf-core:dev Nov 25, 2024
86 checks passed
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.

Implement nf-core subworkflows patch command
4 participants