Skip to content

quality of life fix for pip users#1289

Open
James11222 wants to merge 2 commits into
LSSTDESC:masterfrom
James11222:fix_pypi
Open

quality of life fix for pip users#1289
James11222 wants to merge 2 commits into
LSSTDESC:masterfrom
James11222:fix_pypi

Conversation

@James11222
Copy link
Copy Markdown

This pull request adds quality-of-life support for pip users by adding optional dependency groups in pyccl, making it easier for users to install only the packages they need for specific functionalities (e.g., Boltzmann codes, perturbation theory, emulators). It updates the documentation to explain these new installation options, improves error handling for missing optional dependencies, and sets the default transfer function based on installed packages.

Existing Issue this Fixes: when you install the base package via pip, Boltzmann codes are not installed but the default transfer_function in ccl.Cosmology() is 'boltzmann_camb'. This creates a problem when you go to use the cosmology object in components of the halo model for example. Now with these changes, I've made the default behavior be that if the Boltzmann codes are not installed, 'eisenstein_hu' is the default, otherwise camb is the default (I believe the default behavior in the conda installation).

Dependency management and installation:

  • Added optional dependency groups (boltzmann, pt, emulators, full) to pyproject.toml for easier installation of extra features.
  • Updated installation instructions in both README.md and readthedocs/source/installation.rst to document the new extras and clarify default behaviors depending on installed packages. [1] [2] [3] [4] [5]
pip install pyccl[boltzmann]   # Boltzmann codes: CAMB, CLASS (classy), ISiTGR
pip install pyccl[pt]          # Perturbation theory: FAST-PT, velocileptors
pip install pyccl[emulators]   # Emulators: BaccoEmu, MiraTitan, Dark Emulator
pip install pyccl[full]        # All of the above

Default behavior and configuration:

  • The default transfer_function is now set based on whether camb is installed: 'boltzmann_camb' if available, otherwise 'eisenstein_hu'. [1] [2]

Error handling improvements:

  • Improved error messages in pyccl/boltzmann.py to raise a CCLError with clear installation instructions if a required optional dependency (CAMB, CLASS/classy, ISiTGR) is missing, instead of a generic ImportError. [1] [2] [3]
  • Updated tests to expect the new CCLError when optional dependencies are missing.

@carlosggarcia
Copy link
Copy Markdown
Collaborator

Thanks for the PR! I think it's a great idea to allow this selection of packages. I have not reviewed the code yet so just two quick comments:

  • You will need to update the branch before I can merge it. I will merge first Automatic wheels building for PyPI #1290 so wait for that.
  • We should not change the default transfer_function. That is an API change, which would require major version bump and might break some codes in a way that might not be easy no notice (because they will work but with the wrong transfers). So, revert that back to boltzmann_camb.

Once #1290 is merged I'll come back to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants