Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f1b0431
Migrate from PyMC v4.3.0 (Aesara) to PyMC v5+ (PyTensor)
twiecki Oct 17, 2025
53342ac
Update implementation plan with completed phases
twiecki Oct 17, 2025
6d365bb
Continue PyMC v5 migration: Fix critical import issues and API changes
twiecki Oct 17, 2025
eb25a94
Fix imports.
twiecki Oct 17, 2025
953f4bc
Continue PyMC v5 migration: Fix remaining import issues
twiecki Oct 17, 2025
37a6948
Update documentation and CI/CD for PyMC v5
twiecki Oct 17, 2025
310cc2d
Fix mean function signatures for PyMC v5
twiecki Oct 17, 2025
4057b07
Fix API compatibility issues for PyMC v5
twiecki Oct 18, 2025
1701811
Update implementation plan with final migration status
twiecki Oct 18, 2025
e4702ea
Further porting of tests.
twiecki Oct 18, 2025
a18e3f9
Remove migration-related documentation files from git tracking
twiecki Oct 19, 2025
f90b714
Remove migration scripts from git tracking
twiecki Oct 19, 2025
cf49cae
Fix pre-commit
lucianopaz Nov 6, 2025
d91a268
Update upload artifact GHA version
lucianopaz Nov 6, 2025
f209f53
Change test workflow
lucianopaz Nov 6, 2025
f6c0f20
Change test workflow
lucianopaz Nov 6, 2025
d18ca1e
Add fastprogress dependency
lucianopaz Nov 6, 2025
a87d572
Fix test workflow
lucianopaz Nov 6, 2025
014c590
Extra fixes to get workflows to run
lucianopaz Nov 7, 2025
fd62045
Fix distributions tests
lucianopaz Nov 7, 2025
916432a
Fix some more tests
lucianopaz Nov 7, 2025
3ec6683
Extra changes to fix some more tests
lucianopaz Nov 9, 2025
a807820
Final fixes to failing tests
lucianopaz Nov 11, 2025
f389283
Push dangling uncommited changed
lucianopaz Nov 11, 2025
7bd84d8
Fixed expected call tests
lucianopaz Nov 11, 2025
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
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'
- name: Build the sdist and the wheel
run: |
pip install build
Expand All @@ -40,7 +40,7 @@ jobs:
echo "Checking import and version number (on release)"
venv-bdist/bin/python -c "import homepy; assert homepy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else homepy.__version__; print(homepy.__version__)"
cd ..
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*
Expand All @@ -63,7 +63,7 @@ jobs:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-py3.8-conda-${{ env.CACHE_NUMBER }}-${{
key: ${{ runner.os }}-py3.10-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('envs/environment-test.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -73,13 +73,15 @@ jobs:
activate-environment: homepy
channel-priority: strict
environment-file: envs/environment-test.yml
python-version: '3.8'
python-version: '3.10'
use-mamba: true
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install-package
run: |
pip install -e .[dev]
python --version
# Verify PyMC v5 is installed
python -c "import pymc; print(f'PyMC version: {pymc.__version__}'); assert pymc.__version__.startswith('5'), 'PyMC v5 required'"
- name: Run tests
run: |
conda activate homepy
Expand All @@ -102,7 +104,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'
- name: Test pip install from test.pypi
run: |
# Give time to test.pypi to update its index. If we don't wait,
Expand Down
31 changes: 9 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- uses: pre-commit/action@v3.0.0
tests:
needs:
Expand All @@ -57,32 +57,19 @@ jobs:
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if environment-test.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-py3.8-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('envs/environment-test.yml') }}
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
mamba-version: "*"
activate-environment: homepy
channel-priority: strict
environment-file: envs/environment-test.yml
python-version: '3.8'
use-mamba: true
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
environment-name: homepy-test
init-shell: bash
cache-environment: true
- name: Install-package
run: |
pip install -e .[dev]
python --version
# Verify PyMC v5 is installed
python -c "import pymc; print(f'PyMC version: {pymc.__version__}'); assert pymc.__version__.startswith('5'), 'PyMC v5 required'"
- name: Run tests
run: |
conda activate homepy
pytest
python -m pytest -vv --cov=homepy --cov-report=xml --no-cov-on-fail --cov-report term-missing
63 changes: 28 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ^(docs/logos|homepy/tests|)/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand All @@ -13,46 +13,31 @@ repos:
- id: requirements-txt-fixer
exclude: ^requirements-dev\.txt$
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/pylint
rev: v2.12.1
hooks:
- id: pylint
args: [--rcfile=.pylintrc]
files: ^homepy/
- repo: https://github.com/MarcoGorelli/madforhooks
rev: 0.2.1
rev: 0.4.1
hooks:
- id: no-print-statements
files: ^homepy/
- id: conda-env-sorter
files: ^conda-envs/environment-dev-py.+\.yml$
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.1
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.29.1]
args: ["--py37-plus"]
- id: nbqa-isort
additional_dependencies: [isort==5.12.0]
- id: nbqa-black
additional_dependencies: [black==22.3.0]
- id: nbqa-pylint
args: [--rcfile=.pylintrc]
additional_dependencies: [pylint==2.12.1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.7
hooks:
- id: ruff
types_or:
- python
- pyi
- jupyter
args:
- --fix
- --exit-non-zero-on-fix
exclude: ^(docs)
- id: ruff-format
types_or:
- python
- pyi
- jupyter
exclude: ^(docs)
- repo: local
hooks:
- id: check-no-tests-are-ignored
Expand All @@ -68,3 +53,11 @@ repos:
files: ^conda-envs/environment-dev-py.+.yml$
language: python
name: Generate pip dependency from conda
- repo: https://github.com/lucianopaz/head_of_apache
rev: "0.1.1"
hooks:
- id: head_of_apache
args:
- --author
- PyMC Labs
- --last-year-present
6 changes: 3 additions & 3 deletions docs/02_modeling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>9000 rows × 6 columns</p>\n",
"<p>9000 rows \u00d7 6 columns</p>\n",
"</div>"
],
"text/plain": [
Expand Down Expand Up @@ -1075,7 +1075,7 @@
"\n",
"The `n` parameter is equal to the concentration parameter from our observational distribution. In our case, since we assumed that `n` followed an exponential distribution with unit length scale, it's impossible that it's value were too big.\n",
"\n",
"The `p` parameter is linked to the negative binomial's mean. Under the parametrization that numpy works with, the expected value of the negative binomial is `n * (1 - p) / p`. With some math, we can see that small `p` values imply extremely large expected observations! This means that our prior for the model made it possible to have extremely large means after the link function! Let's see how we can fix that."
"The `p` parameter is linked to the negative binomial's mean. Under the parametrization that numpy works with, the expected value of the negative binomial is `n * (1 - p) / p`. With some math, we can see that small `p` values imply extremely large expected observations! This means that our prior for the model made it possible to have extremely large means after the link function! Let's see how we can fix thpt."
]
},
{
Expand Down Expand Up @@ -4857,7 +4857,7 @@
],
"source": [
"import graphviz\n",
"from aesara.graph.basic import walk\n",
"from pytensor.graph.basic import walk\n",
"\n",
"tracked = [\n",
" n\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/04_customizing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"import numpy as np\n",
"import pandas as pd\n",
"import pymc as pm\n",
"from aesara import tensor as at\n",
"from pytensor import tensor as at\n",
"\n",
"import homepy"
]
Expand Down Expand Up @@ -795,7 +795,7 @@
" coefficients = pm.Normal(name, mu=mu, sigma=sigma, shape=len(regressor_columns))\n",
"\n",
" regressors = pm.ConstantData(\"The regressors\", data[regressor_columns].values)\n",
" return at.dot(regressors, coefficients)"
" return pt.dot(regressors, coefficients)"
]
},
{
Expand Down Expand Up @@ -2033,7 +2033,7 @@
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>9000 rows × 6 columns</p>\n",
"<p>9000 rows \u00d7 6 columns</p>\n",
"</div>"
],
"text/plain": [
Expand Down Expand Up @@ -2735,7 +2735,7 @@
" d.node.dim_name: inds[d.observation_indexes]\n",
" for d in hierarchy.levels[hierarchy.depth_to_level[hierarchy.depth]]\n",
" }\n",
" return at.concatenate(\n",
" return pt.concatenate(\n",
" self.hierarchy.walk_hierarchy(\n",
" root_callback=self.root_callback,\n",
" intermediate_callback=self.intermediate_callback,\n",
Expand Down Expand Up @@ -2764,7 +2764,7 @@
" latent = pm.gp.Latent(cov_func=cov)\n",
" return pm.Deterministic(\n",
" f\"gp_{dim_name}\",\n",
" at.stack(\n",
" pt.stack(\n",
" [\n",
" parent_gp + latent.prior(f\"gp_{dim_name}_{i}\", X)\n",
" for i in hierarchy.coords[dim_name]\n",
Expand Down
Loading