-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from yozachar/workshop
docs: adds configuration info
- Loading branch information
Showing
10 changed files
with
190 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ Resources | |
:caption: Quick Start: | ||
:glob: | ||
|
||
install_and_use | ||
install_config_use | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Install, Configure and Use | ||
|
||
## Installation | ||
|
||
Execute the following command: | ||
|
||
```console | ||
pip install validators | ||
``` | ||
|
||
> It's preferable to use `pip` within a virtual environment. | ||
--- | ||
|
||
## Usage | ||
|
||
```python | ||
from validators import email | ||
print(email('[email protected]')) | ||
``` | ||
|
||
```python | ||
# Output | ||
# True | ||
``` | ||
|
||
--- | ||
|
||
## Configuration | ||
|
||
`validators` employs environment variables prefixed with `PYVLD_` for it's configuration. You can set environment variables as: | ||
|
||
```sh | ||
# bash/zsh/ksh | ||
export PYVLD_CONFIG=VALUE | ||
|
||
# fish | ||
set PYVLD_CONFIG VALUE | ||
``` | ||
|
||
```pwsh | ||
# pwsh | ||
[Environment]::SetEnvironmentVariable("PYVLD_CONFIG", "VALUE", "Machine") | ||
``` | ||
|
||
Currently, the following configuration options are available: | ||
|
||
### **`PYVLD_RAISE_ERROR`** | ||
|
||
- **Reason**: Causes the library to raise [`ValidationError`](/pyvalidators/api/utils/#validators.utils.ValidationError) instead of returning it. | ||
- **Default**: Unset | ||
- **Possible values**: `True`, `False` | ||
|
||
> Note: [`ValidationError`](/pyvalidators/api/utils/#validators.utils.ValidationError) can also be raised by passing `r_ve=True` to the caller function. | ||
### **`PYVLD_CACHE_TLD`** | ||
|
||
- **Reason**: Caches TLD list to speedup lookup. | ||
- **Default**: Unset | ||
- **Possible values**: `True`, `False` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Install, Configure and Use | ||
========================== | ||
|
||
Installation | ||
------------ | ||
|
||
Execute the following command: | ||
|
||
.. code:: console | ||
pip install validators | ||
.. | ||
It's preferable to use ``pip`` within a virtual environment. | ||
|
||
-------------- | ||
|
||
Usage | ||
----- | ||
|
||
.. code:: python | ||
from validators import email | ||
print(email('[email protected]')) | ||
.. code:: python | ||
# Output | ||
# True | ||
-------------- | ||
|
||
Configuration | ||
------------- | ||
|
||
``validators`` uses environment variables prefixed with ``PYVLD_`` for | ||
it's configuration. You can set environment variables as: | ||
|
||
.. code:: sh | ||
# bash/zsh/ksh | ||
export PYVLD_CONFIG=VALUE | ||
# fish | ||
set PYVLD_CONFIG VALUE | ||
.. code:: pwsh | ||
# pwsh | ||
[Environment]::SetEnvironmentVariable("PYVLD_CONFIG", "VALUE", "Machine") | ||
Currently, the following configuration options are available: | ||
|
||
**``PYVLD_RAISE_ERROR``** | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- **Reason**: Causes the library to raise | ||
```ValidationError`` </pyvalidators/api/utils/#validators.utils.ValidationError>`__ | ||
instead of returning it. | ||
- **Default**: Unset | ||
- **Possible values**: ``True``, ``False`` | ||
|
||
.. | ||
Note: | ||
```ValidationError`` </pyvalidators/api/utils/#validators.utils.ValidationError>`__ | ||
can also be raised by passing ``r_ve=True`` to the caller function. | ||
|
||
**``PYVLD_CACHE_TLD``** | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- **Reason**: Caches TLD list to speedup lookup. | ||
- **Default**: Unset | ||
- **Possible values**: ``True``, ``False`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.