Skip to content

Commit

Permalink
fix tests (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-treebeard authored Oct 25, 2023
1 parent ca3705c commit dee24b0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
USER vscode
RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.1.13' \
'pip==22.1.2'
'poetry==1.6.1' \
'pip==23.2.1'
RUN npm install -g @devcontainers/[email protected]
16 changes: 8 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
}
},
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
// "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached",
// Add the paths below if you know you use them on your local machine and want them to be available in your container.
//
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
// //
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kube/config,target=/home/vscode/.kube/config,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kc,target=/home/vscode/.kc,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.azure/msal_http_cache.bin,target=/home/vscode/.azure/msal_http_cache.bin,type=bind,consistency=cached",
Expand All @@ -42,6 +42,6 @@
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers-contrib/features/starship:1": {},
},
"postCreateCommand": "poetry install",
"postCreateCommand": "poetry install --all-extras",
"remoteUser": "vscode"
}
9 changes: 3 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
- run: npm install -g @devcontainers/[email protected]
- run: devcontainer up --workspace-folder=.
- run: devcontainer exec --workspace-folder=. poetry run pre-commit run --verbose --all-files
- run: devcontainer exec --workspace-folder=. poetry run pytest --cov-report=xml --cov=src
- uses: codecov/codecov-action@v1
with:
file: coverage.xml
Expand All @@ -25,8 +24,8 @@ jobs:
- macos-latest
python-version:
- "3.8"
# - "3.9"
# - "3.10"
- "3.9"
- "3.10"
- "3.11"
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -35,10 +34,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- run: pip install poetry
- run: poetry install
- run: poetry install --all-extras
- run: poetry run pytest --cov-report=xml --cov=src
- uses: codecov/codecov-action@v1
with:
file: coverage.xml

# TODO README and workflows for e2e test, package release, devcon build
6 changes: 3 additions & 3 deletions .github/workflows/test-publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
pull_request:
jobs:
build-n-publish:
runs-on: ubuntu-22.04
Expand All @@ -15,14 +16,13 @@ jobs:
build_version="$(poetry version -s).dev$(date +%s)"
poetry version $build_version
- run: poetry build
- run: pip install 'pytest==7.1'
- run: pip install dist/*gz --force-reinstall
- run: pip install nbmake nbformat nbclient # necessary for running smoke test
- run: nbwrite tests/resources/nbwrite-in/example.yaml
- run: nbwrite tests/resources/nbwrite-in/minimal.yaml
env:
OPENAI_API_KEY: '${{ secrets.OPENAI_API_KEY }}'
- run: pip install dist/*whl --force-reinstall
- run: nbwrite tests/resources/nbwrite-in/example.yaml
- run: nbwrite tests/resources/nbwrite-in/minimal.yaml
env:
OPENAI_API_KEY: '${{ secrets.OPENAI_API_KEY }}'
- run: pip install twine==4.0.1
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ export OPENAI_API_KEY='sk-xxxx'
e.g. nbwrite/example1.yaml:
```yaml
task: |
Create a hello world notebook 'x.ipynb', use nbmake's NotebookRun class to test it from a Python application
steps:
- Create a hello world notebook using nbformat
- Use nbmake's NotebookRun class to execute it from a Python application
- Check the output notebook printed what we were expecting
packages:
- nbmake
Plot the iris dataset using pandas
generation:
count: 2
```
Expand Down Expand Up @@ -136,6 +130,3 @@ using Phoenix.
```
1. In another termianl, run nbwrite with the following var set: `export NBWRITE_PHOENIX_TRACE=1`
1. Check the phoenix traces in the dashboard (default http://127.0.0.1:6060/)


## TODO make phoenix optional, fix empty packages bug
2 changes: 1 addition & 1 deletion src/nbwrite/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class GenerationConfig(BaseModel):
count: int = 2
count: int = 1
system_prompt: str = DEFAULT_SYSTEM_PROMPT
llm_kwargs: Dict[str, Any] = DEFAULT_LLM_KWARGS
retriever_kwargs: Dict[str, Any] = DEFAULT_RETRIEVER_KWARGS
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ def test_cli_minimal(tmpdir: local):

logger.warn(f"Checking outputs in {outdir}")
outputs = list(Path(outdir).glob("*.ipynb"))
assert len(outputs) == 2
assert len(outputs) == 1

0 comments on commit dee24b0

Please sign in to comment.