dotenv-cli


Namedotenv-cli JSON
Version 3.3.0 PyPI version JSON
download
home_pageNone
SummarySimple dotenv CLI.
upload_time2024-04-07 12:55:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2018 Bastian Venthur Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dotenv cli .env
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dotenv CLI

Dotenv-CLI provides the `dotenv` command. `dotenv` loads the `.env` file from
the current directory, puts the contents in the environment by either changing
existing- or adding new environment variables, and executes the given command.

`dotenv` supports alternative `.env` files like `.env.development` via the `-e`
or `--dotenv` parameters.

With the `--replace` flag, `dotenv` also provides an option to completely
replace the environment variables with the ones from the `.env` file, allowing
you to control exactly which environment variables are set.

`dotenv` provides bash completion, so you can use `dotenv` like this:

```bash
$ dotenv make <TAB>
all      clean    docs     lint     release  test
```

## Install

### Using PyPi

dotenv-cli is [available on PyPi][pypi], you can install it via:

[pypi]: https://pypi.org/project/dotenv-cli/

```bash
$ pip install dotenv-cli
```

### On Debian and Ubuntu

Alternatively, you can install dotenv-cli on Debian based distributions via:

```bash
# apt-get install python3-dotenv-cli
```


## Usage

Create an `.env` file in the root of your project and populate it with some
values like so:

```sh
SOME_SECRET=donttrythisathome
SOME_CONFIG=foo
```

Just prepend the command you want to run with the extra environment variables
from the `.env` file with `dotenv`:

```bash
$ dotenv some-command
```

and those variables will be available in your environment variables.


## Rules

The parser understands the following:

* Basic unquoted values (`BASIC=basic basic`)
* Lines starting with `export` (`export EXPORT=foo`), so you can `source` the
  file in bash
* Lines starting with `#` are ignored (`# Comment`)
* Empty values (`EMPTY=`) become empty strings
* Inner quotes are maintained in basic values: `INNER_QUOTES=this 'is' a test`
  or `INNER_QUOTES2=this "is" a test`
* White spaces are trimmed from unquoted values: `TRIM_WHITESPACE=  foo  ` and
  maintained in quoted values:  `KEEP_WHITESPACE="  foo  "`
* Interpret escapes (e.g. `\n`) in double quoted values, keep them as-is in
  single quoted values.

Example `.env` file:

```sh
BASIC=basic basic
export EXPORT=foo
EMPTY=
INNER_QUOTES=this 'is' a test
INNER_QUOTES2=this "is" a test
TRIM_WHITESPACE= foo
KEEP_WHITESPACE="  foo  "
MULTILINE_DQ="multi\nline"
MULTILINE_SQ='multi\nline'
MULTILINE_NQ=multi\nline
#
# some comment
```

becomes:

```sh
$ dotenv env
BASIC=basic basic
EXPORT=foo
EMPTY=
INNER_QUOTES=this 'is' a test
INNER_QUOTES2=this "is" a test
TRIM_WHITESPACE=foo
KEEP_WHITESPACE=  foo
MULTILINE_DQ=multi
line
MULTILINE_SQ=multi\nline
MULTILINE_NQ=multi\nline
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dotenv-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "dotenv, cli, .env",
    "author": null,
    "author_email": "Bastian Venthur <mail@venthur.de>",
    "download_url": "https://files.pythonhosted.org/packages/07/1a/912b0a56efa531a4d16ed83dc865463681137fad56bcf3dbca46cda0d23c/dotenv-cli-3.3.0.tar.gz",
    "platform": null,
    "description": "# dotenv CLI\n\nDotenv-CLI provides the `dotenv` command. `dotenv` loads the `.env` file from\nthe current directory, puts the contents in the environment by either changing\nexisting- or adding new environment variables, and executes the given command.\n\n`dotenv` supports alternative `.env` files like `.env.development` via the `-e`\nor `--dotenv` parameters.\n\nWith the `--replace` flag, `dotenv` also provides an option to completely\nreplace the environment variables with the ones from the `.env` file, allowing\nyou to control exactly which environment variables are set.\n\n`dotenv` provides bash completion, so you can use `dotenv` like this:\n\n```bash\n$ dotenv make <TAB>\nall      clean    docs     lint     release  test\n```\n\n## Install\n\n### Using PyPi\n\ndotenv-cli is [available on PyPi][pypi], you can install it via:\n\n[pypi]: https://pypi.org/project/dotenv-cli/\n\n```bash\n$ pip install dotenv-cli\n```\n\n### On Debian and Ubuntu\n\nAlternatively, you can install dotenv-cli on Debian based distributions via:\n\n```bash\n# apt-get install python3-dotenv-cli\n```\n\n\n## Usage\n\nCreate an `.env` file in the root of your project and populate it with some\nvalues like so:\n\n```sh\nSOME_SECRET=donttrythisathome\nSOME_CONFIG=foo\n```\n\nJust prepend the command you want to run with the extra environment variables\nfrom the `.env` file with `dotenv`:\n\n```bash\n$ dotenv some-command\n```\n\nand those variables will be available in your environment variables.\n\n\n## Rules\n\nThe parser understands the following:\n\n* Basic unquoted values (`BASIC=basic basic`)\n* Lines starting with `export` (`export EXPORT=foo`), so you can `source` the\n  file in bash\n* Lines starting with `#` are ignored (`# Comment`)\n* Empty values (`EMPTY=`) become empty strings\n* Inner quotes are maintained in basic values: `INNER_QUOTES=this 'is' a test`\n  or `INNER_QUOTES2=this \"is\" a test`\n* White spaces are trimmed from unquoted values: `TRIM_WHITESPACE=  foo  ` and\n  maintained in quoted values:  `KEEP_WHITESPACE=\"  foo  \"`\n* Interpret escapes (e.g. `\\n`) in double quoted values, keep them as-is in\n  single quoted values.\n\nExample `.env` file:\n\n```sh\nBASIC=basic basic\nexport EXPORT=foo\nEMPTY=\nINNER_QUOTES=this 'is' a test\nINNER_QUOTES2=this \"is\" a test\nTRIM_WHITESPACE= foo\nKEEP_WHITESPACE=\"  foo  \"\nMULTILINE_DQ=\"multi\\nline\"\nMULTILINE_SQ='multi\\nline'\nMULTILINE_NQ=multi\\nline\n#\n# some comment\n```\n\nbecomes:\n\n```sh\n$ dotenv env\nBASIC=basic basic\nEXPORT=foo\nEMPTY=\nINNER_QUOTES=this 'is' a test\nINNER_QUOTES2=this \"is\" a test\nTRIM_WHITESPACE=foo\nKEEP_WHITESPACE=  foo\nMULTILINE_DQ=multi\nline\nMULTILINE_SQ=multi\\nline\nMULTILINE_NQ=multi\\nline\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2018 Bastian Venthur  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Simple dotenv CLI.",
    "version": "3.3.0",
    "project_urls": {
        "Changelog": "https://github.com/venthur/dotenv-cli/blob/master/CHANGELOG.md",
        "Documentation": "https://dotenv-cli.readthedocs.io/",
        "Source": "https://github.com/venthur/dotenv-cli"
    },
    "split_keywords": [
        "dotenv",
        " cli",
        " .env"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3c296bc0c1088dc50d8fbefab3d5a99197b33304192274b065ebdcbbb5b8626",
                "md5": "2cfd4f72b7f0dacbfe78ddc9d5d0636f",
                "sha256": "7b03665fad2fc940c5cf2ecee510ca67e740a240163721c8ba969d38ba252706"
            },
            "downloads": -1,
            "filename": "dotenv_cli-3.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2cfd4f72b7f0dacbfe78ddc9d5d0636f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6879,
            "upload_time": "2024-04-07T12:55:52",
            "upload_time_iso_8601": "2024-04-07T12:55:52.838687Z",
            "url": "https://files.pythonhosted.org/packages/d3/c2/96bc0c1088dc50d8fbefab3d5a99197b33304192274b065ebdcbbb5b8626/dotenv_cli-3.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "071a912b0a56efa531a4d16ed83dc865463681137fad56bcf3dbca46cda0d23c",
                "md5": "651a1654c2401063c70d263f4ba73eae",
                "sha256": "4d583c1939c818f04966a86dda4b9a781fefe2e31a48a1b3228795423eff72a4"
            },
            "downloads": -1,
            "filename": "dotenv-cli-3.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "651a1654c2401063c70d263f4ba73eae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8906,
            "upload_time": "2024-04-07T12:55:55",
            "upload_time_iso_8601": "2024-04-07T12:55:55.298240Z",
            "url": "https://files.pythonhosted.org/packages/07/1a/912b0a56efa531a4d16ed83dc865463681137fad56bcf3dbca46cda0d23c/dotenv-cli-3.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-07 12:55:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "venthur",
    "github_project": "dotenv-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dotenv-cli"
}
        
Elapsed time: 0.23199s