Skip to content

--exclude on python < 3.13 #489

@jorenham

Description

@jorenham

Context

#451 introduced the --exclude option to specify which files to exclude from formatting using globs. This is an essential feature for anyone that uses things like submodules, vendors 3rd party libs, or uses in-project virtual environments, which includes e.g. every uv user.
However, this can only be used on python >= 3.13. Attempting to do so on other Python versions will result in a error, and will prevent using mdformat altogether.
In practice, many projects support multiple python versions, and for reasons of compatibility use the lowest supported version for development and testing, and can therefore not use --exclude.

Proposal

Make --exclude available on python<3.13 as well. Something like glob.translate could be used for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions