# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['appmap',
 'appmap._implementation',
 'appmap.test',
 'appmap.test.data',
 'appmap.test.data.package1',
 'appmap.test.data.package1.package2',
 'appmap.test.data.pytest']

package_data = \
{'': ['*']}

install_requires = \
['PyYAML>=5.3.1,<6.0.0', 'inflection>=0.5.1,<0.6.0', 'orjson==3.4.6']

entry_points = \
{'pytest11': ['appmap = appmap.pytest']}

setup_kwargs = {
    'name': 'appmap',
    'version': '0.1.0.dev7',
    'description': 'Create AppMap files by recording a Python application.',
    'long_description': '## About\n`appmap-python` is a Python package for recording\n[AppMaps](https://github.com/applandinc/appmap) of your code. "AppMap" is a data format\nwhich records code structure (modules, classes, and methods), code execution events\n(function calls and returns), and code metadata (repo name, repo URL, commit SHA, labels,\netc). It\'s more granular than a performance profile, but it\'s less granular than a full\ndebug trace. It\'s designed to be optimal for understanding the design intent and structure\nof code and key data flows.\n\nThere are several ways to record AppMaps of your Python program using the `appmap` package:\n\n* Run your tests (pytest, unittest[future work]) with the environment variable\n  `APPMAP=true`. An AppMap will be generated for each test case.\n    \n* Use the `appmap.record` [context manager](#context-manager) to control recording. The context manager takes\n  an instance of an `appmap.Recording`, which can be used to generate the AppMap.\n\n* [future work] Run your application server with AppMap remote recording enabled, and use\n  the [AppLand browser extension](https://github.com/applandinc/appland-browser-extension)\n  to start, stop, and upload recordings.\n  \nOnce you have made a recording, there are two ways to view automatically generated\ndiagrams of the AppMaps.\n\nThe first option is to load the diagrams directly in your IDE, using the [AppMap extension\nfor VSCode](https://marketplace.visualstudio.com/items?itemName=appland.appmap).\n\nThe second option is to upload them to the [AppLand server](https://app.land) using the\n[AppLand CLI](https://github.com/applandinc/appland-cli/releases).  \n\n### Supported versions\n\n* Python 3.9\n* Pytest 6.2\n\nSupport for new versions is added frequently, please check back regularly for updates.\n\n## Configuration\nAdd your modules as `path` entries in `appmap.yml`:\n\n```yaml\nname: my_python_app\npackages:\n- path: app.mod1\n- path: app.mod2\n  exclude:\n  - MyClass\n  - MyOtherClass.my_instance_method\n  - MyOtherClass.my_class_method\n```\n\nNote that `exclude`s are resolved relative to the associated path. So, for example, this\nconfiguration excludes `app.mod2.MyClass`\n\n## Environment Variables\n\n* `APPMAP` if `true`, code will be instrumented and AppMaps will be generated. Not\n  case-sensitive, defaults to \'false\'.\n\n* `APPMAP_CONFIG` specifies the configuration file to use. Defaults to `appmap.yml` in the\n  current directory\n  \n* `APPMAP_LOG_LEVEL` specifies log level to use, from the set `CRITICAL`, `ERROR`,\n  `WARNING`, `INFO`, `DEBUG`. Not case-sensitive, defaults to `WARNING`.\n  \n* `APPMAP_OUTPUT_DIR` specifies the root directory for writing AppMaps. Defaults to\n  `tmp/appmap`.\n  \n## Test Frameworks\n`appmap-python` supports recording [pytest](https://pytest.org) and `unittest`[future\nwork] test cases.\n\n### pytest\n`appmap-python` is a `pytest` plugin. When it\'s installed in a project that uses\n`pytest`, it will be available to generate AppMaps.\n\n```shell\nroot@e9987eaa93c8:/src/appmap/test/data/pytest# pip show appmap\nName: appmap\nVersion: 0.0.0\nSummary: Create AppMap files by recording a Python application.\nHome-page: None\nAuthor: Alan Potter\nAuthor-email: alan@app.land\nLicense: None\nLocation: /usr/local/lib/python3.9/site-packages\nRequires: orjson, PyYAML, inflection\nRequired-by:\nroot@e9987eaa93c8:/src/appmap/test/data/pytest# APPMAP=true APPMAP_LOG_LEVEL=info pytest -svv\n[2021-02-10 11:37:59,345] INFO root: appmap enabled: True\n[2021-02-10 11:37:59,350] INFO appmap._implementation.configuration: ConfigFilter, includes {\'simple\'}\n[2021-02-10 11:37:59,350] INFO appmap._implementation.configuration: ConfigFilter, excludes set()\n===================================================================== test session starts =====================================================================\nplatform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/local/bin/python\ncachedir: .pytest_cache\nrootdir: /src, configfile: pytest.ini\nplugins: appmap-0.0.0\ncollected 1 item\n\ntest_simple.py::test_hello_world [2021-02-10 11:37:59,482] INFO appmap.pytest: starting recording /tmp/pytest/test_hello_world.appmap.json\n[2021-02-10 11:37:59,484] INFO appmap._implementation.configuration: included class simple.Simple\n[2021-02-10 11:37:59,484] INFO appmap._implementation.configuration: included function simple.Simple.hello\n[2021-02-10 11:37:59,489] INFO appmap._implementation.configuration: included function simple.Simple.hello_world\n[2021-02-10 11:37:59,490] INFO appmap._implementation.configuration: included function simple.Simple.world\n[2021-02-10 11:37:59,828] INFO appmap.pytest: wrote recording /tmp/pytest/test_hello_world.appmap.json\nPASSED\n\n====================================================================== 1 passed in 0.45s ======================================================================\n```\n\n### unittest [future work]\n`import appmap.unittest`. Instruments subclasses of `unittest.TestCase` and records each\n`test_*` function in the subclasses.\n\n### Run your tests\nOnce you\'ve configured your tests to generate AppMaps, run the tests with the\n`APPMAP=true` in the environment. For example, to run a pytest test suite:\n\n```sh\n$ APPMAP=true pytest\n```\n\n\n## Remote Recording [future work]\n`appmap-python` supports remote recording of Django and Flask web applications. Import the\nappropriate remote recording support into your web app.\n\n### Django\n`import appmap.django`. Adds `/_appmap/record` routes to a Django app.\n\n## Flask\n`import appmap.flask`. Adds `/_appmap/record` routes to a Flask app.\n\n## Run your web app [future work]\nOnce you\'ve configured your web app to add the remote-recording routes, you can use the\nroutes to manage recordings. The browser extension, appland CLI, or just plain cURL will\nall work for this.\n\nAs when running tests, start the web server with `APPMAP=true` in the environment. For\nexample, to start a Django app:\n\n```sh\n$ APPMAP=true python manage.py runserver\n```\n\nAn app with remote recording enabled supports these routes:\n\n* `POST /_appmap/record`\n  Starts a new recording\n\n  200 if the recording was started successfully\n  409 if there\'s already a recording in progress\n\n* `GET /_appmap/record`\n  Returns JSON describing current recording state\n  200 with body\n\n  ```json\n  {\n    "enabled": true\n  }\n  ```\n  `enabled` indicates whether recording has been enabled\n\n* `DELETE /_appmap/record`\n  Returns AppMap as JSON\n  200 with AppMap as body\n  404 if there\'s no recording in progress\n\n## Context manager\nYou can use `appmap.record` as a context manager to record your code.\n\nWith a file called `record_sample.py` like this\n\n```python\nimport os\nimport sys\n\nimport appmap\n\nr = appmap.Recording()\nwith r:\n    import sample\n    print(sample.C().hello_world(), file=sys.stderr)\n\nwith os.fdopen(sys.stdout.fileno(), "wb", closefd=False) as stdout:\n    stdout.write(appmap.generation.dump(r))\n    stdout.flush()\n```\n\nand a source file called `sample.py` like this\n\n```python\nclass C:\n    def make_str(self, s):\n        return s;\n\n    def hello_world(self):\n        return f\'{self.make_str("Hello")} {self.make_str("world!")}\'\n```\n\nas well as an `appmap.yml`\n\n```yaml\nname: sample\npackages:\n- path: sample\n```\n\nyou can generate a recording of the code\n\n```sh\n% APPMAP=true python record_sample.py > record_sample.appmap.json\n% jq \'.events | length\' record_sample.appmap.json\n6\n% jq < record_sample.appmap.json | head -10\n{\n  "version": "1.4",\n  "metadata": {\n    "language": {\n      "name": "python",\n      "engine": "CPython",\n      "version": "3.9.1"\n    },\n    "client": {\n      "name": "appmap",\n```\n\n## Development\n\n[![Build Status](https://travis-ci.com/applandinc/appmap-python.svg?branch=master)](https://travis-ci.com/applandinc/appmap-python)\n\n### Dependency management\n\n[poetry](https://https://python-poetry.org/) for dependency management:\n\n```\n% brew install poetry\n% cd appmap-python\n% poetry install\n```\n\n### Linting\n[pylint](https://www.pylint.org/) for linting:\n\n```\n% cd appmap-python\n% poetry run pylint appmap\n\n--------------------------------------------------------------------\nYour code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)\n\n```\n\n[Note that the current configuration requires a 10.0 for the Travis build to pass. To make\nthis easier to achieve, convention and refactoring checks have both been disabled. They\nshould be reenabled as soon as possible.]\n\n\n### Testing\n[pytest](https://docs.pytest.org/en/stable/) for testing:\n\n```\n% cd appmap-python\n% APPMAP=true poetry run pytest\n```\n\n### Code Coverage\n[coverage](https://coverage.readthedocs.io/) for coverage:\n\n```\n% cd appmap-python\n% APPMAP=true poetry run coverage run -m pytest\n% poetry run coverage html\n% open htmlcov/index.html\n```\n',
    'author': 'Alan Potter',
    'author_email': 'alan@app.land',
    'maintainer': None,
    'maintainer_email': None,
    'url': None,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
