Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid import scipy.stats #111

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,23 @@ jobs:

test-linux-cloud:
runs-on: ubuntu-latest
container: ghcr.io/anybody/anybodycon-github-actions:latest_Beta
container: ghcr.io/anybody/anybodycon-github-actions:latest

needs: lint

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: install
run: pip install .
- uses: prefix-dev/[email protected]
with:
post-cleanup: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

- name: build
run: pixi run --frozen pip install .

- name: test
env:
RLM_LICENSE_PASSWORD: ${{ secrets.LICENSE_PASSWORD }}
RLM_LICENSE: ${{ secrets.LICENSE_SERVER }}
run: pytest tests
run: pixi run --frozen pytest tests
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# AnyPyTools Change Log

## v1.11.5

**Fixed:**

* Speed up importing by avoiding importing scipy until it is needed.


## v1.11.4

**Fixed:**
Expand Down
2 changes: 1 addition & 1 deletion anypytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"NORMAL_PRIORITY_CLASS",
]

__version__ = "1.11.4"
__version__ = "1.11.5"


def print_versions():
Expand Down
5 changes: 3 additions & 2 deletions anypytools/macroutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from collections.abc import MutableSequence

import numpy as np
from scipy.stats import distributions

from anypytools.tools import define2str, path2str, array2anyscript

Expand Down Expand Up @@ -288,8 +287,10 @@ class SetValue_random(SetValue):
"""

def __init__(self, var, frozen_distribution, default_lower_tail_probability=0.5):
from scipy.stats.distributions import rv_frozen

self.var = var
if not isinstance(frozen_distribution, distributions.rv_frozen):
if not isinstance(frozen_distribution, rv_frozen):
raise TypeError(
"frozen_distribution must be frozen distribtuion from \
scipy.stats.distributions"
Expand Down
Loading