Skip to content

replace conda: parameter with conda_packages:#391

Open
zacharyburnett wants to merge 11 commits into
OpenAstronomy:mainfrom
zacharyburnett:install_conda_packages_directly
Open

replace conda: parameter with conda_packages:#391
zacharyburnett wants to merge 11 commits into
OpenAstronomy:mainfrom
zacharyburnett:install_conda_packages_directly

Conversation

@zacharyburnett

@zacharyburnett zacharyburnett commented May 5, 2026

Copy link
Copy Markdown
Contributor

alternative to #361

replace the conda: parameter (which invoked the now-archived tox-conda) with conda_packages:.

If the user populates conda_packages then the workflow sets up a Mamba environment that tox runs within.

To migrate from tox-conda, copy conda_deps from tox.ini to conda_packages in the test workflow, and then also remember to list any non-Python Conda packages in allowlist_externals:

allowlist_externals =
    hstcal

this will require a major version bump

@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch 2 times, most recently from c0c196b to e374ea0 Compare May 5, 2026 13:25
@zacharyburnett zacharyburnett changed the title instead of using tox-conda, install Conda packages directly with micromamba replace conda: parameter with conda_packages: May 5, 2026
@zacharyburnett zacharyburnett marked this pull request as ready for review May 5, 2026 13:25
@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch from e374ea0 to 44ac21e Compare May 5, 2026 13:49
@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch 4 times, most recently from 9c26605 to a90895a Compare June 3, 2026 18:17
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

@pllim this should hopefully be a good way forward instead of using tox-conda; please let me know your thoughts. I don't think this should go into 3.0.0 at the moment, probably 4.0.0 eventually

@pllim

pllim commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Ooo thanks! Is there a way to test with this branch over at https://github.com/spacetelescope/wfc3tools ?

@zacharyburnett

Copy link
Copy Markdown
Contributor Author

Yes! Just make a PR that changes this line:
https://github.com/spacetelescope/wfc3tools/blob/f0eaea52a6f233c9238d45b2dcfc42a1f326a395/.github/workflows/tests.yml#L25

-    uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef  # v2.6.3
+    uses: zacharyburnett/github-actions-workflows/.github/workflows/tox.yml@install_conda_packages_directly

@zacharyburnett

Copy link
Copy Markdown
Contributor Author

here: spacetelescope/wfc3tools#119

@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch 3 times, most recently from f811cdf to 33c1c36 Compare June 3, 2026 18:39
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

actually @Cadair if we can squeeze another PR into the 3.0.0 release, this one seems to be working well

@zacharyburnett zacharyburnett marked this pull request as draft June 3, 2026 18:49
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

wait no never mind, I still need to use matrix.conda_packages instead of inputs.conda_packages

@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch 4 times, most recently from b9211da to 76f3014 Compare June 3, 2026 19:05
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

ok, fixed

@zacharyburnett zacharyburnett marked this pull request as ready for review June 3, 2026 19:09
@zacharyburnett zacharyburnett requested a review from Cadair June 3, 2026 19:09
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

@Cadair

Cadair commented Jun 3, 2026

Copy link
Copy Markdown
Member

This let's you install binaries for use in tox but not libraries right? You couldn't import a package installed like this?

Comment thread .github/workflows/tox.yml
type: string
conda:
description: Whether to test with conda (deprecated)
conda_packages:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how this is separate from tox, I wonder if it would be best folded into libraries like the system package managers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a good idea!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually on second thought, maybe we should keep them separate; the conda environment is distinct from the runner and platform, and you can install both

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not entirely sure what the limits of this functionality are so hard to judge. Can you use this to install C libraries and have them picked up inside tox?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, anything in the conda environment is exposed to tox via allowlist_externals

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowlist_externals is for command line tools only no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes you're right. The only usage of it I've seen is for testing wfc3tools with hstcal

I'm not sure if C libraries will be exposed, but I assume they should be since Conda modifies that path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to experiment. I still think that this is still a good match for libraries? There's not any meaningful difference between using conda like this and homebrew?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I don't really understand how the libraries installer works, so I'm fine with pushing this PR off to 4.0 if you think it can be better

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completely failed to write a test which checks to see if you can load a c library installed with conda or apt inside the tox env. Feel free to have a play if you want.

I think this functionality should be in libraries, I think it's the sensible place for it to be. Note, that with your current implementation I haven't been able to install a conda package on a per-env basis, you can see this in my broken test commit.

@Cadair

Cadair commented Jun 3, 2026

Copy link
Copy Markdown
Member

I'm in no mad rush for 3.0 fwiw, so happy to get this in.

@zacharyburnett zacharyburnett force-pushed the install_conda_packages_directly branch from f659f25 to 7747782 Compare June 3, 2026 19:53
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.66%. Comparing base (e113052) to head (7747782).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #391   +/-   ##
=======================================
  Coverage   66.66%   66.66%           
=======================================
  Files           2        2           
  Lines           6        6           
=======================================
  Hits            4        4           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Cadair Cadair added this to the 3.0 milestone Jun 8, 2026
@Cadair Cadair force-pushed the install_conda_packages_directly branch from 7747782 to d252a22 Compare June 8, 2026 10:39
@Cadair Cadair force-pushed the install_conda_packages_directly branch 8 times, most recently from 679fd0f to a8d11d4 Compare June 8, 2026 14:31
@Cadair

Cadair commented Jun 8, 2026

Copy link
Copy Markdown
Member

muffled screaming

@Cadair Cadair force-pushed the install_conda_packages_directly branch from a8d11d4 to 3f3a3d0 Compare June 8, 2026 14:33
@zacharyburnett

Copy link
Copy Markdown
Contributor Author

for some reason the clib test with conda_packages: specified

  - linux: libraries-clibrary
    conda_packages: libffcall

isn't actually picking up the conda packages and is just setting up Python with setup-python instead:
https://github.com/OpenAstronomy/github-actions-workflows/actions/runs/27213866684/job/80350042102?pr=391

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.

4 participants