diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml new file mode 100644 index 0000000000..cb1101e193 --- /dev/null +++ b/.github/workflows/python-test.yml @@ -0,0 +1,30 @@ +# This workflow will install Python dependencies and run tests with a variety of Python versions and OSes +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python tests + +on: push + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [ ubuntu-latest, windows-latest, macos-latest ] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry pytest + cd python && poetry install + - name: Test with pytest + run: | + cd python && poetry run pytest diff --git a/python/DEV_SETUP.md b/python/DEV_SETUP.md index 2e92123470..f480dd5358 100644 --- a/python/DEV_SETUP.md +++ b/python/DEV_SETUP.md @@ -1,6 +1,6 @@ # System setup -To get started, you'll need VSCode and a local installation of Python 3.x. +To get started, you'll need VSCode and a local installation of at least Python 3.8. You can run: @@ -84,4 +84,7 @@ it will prompt you to install them). # Tests -You should be able to run the example under the [tests](tests) folder. +You should be able to run the examples under the [tests/end-to-end](tests/end-to-end/) folder. +Run pytests with the following: + + poetry run pytest diff --git a/python/README.md b/python/README.md index 99f47b28a8..131aec5394 100644 --- a/python/README.md +++ b/python/README.md @@ -19,9 +19,9 @@ AZURE_OPENAI_DEPLOYMENT_NAME="" ## Using Poetry First, navigate to the directory containing this README using your chosen shell. -You will need to have Python 3.10 installed. +You will need to have at least Python 3.8 installed. -Install the Poetry package manager and create a project virtual environment. (Note: we require at least Poetry 1.2.0 and Python 3.10.) +Install the Poetry package manager and create a project virtual environment. (Note: we require at least Poetry 1.2.0 and Python 3.8.) ```bash # Install poetry package @@ -32,10 +32,9 @@ poetry install poetry shell ``` - # Get Started with Semantic Kernel ⚡ -## Example: Running a simple prompt. +## Example: Running a simple prompt ```python import semantic_kernel as sk @@ -64,7 +63,7 @@ Give me the TLDR in exactly 5 words.""") print(prompt()) # => Robots must not harm humans. ``` -## Example: Turn prompts into **reusable functions** with input parameters. +## Example: Turn prompts into **reusable functions** with input parameters ```python # Create a reusable function with one input parameter