Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cognitedata/cognite-sdk-python in…
Browse files Browse the repository at this point in the history
…to DiagramsOcr
  • Loading branch information
Ola Liabøtrø committed Sep 5, 2024
2 parents 373d296 + 8a8ed12 commit 7e5f07a
Show file tree
Hide file tree
Showing 194 changed files with 18,358 additions and 2,858 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Dev Container for Cognite Python SDK",

// Python base image reference: https://github.com/devcontainers/images/tree/main/src/python
"image": "mcr.microsoft.com/devcontainers/python:3.12-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.8-bullseye",

// Features to add to the dev container. More info: https://containers.dev/features
"features": {
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ runs:
- name: Install dependencies
shell: bash
run: |
pip install --upgrade pip poetry
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install --no-interaction --no-ansi ${{ inputs.extras }}
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
extras: '-E numpy'
extras: "-E pandas"
- name: Linting and static code checks
run: pre-commit run --all-files

Expand Down Expand Up @@ -46,13 +46,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.11', '3.12'] # TODO: 3.9, 3.10 (requires a lot of work for FakeCogResGen for tests)
python-version: ["3.8", "3.11", "3.12"] # TODO: 3.9, 3.10 (requires a lot of work for FakeCogResGen for tests)
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python_version: ${{ matrix.python-version }}
extras: '-E all'
extras: "-E all"

- name: Test full
env:
Expand All @@ -64,9 +64,10 @@ jobs:
COGNITE_PROJECT: python-sdk-test
COGNITE_BASE_URL: https://greenfield.cognitedata.com
COGNITE_CLIENT_NAME: python-sdk-integration-tests
run: pytest tests --durations=10 --cov --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 --maxfail 20
# Testpaths are defined in the pytest.ini file:
run: pytest --durations=10 --cov --cov-report term --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 --maxfail 20

- uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
if: matrix.os == 'windows-latest' && matrix.python-version == '3.8'
with:
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:

jobs:
test_full_build_and_release:
runs-on: ubuntu-latest
runs-on: windows-latest
environment: CD
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
Expand All @@ -24,11 +25,13 @@ jobs:
COGNITE_PROJECT: python-sdk-test
COGNITE_BASE_URL: https://greenfield.cognitedata.com
COGNITE_CLIENT_NAME: python-sdk-integration-tests
run: pytest tests --durations=10 --cov --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 --maxfail 20
# Testpaths are defined in the pytest.ini file:
run: pytest --durations=10 --cov --cov-report term --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 --maxfail 20

- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

- name: Build package
run: poetry build
Expand All @@ -40,7 +43,7 @@ jobs:
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --verbose dist/* || echo 'Version exists'
run: twine upload --skip-existing --verbose dist/*

# TODO: Make this work again
# - name: Push code snippets to service-contracts
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/verify-jupyter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: build

on:
pull_request:
branches: [master]

jobs:
build_and_test_jupyter_pyodide:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
- name: Build package using poetry
run: |
pip install poetry
poetry build
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install [email protected] # JupyterLite currently using pyodide 0.25.0
- name: Install cognite-sdk in pyodide environment
run: |
whl_file=$(find dist -name "*.whl" | sed 's|^dist/||') # Find the built wheel file, remove dist/ prefix
echo "Found built wheel file: $whl_file"
SDK_FILE_PATH=$whl_file \
PACKAGES="[\"pyodide-http\", \"http://localhost:3000/dist/$whl_file\"]" \
node scripts/test-pyodide.js
33 changes: 33 additions & 0 deletions .github/workflows/verify-streamlit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: build

on:
pull_request:
branches: [master]

jobs:
build_and_test_streamlit_pyodide:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
- name: Build package using poetry
run: |
pip install poetry
poetry build
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install [email protected] # stlite currently using pyodide 0.25.1
- name: Install cognite-sdk in pyodide environment
run: |
whl_file=$(find dist -name "*.whl" | sed 's|^dist/||') # Find the built wheel file, remove dist/ prefix
echo "Found built wheel file: $whl_file"
SDK_FILE_PATH=$whl_file \
PACKAGES="[\"pyodide-http\", \"http://localhost:3000/dist/$whl_file\"]" \
node scripts/test-pyodide.js
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ playground.py
scripts/tmp/
my_file.txt
.venv/
*.env
.envrc
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.6.3
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -48,7 +48,7 @@ repos:
require_serial: true # avoid possible race conditions

- repo: https://github.com/jsh9/pydoclint # Run after 'custom-checks' as these may auto-fix
rev: 0.4.1
rev: 0.5.6
hooks:
- id: pydoclint
require_serial: true # Spammy in run-all scenarios (more than fast enough already)
Expand All @@ -57,3 +57,4 @@ repos:
- --exclude=tests/|scripts/
- --quiet # otherwise prints all checked files that are ok...
- --skip-checking-raises=true
- --check-class-attributes=false
Loading

0 comments on commit 7e5f07a

Please sign in to comment.