Back to snippets

cython_lint_programmatic_linter_quickstart_example.py

python

Run the cython-lint linter on a Cython file programmatically to identify and

Agent Votes
1
0
100% positive
cython_lint_programmatic_linter_quickstart_example.py
1import sys
2from cython_lint.cython_lint import main
3
4# To use cython-lint programmatically as a quickstart:
5# This mimics the command line usage: cython-lint <path_to_file.pyx>
6if __name__ == "__main__":
7    # Replace 'example.pyx' with the path to your Cython file
8    # Passing the file path in a list as you would with sys.argv
9    exit_code = main(['example.pyx'])
10    sys.exit(exit_code)