monoformat


Namemonoformat JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/Xowap/Monoformat
SummaryA tool that formats all kinds of languages consistently
upload_time2023-09-07 08:38:57
maintainer
docs_urlNone
authorRémy Sanchez
requires_python>=3.10,<4.0
licenseWTFPL
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Monoformat

Opinionated and "zero config" formatters like Black and Prettier are amazing in
the sense that they remove any need for thinking about formatting. However, they
still require you to:

-   Be used separately (one is Python and the other is Node)
-   Be configured for the language version and so forth

Monoformat does this automatically. You can only use the language version that
monoformat allows and you can configure literally nothing except which files
it's going to reformat and which it's not.

## Installation

Monoformat is available on PyPI:

```bash
pip install monoformat
```

## Usage

Monoformat is a command line tool. You can run it with:

```bash
monoformat .
```

This will reformat all files in the current directory and its subdirectories.

It will take care to avoid `.git` and other special directories. There is a
default pattern embedded but you can change it with the `--do-not-enter` flag,
which is a pattern matching folder or file names you don't want to consider.

On addition to the `--do-not-enter` rule, it will by default check all
`.gitignore` files and `.formatignore` files (which use the `.gitignore` syntax
but only affect the decision of whether to format a file or not, not to put them
in git) and.

### Default project

Let's say you have a Django project. It contains lots of files, including a
`node_modules` somewhere and a _a lot_ of big migration files.

You might want to have at the root of your repo a `.gitignore` file that looks
like that:

```
node_modules
.idea
.vscode
.env
*.pyc
```

And then specifically to avoid formatting migrations (which can be super
expensive), and to avoid running prettier on Django templates (which ends up
badly) add a `.formatignore` file that looks like that:

```
**/migrations/*
**/templates/*
```

Then you can run `monoformat .` and it will only format the files that are
relevant to your project.

### Without install

I've actually spent an absurd amount of time to make it extremely simple to run
Python and JS code without installing anything. You can do this with:

```bash
curl -s https://pypi.run/monoformat | python3.10 - .
```

Doing so will entirely reformat with black, isort and prettier the current
directory.

## Supported languages

Monoformat supports the following languages:

-   **Python** 3.10 (Black)
-   **JavaScript** (Prettier)
-   **TypeScript** (Prettier)
-   **JSON** (Prettier)
-   **Markdown** (Prettier)
-   **YAML** (Prettier)
-   **HTML** (Prettier)
-   **CSS** (Prettier)
-   **SCSS** (Prettier)
-   **Vue** (Prettier)
-   **Svelte** (Prettier)
-   **PHP** (Prettier)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Xowap/Monoformat",
    "name": "monoformat",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "R\u00e9my Sanchez",
    "author_email": "remy.sanchez@hyperthese.net",
    "download_url": "https://files.pythonhosted.org/packages/9e/c7/1a4f595e68288746b6a0b29ea9f33c84c8c207acd81810622904ea743462/monoformat-0.2.0.tar.gz",
    "platform": null,
    "description": "# Monoformat\n\nOpinionated and \"zero config\" formatters like Black and Prettier are amazing in\nthe sense that they remove any need for thinking about formatting. However, they\nstill require you to:\n\n-   Be used separately (one is Python and the other is Node)\n-   Be configured for the language version and so forth\n\nMonoformat does this automatically. You can only use the language version that\nmonoformat allows and you can configure literally nothing except which files\nit's going to reformat and which it's not.\n\n## Installation\n\nMonoformat is available on PyPI:\n\n```bash\npip install monoformat\n```\n\n## Usage\n\nMonoformat is a command line tool. You can run it with:\n\n```bash\nmonoformat .\n```\n\nThis will reformat all files in the current directory and its subdirectories.\n\nIt will take care to avoid `.git` and other special directories. There is a\ndefault pattern embedded but you can change it with the `--do-not-enter` flag,\nwhich is a pattern matching folder or file names you don't want to consider.\n\nOn addition to the `--do-not-enter` rule, it will by default check all\n`.gitignore` files and `.formatignore` files (which use the `.gitignore` syntax\nbut only affect the decision of whether to format a file or not, not to put them\nin git) and.\n\n### Default project\n\nLet's say you have a Django project. It contains lots of files, including a\n`node_modules` somewhere and a _a lot_ of big migration files.\n\nYou might want to have at the root of your repo a `.gitignore` file that looks\nlike that:\n\n```\nnode_modules\n.idea\n.vscode\n.env\n*.pyc\n```\n\nAnd then specifically to avoid formatting migrations (which can be super\nexpensive), and to avoid running prettier on Django templates (which ends up\nbadly) add a `.formatignore` file that looks like that:\n\n```\n**/migrations/*\n**/templates/*\n```\n\nThen you can run `monoformat .` and it will only format the files that are\nrelevant to your project.\n\n### Without install\n\nI've actually spent an absurd amount of time to make it extremely simple to run\nPython and JS code without installing anything. You can do this with:\n\n```bash\ncurl -s https://pypi.run/monoformat | python3.10 - .\n```\n\nDoing so will entirely reformat with black, isort and prettier the current\ndirectory.\n\n## Supported languages\n\nMonoformat supports the following languages:\n\n-   **Python** 3.10 (Black)\n-   **JavaScript** (Prettier)\n-   **TypeScript** (Prettier)\n-   **JSON** (Prettier)\n-   **Markdown** (Prettier)\n-   **YAML** (Prettier)\n-   **HTML** (Prettier)\n-   **CSS** (Prettier)\n-   **SCSS** (Prettier)\n-   **Vue** (Prettier)\n-   **Svelte** (Prettier)\n-   **PHP** (Prettier)\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "A tool that formats all kinds of languages consistently",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Xowap/Monoformat",
        "Repository": "https://github.com/Xowap/Monoformat"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46a7c403675395b848917e655962d38ee56f0a9120adde7a2e1966a59ee44400",
                "md5": "c62af408bf6aba6fc7a79353d895f759",
                "sha256": "c9a74657bdd2de7114dc4aa78f0e26796133c88394c03aa760d835dd48b1915d"
            },
            "downloads": -1,
            "filename": "monoformat-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c62af408bf6aba6fc7a79353d895f759",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 9459,
            "upload_time": "2023-09-07T08:38:56",
            "upload_time_iso_8601": "2023-09-07T08:38:56.352281Z",
            "url": "https://files.pythonhosted.org/packages/46/a7/c403675395b848917e655962d38ee56f0a9120adde7a2e1966a59ee44400/monoformat-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ec71a4f595e68288746b6a0b29ea9f33c84c8c207acd81810622904ea743462",
                "md5": "a2002218ff3047fafca7f667cec4ab9a",
                "sha256": "69f5feaf1e76b380f80e57dd047d9e5555fa56d9a834b22a984105c41a716865"
            },
            "downloads": -1,
            "filename": "monoformat-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a2002218ff3047fafca7f667cec4ab9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 8443,
            "upload_time": "2023-09-07T08:38:57",
            "upload_time_iso_8601": "2023-09-07T08:38:57.855109Z",
            "url": "https://files.pythonhosted.org/packages/9e/c7/1a4f595e68288746b6a0b29ea9f33c84c8c207acd81810622904ea743462/monoformat-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-07 08:38:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Xowap",
    "github_project": "Monoformat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "monoformat"
}
        
Elapsed time: 0.51294s