Skip to content

Add pixi to run codegen in a portable way#3707

Merged
emilk merged 22 commits intomainfrom
jleibs/pixi
Oct 16, 2023
Merged

Add pixi to run codegen in a portable way#3707
emilk merged 22 commits intomainfrom
jleibs/pixi

Conversation

@jleibs
Copy link
Copy Markdown
Contributor

@jleibs jleibs commented Oct 5, 2023

What

Add a proof-of-concept pixi.toml file for the project.

This is like Just but also takes care of dependency management for us. No need to run setup_dev.sh or pip install -r scripts/requirements-dev.txt.

This even manages the installation of arrow-cpp for us.

Just:

cargo install pixi

Then have fun:

pixi run codegen
pixi run py-test
pixi run cpp-test

Verified this works in a clean Ubuntu-20.04 docker container.

Checklist

@jleibs jleibs marked this pull request as ready for review October 5, 2023 20:52
@jleibs jleibs added 🧑‍💻 dev experience developer experience (excluding CI) exclude from changelog PRs with this won't show up in CHANGELOG.md labels Oct 5, 2023
@emilk
Copy link
Copy Markdown
Member

emilk commented Oct 6, 2023

wow

@abey79
Copy link
Copy Markdown
Member

abey79 commented Oct 6, 2023

This looks great.

I have two concerns though:

  1. yet another place were we pin deps version (in addition to pyproject.toml, requirements*.txt, CI yamls, etc.)
  2. further increase the distance between the dev (pixi/conda) vs. (main?) production workflow (pip/pypi)

It feels that is a great tool for end-user/"binary" projects, but doesn't really help with the complexity of "library" projects which are by definition more exposed to the world's complexity.

@jleibs
Copy link
Copy Markdown
Contributor Author

jleibs commented Oct 6, 2023

yet another place were we pin deps version (in addition to pyproject.toml, requirements*.txt, CI yamls, etc.)

pyproject.toml needs to stay since it specifies the actual library deps

My proposal though is that all of the other rerun_py/requirements-*.txt all of the package listings in our Docker containers and CI scripts would just use the pixi environment. Which I think makes this a net win on places to capture things.

@emilk emilk marked this pull request as draft October 9, 2023 10:48
@emilk
Copy link
Copy Markdown
Member

emilk commented Oct 9, 2023

I've converted this into a draft until it is a bit more than just a proof-of-concept

@emilk
Copy link
Copy Markdown
Member

emilk commented Oct 13, 2023

Changes

For now we will stick to using just as our main task runner, but we'll be porting more and more tasks to pixi, and have just forward these calls. For instance, just codegen now calls pixi run codegen.

To that end I have deprecated cargo codegen etc, and crated just version of them instead.

The immediate benefit of this PR is that just codegen now produces predictable results, because of it using fixed clang-format and black versions. This is a huge benefit for me personally when doing C++ dev, so I think this minimal proof-of-concept is already useful.

@emilk emilk marked this pull request as ready for review October 13, 2023 13:05
@Wumpf Wumpf self-requested a review October 13, 2023 13:11
@emilk
Copy link
Copy Markdown
Member

emilk commented Oct 13, 2023

I've also added a bunch of TODO:s to #3717

Copy link
Copy Markdown
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

works like a charm on my mac for the most part (well except some of the cpp build). Exited to try it out on Windows later today!

platforms = ["linux-64", "osx-arm64", "osx-64", "win-64"]
readme = "README.md"
repository = "https://github.com/rerun-io/rerun"
version = "0.1.0" # TODO(emilk): sync version with `Cargo.toml` with help from `crates.py`
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.

todo is fine, but we might as well just start with 0.10.0-alpha

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 think this is more clearly wrong. 0.10.0-alpha will just bitrot quickly. We're not planning on publishing rerun on pixi soon.

"py-build",
] }

cpp-prepare = "cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Debug"
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.

note to self: Check if this still works fine on windows (since pixi should download ninja for windows it might as well work fine, opening the door to more unified build experience than what I had in mind! \o/)

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.

There's this in CMakeLists.txt right now but I think we still need it for the time being on CI

# Use makefiles on linux, otherwise it might use Ninja which isn't installed by default.
if(NOT DEFINED CMAKE_GENERATOR AND UNIX)
    set(CMAKE_GENERATOR "Unix Makefiles")
endif()

is to be removed!

] }

cpp-prepare = "cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Debug"
cpp-build = { cmd = "cmake --build build --config Debug --target rerun_sdk_tests", depends_on = [
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.

this does not yet work on my Mac. Gives me a ton of warnings from Arrow and eventually fails building. Needs some more love. But can wait, after all we haven't put this in the just file yet

@Wumpf
Copy link
Copy Markdown
Member

Wumpf commented Oct 13, 2023

forgot to try before. pixi run py-build fails for me:

pixi run py-build
💥 maturin failed
  Caused by: Both VIRTUAL_ENV and CONDA_PREFIX are set. Please unset one of them

it doesn't like my venv apparently.

Again, not critical for the first step since this is now all about just getting codegen pixi'fied for everyone, everything else is fine if it works just on one machine

@emilk
Copy link
Copy Markdown
Member

emilk commented Oct 13, 2023

You should EITHER use venv or pixi. So run pixi run py-build from outside of a venv, or run pixi shell and run it from within the pixi environment

@Wumpf
Copy link
Copy Markdown
Member

Wumpf commented Oct 13, 2023

makes sense! With this in mind pixi run py-build works like a charm! <3

@Wumpf
Copy link
Copy Markdown
Member

Wumpf commented Oct 15, 2023

just codegen works on windows!

... but I had to push a bunch of fixes to make codegen actually do the same on windows

@emilk emilk changed the title Proof-of-concept: use pixi to manage build deps Add pixi to run codegen in a portable way Oct 16, 2023
@emilk emilk merged commit ca078fa into main Oct 16, 2023
@emilk emilk deleted the jleibs/pixi branch October 16, 2023 07:26
abey79 added a commit that referenced this pull request Dec 5, 2023
This sub-module was introduced likely by mistake with #3707
emilk pushed a commit that referenced this pull request Dec 5, 2023
### What

This sub-module was introduced likely by mistake with #3707.


### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
  * Full build: [app.rerun.io](https://app.rerun.io/pr/4432/index.html)
* Partial build:
[app.rerun.io](https://app.rerun.io/pr/4432/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
- Useful for quick testing when changes do not affect examples in any
way
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4432)
- [Docs
preview](https://rerun.io/preview/0800d294f0b7edbe91016137bbcde3b68ee49c43/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/0800d294f0b7edbe91016137bbcde3b68ee49c43/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧑‍💻 dev experience developer experience (excluding CI) exclude from changelog PRs with this won't show up in CHANGELOG.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants