I'm using Snakemake and it's been rather enjoyable, but I would love it if VSCode stopped complaining about Undefined variable: 'snakemake'. The issue is that Snakemake runs jobs in such a way that it injects this global into your python scope, but IDEs have no idea that it really is defined. I am wondering if there is a way to get it to do two things:
Snakefile (input, output, params, etc.) and its own APIs.
The VSCode extension for Snakemake only relates to the Snakefile syntax. Elsewhere VSCode uses pylint.
Any ideas?
Only slightly better than the other answer is to do:
smk = snakemake # type: ignore
mlp = load_python_obj(smk.input.mlp_model_filename)
This inlines the exclusion to that one line (where snakemake is undefined), but allows the definition of smk so that when when you refer to smk there is no complaint. This allows other relevant cases of undefined variables to still be identified rather than excluding all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With