# pythonwhat
[![Build Status](https://travis-ci.org/datacamp/pythonwhat.svg?branch=master)](https://travis-ci.org/datacamp/pythonwhat)
[![PyPI version](https://badge.fury.io/py/pythonwhat.svg)](https://badge.fury.io/py/pythonwhat)
[![Documentation Status](https://readthedocs.org/projects/pythonwhat/badge/?version=stable)](http://pythonwhat.readthedocs.io/en/stable/?badge=stable)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_shield)
Verify Python code submissions and auto-generate meaningful feedback messages. Originally developed for Python exercises on DataCamp for so-called Submission Correctness Tests, but can also be used independently.
- New to teaching on DataCamp? Check out https://instructor-support.datacamp.com
- To learn what SCTs are and how they work, visit [this article](https://instructor-support.datacamp.com/courses/course-development/submission-correctness-tests) specifically.
- For a complete overview of all functionality inside pythonwhat and articles about what to use when, consult https://pythonwhat.readthedocs.io.
## Installation
```bash
# latest stable version from PyPi
pip install pythonwhat
# latest development version from GitHub
pip install git+https://github.com/datacamp/pythonwhat
```
## Demo
To experiment locally, you can use `setup_state()` and write SCTs interactively.
The code throws an error when the underlying checks fail.
```python
# make all checking functions available
from pythonwhat.test_exercise import prep_context
_, ctxt = prep_context()
globals().update(ctxt)
# initialize state with student and solution submission
from pythonwhat.test_exercise import setup_state
setup_state(stu_code = "x = 5", sol_code = "x = 4")
Ex().check_object('x')
# No error: x is defined in both student and solution process
Ex().check_object('x').has_equal_value()
# TestFail: Did you correctly define the variable `x`? Expected `4`, but got `5`.
# Debugging state
Ex()._state # access state object
dir(Ex()._state) # list all elements available in the state object
Ex()._state.student_code # access student_code of state object
```
To learn how to include an SCT in a DataCamp course, visit https://instructor-support.datacamp.com.
## Run tests
```bash
pyenv local 3.9.6
pip3.9 install -r requirements.txt
pip3.9 install -e .
pytest
```
## Contributing
Bugs? Questions? Suggestions? [Create an issue](https://github.com/datacamp/pythonwhat/issues/new), or [contact us](mailto:content-engineering@datacamp.com)!
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_large)
Raw data
{
"_id": null,
"home_page": "https://github.com/datacamp/pythonwhat",
"name": "pythonwhat",
"maintainer": "Jeroen Hermans",
"docs_url": null,
"requires_python": "",
"maintainer_email": "content-engineering@datacamp.com",
"keywords": "",
"author": "Filip Schouwenaars",
"author_email": "filip@datacamp.com",
"download_url": "https://files.pythonhosted.org/packages/a9/53/cf30465ae90e5f342cb78c1554591b5ef627ebfabb3ea29b379d0737e86f/pythonwhat-2.24.4.tar.gz",
"platform": null,
"description": "# pythonwhat\n\n[![Build Status](https://travis-ci.org/datacamp/pythonwhat.svg?branch=master)](https://travis-ci.org/datacamp/pythonwhat)\n[![PyPI version](https://badge.fury.io/py/pythonwhat.svg)](https://badge.fury.io/py/pythonwhat)\n[![Documentation Status](https://readthedocs.org/projects/pythonwhat/badge/?version=stable)](http://pythonwhat.readthedocs.io/en/stable/?badge=stable)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_shield)\n\nVerify Python code submissions and auto-generate meaningful feedback messages. Originally developed for Python exercises on DataCamp for so-called Submission Correctness Tests, but can also be used independently.\n\n- New to teaching on DataCamp? Check out https://instructor-support.datacamp.com\n- To learn what SCTs are and how they work, visit [this article](https://instructor-support.datacamp.com/courses/course-development/submission-correctness-tests) specifically.\n- For a complete overview of all functionality inside pythonwhat and articles about what to use when, consult https://pythonwhat.readthedocs.io.\n\n## Installation\n\n```bash\n# latest stable version from PyPi\npip install pythonwhat\n\n# latest development version from GitHub\npip install git+https://github.com/datacamp/pythonwhat\n```\n\n## Demo\n\nTo experiment locally, you can use `setup_state()` and write SCTs interactively.\nThe code throws an error when the underlying checks fail.\n\n```python\n# make all checking functions available\nfrom pythonwhat.test_exercise import prep_context\n_, ctxt = prep_context()\nglobals().update(ctxt)\n\n# initialize state with student and solution submission\nfrom pythonwhat.test_exercise import setup_state\nsetup_state(stu_code = \"x = 5\", sol_code = \"x = 4\")\n\nEx().check_object('x')\n# No error: x is defined in both student and solution process\n\nEx().check_object('x').has_equal_value()\n# TestFail: Did you correctly define the variable `x`? Expected `4`, but got `5`.\n\n# Debugging state\nEx()._state # access state object\ndir(Ex()._state) # list all elements available in the state object\nEx()._state.student_code # access student_code of state object\n```\n\nTo learn how to include an SCT in a DataCamp course, visit https://instructor-support.datacamp.com.\n\n## Run tests\n\n```bash\npyenv local 3.9.6\npip3.9 install -r requirements.txt\npip3.9 install -e .\npytest\n```\n\n## Contributing\n\nBugs? Questions? Suggestions? [Create an issue](https://github.com/datacamp/pythonwhat/issues/new), or [contact us](mailto:content-engineering@datacamp.com)!\n\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_large)\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Submission correctness tests for Python",
"version": "2.24.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "101d6142125e04ef226cbba12738e93385bf6de8f1f8df90ab85c8a7ea0dda67",
"md5": "6497a089eadf4c7e546df24983c79f12",
"sha256": "0ac7e280fe2ab404cbf6788113cbb73f1d7ea96d3afe2ef34a38f6da1435c2c0"
},
"downloads": -1,
"filename": "pythonwhat-2.24.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6497a089eadf4c7e546df24983c79f12",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 85094,
"upload_time": "2023-01-09T09:40:03",
"upload_time_iso_8601": "2023-01-09T09:40:03.197195Z",
"url": "https://files.pythonhosted.org/packages/10/1d/6142125e04ef226cbba12738e93385bf6de8f1f8df90ab85c8a7ea0dda67/pythonwhat-2.24.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a953cf30465ae90e5f342cb78c1554591b5ef627ebfabb3ea29b379d0737e86f",
"md5": "d79bdf929b7e81b5858eb01f832c8122",
"sha256": "ef5c8310f2f1528dbdb725f8c792edcfc6d31e586e36b82c8ec010cf589fae3f"
},
"downloads": -1,
"filename": "pythonwhat-2.24.4.tar.gz",
"has_sig": false,
"md5_digest": "d79bdf929b7e81b5858eb01f832c8122",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 75406,
"upload_time": "2023-01-09T09:40:04",
"upload_time_iso_8601": "2023-01-09T09:40:04.296081Z",
"url": "https://files.pythonhosted.org/packages/a9/53/cf30465ae90e5f342cb78c1554591b5ef627ebfabb3ea29b379d0737e86f/pythonwhat-2.24.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-09 09:40:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "datacamp",
"github_project": "pythonwhat",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"circle": true,
"requirements": [],
"lcname": "pythonwhat"
}