semvec/pypi-packages huggingface dataset:
swifpy 0.0.1
Makes Python Swifty
License: MIT
Keywords: swift swifty

Swifpy
======

*Swifpy* makes Python Swifty. It provides some types which have similar
APIs with Swift's.

.. code:: python

    from swifpy import Array, Dictionary, Int, Optional, Some, String

    array: Array[Int] = Array([2, 3, 5])
    squared: Array[Int] = array.map(lambda x: x * x)  # [4, 9, 25]
    count: Int = array.count  # 3

    dictionary: Dictionary[String, Int] = Dictionary({'a': 2, 'b': 3, 'c': 5})
    a: Optional[Int] = dictionary['a']  # Optional(2)
    b: Optional[Int] = dictionary['b']  # Optional(3)

    sum: Optional[Int] = a.flat_map(lambda x: b.map(lambda y: x + y))  # Optional(5)

Usage
-----

Bool, Float, Int, String
~~~~~~~~~~~~~~~~~~~~~~~~

They are just type aliases of ``bool``, ``float``, ``int`` and ``str``
respectivly.

Array
~~~~~

.. code:: python

    from swifpy import Array, Int, Optional, Some

    numbers: Array[Int] = Array([2, 3, 5])

    second: Int = numbers[1]    # 3
    count: Int = numbers.count  # 3

    squared: Array[Int] = numbers.map(lambda x: x * x)             # [4, 9, 25]
    odd: Array[Int] = numbers.filter(lambda x: x % 2 != 0)         # [3, 5]
    sum: Array[Int] = numbers.reduce(0, lambda r, x: r + x)        # 10
    twice: Array[Int] = numbers.flat_map(lambda x: Array([x, x]))  # [2, 2, 3, 3, 5, 5]

    first: Optional[Int] = numbers.first  # Optional(2)
    third: Optional[Int] = numbers.last   # Optional(5)

    for number in numbers:
        print(number)

Dictionary
~~~~~~~~~~

.. code:: python

    from swifpy import Dictionary, Int, Optional, Some, String

    dictionary: Dictionary[String, Int] = Dictionary({'a': 2, 'b': 3, 'c': 5})

    a: Optional[Int] = dictionary['a']  # Optional(2)
    dictionary['d'] = 7
    count: Int = dictionary.count  # 4

    for key, value in dictionary:
        print("%s -> %d" % (key, value))

Optional
~~~~~~~~

.. code:: python

    from swifpy import Int, Nil, Optional, Some, NilError

    a: Optional[Int] = Some(2)
    b: Optional[Int] = Some(3)
    n: Optional[Int] = Nil

    if a:
        print('Reaches here.')

    if not n:
        print('Reaches here.')

    squared1: Optional[Int] = a.map(lambda x: x * x)                    # Optional(4)
    squared2: Optional[Int] = n.map(lambda x: x * x)                    # Nil
    sum1: Optional[Int] = a.flat_map(lambda x: b.map(lambda y: x + y))  # Optional(5)
    sum2: Optional[Int] = a.flat_map(lambda x: n.map(lambda y: x + y))  # Nil

    unwrapped: Int = a.x  # `!` in Swift: `x` of e*x*clamation marks
    _ = n.x  # NilError

    # `??` in Swift: `q` of *q*uestion marks
    coalesced1: Int = a.qq(0)  ## 2
    coalesced2: Int = n.qq(0)  ## 0

License
-------

`The MIT License <LICENSE>`__
httpmeter 0.1.0
Hackable HTTP benchmarking tool.
License: MIT

=====
About
=====

.. image:: https://travis-ci.org/povilasb/httpmeter.svg?branch=master
    :target: https://travis-ci.org/povilasb/httpmeter

This is a hackable python based HTTP/HTTPS benchmarking tool.
It supports traffic proxying for both HTTP and HTTPS, thus also can be used to
test performance of proxy servers.

It is implemented with asyncio and runs on Python >= 3.5.
You can optionally use `uvloop <https://github.com/MagicStack/uvloop>`_ for
better performance.

Usage
=====

::

    pip3 install httpmeter

Synopsis::

    httpmeter [options] URL

Options::

    -h  Display usage information.

    -c, --concurrency <N>
        How many requests should be executed in parallel.

    -n, requests <N>
        How many requests to make in total.

    -H, --header <custom-header>
        Additional headers to send with every request. Multiple entries
        allowed. E.g.
            --header "Connection: close" --header "User-Agent: benchmark"

    -X, --proxy <http://user:pass@proxy:port>
        Proxy address. E.g. http://user1:pass123@localhost:8080

    --uvloop
        Use uvloop to increase networking performance.

    -p N, --process-count N
        Use N processes to distribute requests over separate CPU cores.
        By default uses the same number of processes as there are CPU
        cores.

Other Tools
===========

* https://github.com/httperf/httperf
* https://github.com/wg/wrk
* http://httpd.apache.org/docs/current/programs/ab.html
* https://github.com/borgstrom/httpbenchmark

Development
===========

Get dependencies::

    $ virtualenv --python3 pyenv
    $ pyenv/bin/pip install -r requirements/prod.txt

Run the benchmark::

    $ pyenv/bin/python -m httpmeter -c 100 -n 500 \
        -X http://username:password@1.2.3.4:8080 http://target.com