Skip to main content

Lint Nextflow pipelines in Python

Project description

RefTrace

GitHub release Discord chat

Lint Nextflow pipelines in Python.

pip install reftrace

Features

  • Write custom linting rules in Python.
  • Avoid parsing the Nextflow DSL.
  • Access the Nextflow DSL from Python.

Example Rule

@rule
def no_labels(module: Module, results: LintResults):
    for process in module.processes:
        if not process.labels:
            results.warnings.append(
                ModuleWarning(
                    line=process.line,
                    warning=f"process '{process.name}' has no labels"
                )
            )

Getting Started

Run in your pipeline directory:

reftrace generate  # Create rules.py starter rules
reftrace lint

You'll get output like this:

Module: /home/andrew/nf-core/rnaseq/modules/nf-core/preseq/lcextrap/main.nf
  Warning on line 1: process 'PRESEQ_LCEXTRAP' has non-standard labels: ['error_ignore']

Module: /home/andrew/nf-core/rnaseq/modules/nf-core/hisat2/build/main.nf
  Warning on line 1: process 'HISAT2_BUILD' has conflicting labels: ['process_high', 'process_high_memory']

RefTrace automatically runs the linting rules in rules.py on all modules in the pipeline.

Access Nextflow from Python

from reftrace import Module

module = Module("path/to/nextflow.nf")

Limitations

  • Not all parts of the Nextflow DSL are yet exposed. Specifically, only processes are handled. Only directives, process inputs, and process outputs are exposed to linting rules.

  • The parser is not perfect. It doesn't seek to handle all of Groovy, but enough to work in practice. Even so, test coverage could be better. If you encounter a parsing bug, please open an issue.

Acknowledgements

We would like to express our gratitude to the following:

  • The Apache Groovy project.
  • The ANTLR project, for providing the parser generator used in this tool.
  • The Go programming language and its standard library.
  • The Nextflow project and community, for being so welcoming and helpful.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

reftrace-0.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

reftrace-0.0.0-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

reftrace-0.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

reftrace-0.0.0-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

reftrace-0.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

reftrace-0.0.0-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

reftrace-0.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

reftrace-0.0.0-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file reftrace-0.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d20127c5ce3f543af10277c0cf0c598b2c64c5f9fa8683a2954e6586a47b03e5
MD5 4716d39d6f4a4b5ca1375d65f2a94196
BLAKE2b-256 f95c826b7bd1e0ae463b27f62d3e21a330a8fd3e7945fa802eeb8fbd3e13c1f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7589b7face7b17351b33e15a038fc5a3d5cc0225e7ebaaef274d665dcd8ea29c
MD5 c484d82b5f2becaa1d100010039b88d1
BLAKE2b-256 16eb51bba4648b3258de093645f33668700b51675132beab5c7fcbe9f28b41ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ee801637aa6efc6e3f4942769b438ff40ef32b9d3798db6050b91aac829a0a42
MD5 04ce50935240ab0769050ad6e9542aca
BLAKE2b-256 b6bb9149bf70593a83381940da13a9abf74bf75ce5664c96ff8bc4a75ed07477

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88aae877bd9f275f3fbc8a895532065578e502abf0545b64a049017e167b5167
MD5 304511abc9880e6298c76707ed1c2964
BLAKE2b-256 b835c868dde2c2224393135efa4196af59b160dc020718584208f317357da4a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88d6443c9a2ac8a6728e6927d8ea29f968cd73021ee652423edfef724322b435
MD5 555a8000f7c767f852ce2bb35c32b54f
BLAKE2b-256 27793c0d70e5ea41c4e06165e88f2884b8a75928438e71dbb1be26a6faee6ded

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1374c6ab9b444472525a6936161bbf3b61da20ce5205e49625b8d3a594f8b302
MD5 0ac0e18e94617163b5124272d4e01d74
BLAKE2b-256 db7093bb045ec0c7ace8249a87c039b1053d52185ee99835d0aee9b609e387ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8133764e1cdf098e6410a0732d40cdc98d8a08a23a1eb87dc95e4c2f3ea69bb3
MD5 74f2456c4d3ea179fccd989d92588735
BLAKE2b-256 5bcad0fc680d951cc915910ac4d61a9e61cbdd6282d1ef690d08c1c715fcb04b

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reftrace-0.0.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for reftrace-0.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9817af33d4d03fa33487be09e09d95e19393d2e0d90d4ef5b7619b76d42ca877
MD5 a6941de5647d862154d50acb171827b8
BLAKE2b-256 f7a100b88f72b8ab07cf4eec37b69d0b7651fd4f187ae2a90162d4e2660b28da

See more details on using hashes here.

Provenance

The following attestation bundles were made for reftrace-0.0.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: build.yml on RefTrace/RefTrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page