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

--containerize is broken #1210

Closed
mfansler opened this issue Oct 9, 2021 · 1 comment
Closed

--containerize is broken #1210

mfansler opened this issue Oct 9, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mfansler
Copy link

mfansler commented Oct 9, 2021

Snakemake version

Bug appears to be introduced in v6.8.1.

Describe the bug

Inclusion of any rules with conda: specifications raises a TypeError when running snakemake --containerize.

The introduction of LocalSourceFile class in v6.8.1 appears to be incompatible with the use of os.path.relpath(env.file, os.getcwd()) in the containerize code.

Logs

Traceback (most recent call last):
  File "/opt/conda/envs/snakemake/lib/python3.9/site-packages/snakemake/__init__.py", line 602, in snakemake
    workflow.containerize()
  File "/opt/conda/envs/snakemake/lib/python3.9/site-packages/snakemake/workflow.py", line 1142, in containerize
    containerize(self)
  File "/opt/conda/envs/snakemake/lib/python3.9/site-packages/snakemake/deployment/containerize.py", line 27, in containerize
    envs = sorted(
  File "/opt/conda/envs/snakemake/lib/python3.9/site-packages/snakemake/deployment/containerize.py", line 25, in <lambda>
    relfile = lambda env: os.path.relpath(env.file, os.getcwd())
  File "/opt/conda/envs/snakemake/lib/python3.9/posixpath.py", line 456, in relpath
    path = os.fspath(path)

TypeError: expected str, bytes or os.PathLike object, not LocalSourceFile

Minimal example

Please see snakemake/snakemake-github-action#17.

Additional context

Recommended Solution

The LocalSourceCode class should implement os.PathLike, which entails implementing an __fspath__() method that returns a str. See os.PathLike.

A test case should be added to catch regression.

@mfansler mfansler added the bug Something isn't working label Oct 9, 2021
mfansler added a commit to mfansler/snakemake that referenced this issue Oct 9, 2021
@johanneskoester
Copy link
Contributor

Fixed with PR #1236. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants