pyawait


Namepyawait JSON
Version 0.1.6 PyPI version JSON
download
home_pageNone
SummaryWait until TCP endpoints are open
upload_time2024-08-24 13:51:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3
licenseNone
keywords wait-for-it waitforit await tcp docker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # await / pyawait

`await` is a tool that waits until TCP endpoints are open.

It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers.

This is yet another alternative to `wait-for-it.sh`.

## Rationale

- extended functionality:
    - ability to wait more than one endpoint at the same time (e.g. `-a host:port -a host:port ...`)
    - ability to set polling interval (e.g. `-i 100ms`)
    - timeout/interval can be provided in different time units (`ns,ms,s,m,h`)
- available as a binary file (size <1mb) without any dependencies
- available via `pip` for convenience

## Installation

Download executable binary:

`sh -c "TARGET=await curl -o $TARGET https://raw.githubusercontent.com/jackcvr/await/main/pyawait/await-$(uname -m) && chmod +x $TARGET"`

or:

`pip install pyawait`

[![PyPI - Version](https://img.shields.io/pypi/v/pyawait.svg)](https://pypi.org/project/pyawait)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyawait.svg)](https://pypi.org/project/pyawait)

## Usage

```text
Usage: await [-t timeout] [-i interval] [-q] [-v] [-s=false] [-a host:port ...] [command [args]]

  -a value
    	Endpoint to be waiting for, in the form 'host:port'
  -i duration
    	Interval between retries in format N{ns,ms,s,m,h} (default 1s)
  -q	Do not print anything (default false)
  -s	Strict mode: execute command after successful result only (default true)
  -t duration
    	Timeout in format N{ns,ms,s,m,h}, e.g. '5s' == 5 seconds. Zero for no timeout (default 0)
  -v	Verbose mode (default false)
  command args
    	Execute command with arguments after the test finishes (default: if connection succeeded)
```

## Examples

Wait 5 seconds for port 80 on `www.google.com`, and if it is available, echo the message `Google is up`:

```bash
$ await -t 5s -a www.google.com:80 echo "Google is up"
2024/08/23 12:34:32.156464 successfully connected to www.google.com:80
Google is up
```

You can provide few addresses at the same time.

Next command waits 2 seconds for www.google.com:80 and localhost:5000, checking them every 500 milliseconds
with enabled verbose mode and disabled strict mode:

```bash
$ await -t 2s -i 500ms -v -s=false -a www.google.com:80 -a localhost:5000 echo "Printed anyway"
2024/08/23 14:42:03.171442 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/23 14:42:03.248549 successfully connected to www.google.com:80
2024/08/23 14:42:03.682781 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/23 14:42:04.183945 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/23 14:42:04.686111 dial tcp 127.0.0.1:5000: connect: connection refused
2024/08/23 14:42:05.187927 dial tcp: lookup localhost: i/o timeout
timeout error
Printed anyway
```

## License

[MIT](https://spdx.org/licenses/MIT.html) 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyawait",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": "wait-for-it, waitforit, await, tcp, docker",
    "author": null,
    "author_email": "Andrii Kuzmin <jack.cvr@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/6f/b9/c55a4313614594991cca1fb19967433020f5e75d49a9ed9ac8f9df0211c9/pyawait-0.1.6.tar.gz",
    "platform": null,
    "description": "# await / pyawait\n\n`await` is a tool that waits until TCP endpoints are open.\n\nIt is useful for synchronizing the spin-up of interdependent services, such as linked docker containers.\n\nThis is yet another alternative to `wait-for-it.sh`.\n\n## Rationale\n\n- extended functionality:\n    - ability to wait more than one endpoint at the same time (e.g. `-a host:port -a host:port ...`)\n    - ability to set polling interval (e.g. `-i 100ms`)\n    - timeout/interval can be provided in different time units (`ns,ms,s,m,h`)\n- available as a binary file (size <1mb) without any dependencies\n- available via `pip` for convenience\n\n## Installation\n\nDownload executable binary:\n\n`sh -c \"TARGET=await curl -o $TARGET https://raw.githubusercontent.com/jackcvr/await/main/pyawait/await-$(uname -m) && chmod +x $TARGET\"`\n\nor:\n\n`pip install pyawait`\n\n[![PyPI - Version](https://img.shields.io/pypi/v/pyawait.svg)](https://pypi.org/project/pyawait)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyawait.svg)](https://pypi.org/project/pyawait)\n\n## Usage\n\n```text\nUsage: await [-t timeout] [-i interval] [-q] [-v] [-s=false] [-a host:port ...] [command [args]]\n\n  -a value\n    \tEndpoint to be waiting for, in the form 'host:port'\n  -i duration\n    \tInterval between retries in format N{ns,ms,s,m,h} (default 1s)\n  -q\tDo not print anything (default false)\n  -s\tStrict mode: execute command after successful result only (default true)\n  -t duration\n    \tTimeout in format N{ns,ms,s,m,h}, e.g. '5s' == 5 seconds. Zero for no timeout (default 0)\n  -v\tVerbose mode (default false)\n  command args\n    \tExecute command with arguments after the test finishes (default: if connection succeeded)\n```\n\n## Examples\n\nWait 5 seconds for port 80 on `www.google.com`, and if it is available, echo the message `Google is up`:\n\n```bash\n$ await -t 5s -a www.google.com:80 echo \"Google is up\"\n2024/08/23 12:34:32.156464 successfully connected to www.google.com:80\nGoogle is up\n```\n\nYou can provide few addresses at the same time.\n\nNext command waits 2 seconds for www.google.com:80 and localhost:5000, checking them every 500 milliseconds\nwith enabled verbose mode and disabled strict mode:\n\n```bash\n$ await -t 2s -i 500ms -v -s=false -a www.google.com:80 -a localhost:5000 echo \"Printed anyway\"\n2024/08/23 14:42:03.171442 dial tcp 127.0.0.1:5000: connect: connection refused\n2024/08/23 14:42:03.248549 successfully connected to www.google.com:80\n2024/08/23 14:42:03.682781 dial tcp 127.0.0.1:5000: connect: connection refused\n2024/08/23 14:42:04.183945 dial tcp 127.0.0.1:5000: connect: connection refused\n2024/08/23 14:42:04.686111 dial tcp 127.0.0.1:5000: connect: connection refused\n2024/08/23 14:42:05.187927 dial tcp: lookup localhost: i/o timeout\ntimeout error\nPrinted anyway\n```\n\n## License\n\n[MIT](https://spdx.org/licenses/MIT.html) \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Wait until TCP endpoints are open",
    "version": "0.1.6",
    "project_urls": {
        "Documentation": "https://github.com/jackcvr/await#readme",
        "Issues": "https://github.com/jackcvr/await/issues",
        "Source": "https://github.com/jackcvr/await"
    },
    "split_keywords": [
        "wait-for-it",
        " waitforit",
        " await",
        " tcp",
        " docker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "502fd8defd60adc094630d845643a9b6a319e716f9b3dafdddb3786b9fd140de",
                "md5": "8ea88f24ca313ae44e852100fe06f730",
                "sha256": "5a24f2fea6bafe609b2d6486ca1802d238731cd5f0b498278d68a4a31cd17c44"
            },
            "downloads": -1,
            "filename": "pyawait-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ea88f24ca313ae44e852100fe06f730",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 2538735,
            "upload_time": "2024-08-24T13:51:09",
            "upload_time_iso_8601": "2024-08-24T13:51:09.767188Z",
            "url": "https://files.pythonhosted.org/packages/50/2f/d8defd60adc094630d845643a9b6a319e716f9b3dafdddb3786b9fd140de/pyawait-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fb9c55a4313614594991cca1fb19967433020f5e75d49a9ed9ac8f9df0211c9",
                "md5": "138f6fcf6eb005c6470df1bfd7586a6a",
                "sha256": "62cb5714e44aef45138f2d710c1e0148a0a9a640ee2bdecfbd20d40a3384329d"
            },
            "downloads": -1,
            "filename": "pyawait-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "138f6fcf6eb005c6470df1bfd7586a6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 2540462,
            "upload_time": "2024-08-24T13:51:13",
            "upload_time_iso_8601": "2024-08-24T13:51:13.111778Z",
            "url": "https://files.pythonhosted.org/packages/6f/b9/c55a4313614594991cca1fb19967433020f5e75d49a9ed9ac8f9df0211c9/pyawait-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-24 13:51:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jackcvr",
    "github_project": "await#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyawait"
}
        
Elapsed time: 0.29316s