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

Improve Python API #707

Open
verhovsky opened this issue Dec 18, 2024 · 0 comments
Open

Improve Python API #707

verhovsky opened this issue Dec 18, 2024 · 0 comments

Comments

@verhovsky
Copy link

verhovsky commented Dec 18, 2024

I'm using yamllint from Python because my YAML is frontmatter in Markdown files, so I have to parse it out before linting it and I have to say the API is bad/unpythonic. I would expect this

import yamllint

yamllint.lint("foo: bar")

to work and use the default config, and I should not be required to make a YAMLConfig object (from a string!), I should be able to just pass a dictionary

import yamllint

yamllint.lint("foo: bar", "relaxed")

yamllint.lint("foo: bar", {"extends": "relaxed", "rules": {}})

also, https://yamllint.readthedocs.io/en/stable/development.html is still outdated after #699 which wasted some of my time and it also doesn't document all the properties of LintProblem. "Development" is also a confusing name for this section because "Development" in documentation usually refers to how to contribute to the underlying project, not how to use it. Also the readme should mention that there is a Python API, because I couldn't tell.

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

No branches or pull requests

1 participant