# -*- coding: utf-8 -*-
from distutils.core import setup

package_dir = \
{'': 'src'}

packages = \
['apteco']

package_data = \
{'': ['*'], 'apteco': ['data/*']}

install_requires = \
['apteco-api>=0.1.8,<0.2.0', 'pysimplegui>=4.0,<5.0']

setup_kwargs = {
    'name': 'apteco',
    'version': '0.4.0',
    'description': 'A Python package for interacting with Apteco Marketing Suite resources via the Apteco API.',
    'long_description': 'Quickstart\n==========\n\nRequirements\n------------\n\n* Python 3.6+\n* Access to an installation of the Apteco API\n\nThe Apteco API (which also goes under the name **Orbit API**)\nis part of the Apteco Orbit™ installation.\nIf you have access to Apteco Orbit™, you also have access to the Apteco API!\nIf you\'re not sure about this, contact whoever administers your Apteco software,\nor get in touch with Apteco support (support@apteco.com).\n\nInstallation\n------------\n\nYou can install the package the usual way from PyPI using ``pip``:\n\n.. code-block:: console\n\n   python -m pip install apteco\n\nLogging in\n----------\n\nYour login credentials are the same username and password\nyou would use to log in to Apteco Orbit™:\n\n.. code-block:: python\n\n   from apteco.session import login\n\n   my_session = login("https://my-site.com/OrbitAPI", "my_data_view", "my_system", "jdoe")\n\nYou will be asked to enter your password in the terminal, which won\'t be echoed.\nIf Python is unable to ask for your password in this way,\nit will provide a pop-up box instead.\nThis might appear in the background,\nso check your taskbar for a new window if nothing seems to be happening.\n\nIf you don\'t want to enter your password every time,\nthere\'s also a ``login_with_password()`` function which takes your password\nas a fifth argument:\n\n.. code-block:: python\n\n   from apteco.session import login_with_password\n\n   # password is in plain sight in the code!\n   my_session = login_with_password(\n       "https://my-site.com/OrbitAPI", "my_data_view", "my_system", "jdoe", "password"\n   )\n\nTables\n------\n\nTables are stored in a dictionary at the ``tables`` attribute on the session object.\nYou can retrieve a table using its name:\n\n.. code-block:: python\n\n    >>> bookings = my_session.tables["Bookings"]\n\n``Table`` objects have properties for various metadata:\n\n.. code-block:: python\n\n    >>> print(\n    ...     f"There are {bookings.total_records:,}"\n    ...     f" {bookings.plural_display_name.lower()}"\n    ...     f" in the system."\n    ... )\n    ...\n    There are 2,130,081 bookings in the system.\n\nVariables\n---------\n\nVariables are stored in a dictionary at the ``variables`` attribute\non the session object.\nYou can retrieve a variable using its name:\n\n.. code-block:: python\n\n    >>> cost = my_session.variables["boCost"]\n\nEach table also has a ``variables`` dictionary containing just the variables\non that table:\n\n.. code-block:: python\n\n    >>> destination = bookings.variables["boDest"]\n\n``Variable`` objects have attributes with various metadata:\n\n.. code-block:: python\n\n    >>> cost.description\n    \'Cost\'\n    >>> destination.type\n    \'Selector\'\n\nCreating selections\n-------------------\n\nYou can use the Python operators with ``Variable`` objects to build selections\nbased on criteria and return a count:\n\n.. code-block:: python\n\n    >>> sweden = bookings["boDest"] == "29"\n    >>> sweden.count()\n    25207\n\nYou can specific multiple values using any *Iterable*:\n\n.. code-block:: python\n\n    >>> people = my_session.tables["People"]\n    >>> high_earners = people["peIncome"] == (f"{i:02}" for i in range(7, 12))\n    >>> high_earners.count()\n    7114\n\nYou can use other operators as well; for example, to exclude values:\n\n.. code-block:: python\n\n    >>> uk_only = households["hoRegion"] != "14"  # 14 is Channel Islands\n    >>> uk_only.count()\n    741572\n\nOr to allow a range of values:\n\n.. code-block:: python\n\n    >>> low_profit = bookings["boProfit"] <= 25\n    >>> low_profit.count()\n    211328\n\n.. code-block:: python\n\n    >>> second_half_of_alphabet = people["peSName"] >= "N"\n    >>> second_half_of_alphabet.count()\n    410954\n\nDate and DateTime variables use the built-in ``datetime`` module:\n\n.. code-block:: python\n\n    >>> from datetime import date, datetime\n    >>> bookings_before_2019 = bookings["boDate"] <= date(2018, 12, 31)\n    >>> bookings_before_2019.count()\n    972439\n\nYou can take advantage of functionality available in other Python packages:\n\n.. code-block:: python\n\n    >>> from dateutil.relativedelta import relativedelta\n    >>> under_30 = people["peDOB"] >= date.today() - relativedelta(years=30)\n    >>> under_30.count()\n    207737\n\nCombining selections\n--------------------\n\nYou can use the ``&`` ``|`` operators to combine selection criteria:\n\n.. code-block:: python\n\n    >>> sweden = bookings["boDest"] == "29"\n    >>> cost_at_least_2k = bookings["boCost"] >= 2000\n    >>> expensive_sweden = sweden & cost_at_least_2k\n    >>> expensive_sweden.count()\n    632\n    >>> student = people["peOccu"] == "4"\n    >>> under_21 = people["peDOB"] >= date.today() - relativedelta(years=21)\n    >>> eligible_for_discount = student | under_21\n    >>> eligible_for_discount.count()\n    188364\n\nThe ``~`` operator negates a selection:\n\n.. code-block:: python\n\n    >>> pay_full_price = ~eligible_for_discount\n    >>> pay_full_price.count()\n    968189\n\nYou can join clauses from different tables and it will automatically handle\nthe required table changes:\n\n.. code-block:: python\n\n    >>> high_affordability = high_earners | cost_at_least_2k  # will resolve to people\n    >>> high_affordability.count()\n    56096\n    >>> high_affordability.table_name\n    \'People\'\n\nThe left-most clause determines the resolve table:\n\n.. code-block:: python\n\n    >>> female = people["peGender"] == "F"\n    >>> usa = bookings["boDest"] == "38"\n    >>> female.table_name\n    \'People\'\n    >>> usa.table_name\n    \'Bookings\'\n    >>> (female & usa).table_name\n    \'People\'\n    >>> (usa & female).table_name\n    \'Bookings\'\n\nYou can manually set the resolve table using the ``*`` operator:\n\n.. code-block:: python\n\n    >>> bookings_by_under_21s = bookings * under_21\n    >>> bookings_by_under_21s.count()\n    135100\n    >>> bookings_by_under_21s.table_name\n    \'Bookings\'\n\nCompound clauses follow Python operator precedence:\n\n.. code-block:: python\n\n    >>> student_or_young_female = student | female & under_21\n    >>> student_or_young_female.count()\n    166708\n    >>> student_or_female_must_be_young = (student | female) & under_21\n    >>> student_or_female_must_be_young.count()\n    49225\n\nBe especially careful where compound clauses involve table changes:\n\n.. code-block:: python\n\n    >>> women_to_sweden = female & sweden\n    >>> women_to_sweden.count()  # selection on People table\n    8674\n    >>> audience_1 = bookings * (female & sweden)\n    >>> audience_1.count()  # bookings by women who\'ve been to sweden\n    23553\n    >>> audience_2 = (bookings * female) & sweden\n    >>> audience_2.count()  # bookings made by a woman, with destination of sweden\n    8687\n\nFor a more thorough introduction, check out the Tutorial.\n',
    'author': 'Apteco Ltd',
    'author_email': 'support@apteco.com',
    'url': 'https://github.com/Apteco/py-apteco',
    'package_dir': package_dir,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
