Skip to content

Commit dee24b0

Browse files
fix tests (#2)
1 parent ca3705c commit dee24b0

File tree

7 files changed

+19
-31
lines changed

7 files changed

+19
-31
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ ARG NODE_VERSION="lts/*"
66
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
77
USER vscode
88
RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
9-
'poetry==1.1.13' \
10-
'pip==22.1.2'
9+
'poetry==1.6.1' \
10+
'pip==23.2.1'
1111
RUN npm install -g @devcontainers/cli@v0.30.0

.devcontainer/devcontainer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
}
1111
},
1212
"mounts": [
13-
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
14-
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
15-
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached",
13+
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
14+
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
15+
// "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached",
1616
// Add the paths below if you know you use them on your local machine and want them to be available in your container.
17-
//
18-
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
19-
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
20-
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
17+
// //
18+
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
19+
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
20+
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
2121
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kube/config,target=/home/vscode/.kube/config,type=bind,consistency=cached",
2222
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kc,target=/home/vscode/.kc,type=bind,consistency=cached",
2323
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.azure/msal_http_cache.bin,target=/home/vscode/.azure/msal_http_cache.bin,type=bind,consistency=cached",
@@ -42,6 +42,6 @@
4242
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
4343
"ghcr.io/devcontainers-contrib/features/starship:1": {},
4444
},
45-
"postCreateCommand": "poetry install",
45+
"postCreateCommand": "poetry install --all-extras",
4646
"remoteUser": "vscode"
4747
}

.github/workflows/pytest.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
- run: npm install -g @devcontainers/cli@v0.30.0
1313
- run: devcontainer up --workspace-folder=.
1414
- run: devcontainer exec --workspace-folder=. poetry run pre-commit run --verbose --all-files
15-
- run: devcontainer exec --workspace-folder=. poetry run pytest --cov-report=xml --cov=src
1615
- uses: codecov/codecov-action@v1
1716
with:
1817
file: coverage.xml
@@ -25,8 +24,8 @@ jobs:
2524
- macos-latest
2625
python-version:
2726
- "3.8"
28-
# - "3.9"
29-
# - "3.10"
27+
- "3.9"
28+
- "3.10"
3029
- "3.11"
3130
runs-on: ${{ matrix.os }}
3231
steps:
@@ -35,10 +34,8 @@ jobs:
3534
with:
3635
python-version: ${{ matrix.python-version }}
3736
- run: pip install poetry
38-
- run: poetry install
37+
- run: poetry install --all-extras
3938
- run: poetry run pytest --cov-report=xml --cov=src
4039
- uses: codecov/codecov-action@v1
4140
with:
4241
file: coverage.xml
43-
44-
# TODO README and workflows for e2e test, package release, devcon build

.github/workflows/test-publish-to-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- main
6+
pull_request:
67
jobs:
78
build-n-publish:
89
runs-on: ubuntu-22.04
@@ -15,14 +16,13 @@ jobs:
1516
build_version="$(poetry version -s).dev$(date +%s)"
1617
poetry version $build_version
1718
- run: poetry build
18-
- run: pip install 'pytest==7.1'
1919
- run: pip install dist/*gz --force-reinstall
2020
- run: pip install nbmake nbformat nbclient # necessary for running smoke test
21-
- run: nbwrite tests/resources/nbwrite-in/example.yaml
21+
- run: nbwrite tests/resources/nbwrite-in/minimal.yaml
2222
env:
2323
OPENAI_API_KEY: '${{ secrets.OPENAI_API_KEY }}'
2424
- run: pip install dist/*whl --force-reinstall
25-
- run: nbwrite tests/resources/nbwrite-in/example.yaml
25+
- run: nbwrite tests/resources/nbwrite-in/minimal.yaml
2626
env:
2727
OPENAI_API_KEY: '${{ secrets.OPENAI_API_KEY }}'
2828
- run: pip install twine==4.0.1

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ export OPENAI_API_KEY='sk-xxxx'
3535
e.g. nbwrite/example1.yaml:
3636
```yaml
3737
task: |
38-
Create a hello world notebook 'x.ipynb', use nbmake's NotebookRun class to test it from a Python application
39-
steps:
40-
- Create a hello world notebook using nbformat
41-
- Use nbmake's NotebookRun class to execute it from a Python application
42-
- Check the output notebook printed what we were expecting
43-
packages:
44-
- nbmake
38+
Plot the iris dataset using pandas
4539
generation:
4640
count: 2
4741
```
@@ -136,6 +130,3 @@ using Phoenix.
136130
```
137131
1. In another termianl, run nbwrite with the following var set: `export NBWRITE_PHOENIX_TRACE=1`
138132
1. Check the phoenix traces in the dashboard (default http://127.0.0.1:6060/)
139-
140-
141-
## TODO make phoenix optional, fix empty packages bug

src/nbwrite/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class GenerationConfig(BaseModel):
14-
count: int = 2
14+
count: int = 1
1515
system_prompt: str = DEFAULT_SYSTEM_PROMPT
1616
llm_kwargs: Dict[str, Any] = DEFAULT_LLM_KWARGS
1717
retriever_kwargs: Dict[str, Any] = DEFAULT_RETRIEVER_KWARGS

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ def test_cli_minimal(tmpdir: local):
8585

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

0 commit comments

Comments
 (0)