Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/docker/build-push-…
Browse files Browse the repository at this point in the history
…action-6.3.0
  • Loading branch information
amrit110 authored Jul 17, 2024
2 parents c316790 + 269b6ec commit 172c980
Show file tree
Hide file tree
Showing 17 changed files with 996 additions and 230 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
with:
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
cache: 'poetry'
Expand Down
72 changes: 27 additions & 45 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,64 @@ name: docs

on:
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/docs.yml
- '**.py'
- '**.ipynb'
- '**.html'
- '**.jinja'
- '**.js'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
- docs/cyclops-webpage
branches: [main]
types: [opened, synchronize, closed]
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/docs.yml
- '**.py'
- '**.ipynb'
- '**.html'
- '**.jinja'
- '**.js'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
- docs/cyclops-webpage

jobs:
build:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize' || (github.event.action == 'closed' && github.event.pull_request.merged == true)))
runs-on: ubuntu-latest
runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) && fromJSON('["self-hosted", "db", "cyclops"]') || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: 'true'
fetch-depth: 0

- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0

- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies, build docs without running notebooks

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip && python3 -m pip install poetry
poetry env use '3.10'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test --all-extras
# Install Pandoc
PANDOC_VERSION="2.19"
curl -sLo- "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz" | tar xzf - --strip-components 2 -C /usr/local/bin --exclude="share"
- name: Build docs
run: |
source $(poetry env info --path)/bin/activate
cd docs
rm -rf source/reference/api/_autosummary
make html
if [[ "${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') }}" == "true" ]]; then
make html-with-notebooks
else
make html
fi
- name: Set up Node.js
uses: actions/setup-node@v4.0.2
uses: actions/setup-node@v4.0.3
with:
node-version: 18
cache: yarn
cache-dependency-path: '**/yarn.lock'

- name: Build webpage
run: |
cd docs/cyclops-webpage
yarn install --frozen-lockfile
yarn build
cp -r ../build/html build/api
- name: Create .nojekyll file
run: touch ./docs/cyclops-webpage/build/.nojekyll

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4.0.0
uses: peaceiris/actions-gh-pages@v4
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: github_pages
publish_dir: docs/cyclops-webpage/build
publish_dir: ./docs/cyclops-webpage/build
force_orphan: true
63 changes: 0 additions & 63 deletions .github/workflows/docs_release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v4.1.7
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
cache: 'poetry'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v4.1.7
- name: Install pip
run: python3 -m pip install --upgrade pip
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
- name: Install package and test import
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4.1.7
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
- name: Build package
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4.1.7
- name: Install dependencies, run unit tests and coverage report
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0
- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
cache: 'poetry'
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.4.10'
rev: 'v0.5.2'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -25,7 +25,7 @@ repos:
types_or: [python, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
entry: python3 -m mypy --config-file pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion cyclops/data/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def normalize_events(
data = data.infer_objects()
data[event_name_col] = normalize_names(data[event_name_col])

if event_value_col and data[event_value_col].dtypes == object:
if event_value_col and data[event_value_col].dtypes == object: # noqa: E721
data[event_value_col] = normalize_values(data[event_value_col])
log_df_counts(data, event_name_col, "Normalized values...", columns=True)

Expand Down
2 changes: 1 addition & 1 deletion cyclops/data/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ def is_datetime(
return False
if isinstance(value, (list, np.ndarray)):
return all((is_datetime(v) for v in value))
if isinstance(value, (datetime.datetime, np.datetime64)):
if isinstance(value, (datetime.datetime, np.datetime64)): # noqa: SIM103
return True

return False
Expand Down
8 changes: 6 additions & 2 deletions cyclops/evaluate/metrics/average_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ def __new__( # type: ignore # mypy expects a subclass of AveragePrecision
pos_label=pos_label,
)
if task == "multiclass":
NotImplementedError("Multiclass average precision is not implemented.")
raise NotImplementedError(
"Multiclass average precision is not implemented."
)
if task == "multilabel":
NotImplementedError("Multilabel average precision is not implemented.")
raise NotImplementedError(
"Multilabel average precision is not implemented."
)

raise ValueError(
"Expected argument `task` to be either 'binary', 'multiclass' or "
Expand Down
4 changes: 2 additions & 2 deletions cyclops/evaluate/metrics/functional/average_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def average_precision(
if task == "binary":
return binary_average_precision(target, preds, thresholds, pos_label)
if task == "multiclass":
NotImplementedError("Multiclass average precision is not implemented.")
raise NotImplementedError("Multiclass average precision is not implemented.")
if task == "multilabel":
NotImplementedError("Multilabel average precision is not implemented.")
raise NotImplementedError("Multilabel average precision is not implemented.")

raise ValueError(
"Expected argument `task` to be either 'binary', 'multiclass' or "
Expand Down
Loading

0 comments on commit 172c980

Please sign in to comment.