Skip to content

Add support for using conda as an environment manager. - #2972

Merged
mhsmith merged 9 commits into
beeware:mainfrom
freakboy3742:add-conda-support
Aug 5, 2026
Merged

Add support for using conda as an environment manager.#2972
mhsmith merged 9 commits into
beeware:mainfrom
freakboy3742:add-conda-support

Conversation

@freakboy3742

Copy link
Copy Markdown
Member

Adds support for using Conda as an environment manager.

Adds one major new concept - the idea that the environment manager can be responsible for providing the Python install. When using Conda, there's no "support package" to install; Conda provides libpython, and the full Conda environment is copied into the application bundle as the last step of the install.

It's also assumed that if the environment is providing Python, Python packages are installed into that environment; so on update, updating the support package or the requirements requires rebuilding both.

Conda environments can only be used for macOS and Windows. A Conda doesn't have support for iOS or Android (yet... see this draft CEP); and a Conda environment can't be included as a Linux system package because it includes libraries (like libssl) that get flagged by DEB/RPM auditing tools. It might be possible to build a Flatpak that includes conda, but that is deferred from this PR.

On macOS, Conda cannot build universal apps; Conda binaries are single platform, and merging entire Conda environments would be complicated at best. As x86-64 macOS support is nearing EOL, I've decided to avoid the complication.

Add env_manager = "conda" to a project to test this configuration.

Building on macOS requires the use of custom templates:

macOS requires a different stub binary for "framework" builds (which use the support package and Python.xcframework) vs "non-framework" builds (which use Conda and libpython3.X.so).

Building on Windows requires the use of custom templates as well:

I've preemptively published an experimental stub binaries (build x2917) to allow testing the macOS and Windows app templates. The app templates uses these stub binaries. The Xcode/VisualStudio templates can be merged today; once that happens and this PR is merged, the stub binary will need to be formally tagged, and the app template updated to use that new stub.

This PR also includes documentation for the general topic of environment management, and normalises the naming of the venv backend (renamed from std_venv - I realized the reason it was causing headaches was the .gitignore file).

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

@mhsmith

This comment was marked as resolved.

Comment thread docs/en/reference/env_management/conda.md Outdated
Comment thread docs/en/reference/env_management/conda.md Outdated
Comment thread docs/en/reference/env_management/uv.md Outdated
Comment thread docs/en/reference/env_management/conda.md Outdated
Comment thread docs/en/reference/configuration.md Outdated
* `conda` - The [Conda](https://docs.conda.io/) environment manager

Defaults to `venv`.
Defaults to `venv`. For details on using different environment managers, see the `[environment management reference][environment-management]`.

@mhsmith mhsmith Jul 31, 2026

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.

Why is this option in the project section, which otherwise only includes high-level metadata? Could it be in the application section instead?

I remember we named requirement_installer_args on the assumption that when we later added this option, we would call it requirement_installer. I wonder if that might still be a good idea, because what the developer is really interested in is requirements, and environments are only a means to that end.

The only exception is that Conda also provides Python itself, but I think that's a relatively minor detail compared to the clarity advantage of requires, requirement_installer and requirement_installer_args all having similar names, and appearing next to each other in the documentation. This would also remove any implication that uv is used to provide Python, which is a common use case but not one we currently support.

In that case, we would presumably rename venv to pip, at least in the the user-visible option.

(Remainder moved to beeware/beeware-docs-tools#262)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I put it in the project section because it can be specified at the project level - which would seem to be the most likely usage as well - you're unlikely to use conda for one app, and uv in another app, inside a single project.

As for requirement_installer - I see what you're driving at, but nobody thinks of uv or conda as a "requirements installer" - installing requirements is just one of the things you do in the environment. Granted, from the perspective of Briefcase, it's the most important (and almost the only) thing you do - but in the case of conda, its explicitly not just the requirements installer.

The overflow on names is something for the theme; I presume a different overflow behaviour is possible, but I'd need to dig into it.

Comment thread src/briefcase/integrations/virtual_environment/conda.py Outdated
@freakboy3742

Copy link
Copy Markdown
Member Author

Update:

  • I've merged the Windows Visual Studio template, and tagged new binaries
  • I've updated the Windows app template to use the new binary.
  • I've merged the macOS Xcode template. I can't tag new binaries until this PR lands.
  • I've updated the documentation to include the points flagged in reviews to date - mostly details of usage and edge cases
  • I've merged with main, to pick up the fixes cases that caused issues during dependabot.

@freakboy3742
freakboy3742 requested a review from mhsmith August 4, 2026 04:40
Comment thread docs/en/reference/configuration.md Outdated
Comment thread docs/en/reference/configuration.md Outdated
Comment thread docs/en/reference/configuration.md Outdated
@freakboy3742
freakboy3742 requested a review from mhsmith August 5, 2026 04:19
@mhsmith
mhsmith merged commit 907d7f8 into beeware:main Aug 5, 2026
67 checks passed
@freakboy3742
freakboy3742 deleted the add-conda-support branch August 5, 2026 23:31
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