Skip to content

Commit

Permalink
Merge branch 'topic/default/try-pixi' into 'branch/default'
Browse files Browse the repository at this point in the history
Topic/default/try pixi

See merge request fluiddyn/fluidsim!356
  • Loading branch information
paugier committed Jan 10, 2024
2 parents 47180ab + 37051e8 commit 096a329
Show file tree
Hide file tree
Showing 7 changed files with 6,056 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

53 changes: 52 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
stages:
- image-pixi
- pixi
- image
- lint
- test
- test-release
- report
- test-release
- doc

variables:
Expand All @@ -26,6 +28,55 @@ workflow:
# - pip install requests
# - python3.9 tmp_bug_unearth.py


CI image pixi:
stage: image-pixi
tags:
- container-registry-push
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_BUILD_IMAGES == "1"'
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- ""
script:
- |
cat > /kaniko/.docker/config.json <<EOF
{
"auths": {
"$CI_REGISTRY": {
"username": "$CI_REGISTRY_USER",
"password": "$CI_REGISTRY_PASSWORD"
}
}
}
EOF
- >
/kaniko/executor --context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile_pixi
--single-snapshot
--cleanup
--destination registry.heptapod.net:443/fluiddyn/fluidsim/ci/$CI_COMMIT_HG_BRANCH:pixi
test_pixi:
stage: pixi
image: registry.heptapod.net:443/fluiddyn/fluidsim/ci/default:pixi
needs:
- job: "CI image pixi"
optional: true
script:
- pixi info
- rm -rf ../transonic
- hg clone https://foss.heptapod.net/fluiddyn/transonic ../transonic
- pixi run install-editable
- pixi run pytest -v lib
- pixi run fluidsim-test -v
# currently broken because of fluidfft conda issues
# - pixi run mpirun -np 2 fluidsim-test -v --exitfirst


# Build an image for the other tasks; this should be a scheduled job, as
# it is quite unnecessary to run on every invocation.
CI image:
Expand Down
1 change: 1 addition & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ __pycache__
.mypy_cache/
.coverage/
.nox
.pixi

bench/launcher_*
bench/SLURM*
Expand Down
16 changes: 12 additions & 4 deletions doc/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,20 @@ with:
pip install -e . -v --no-build-isolation --no-deps
```

### Python installed with conda/mamba/conda-forge
### Conda-based Python with conda-forge and Pixi

```{todo}
Experiment, find a good solution and describe it here!
One can use [Pixi] to setup a developer environment based on [conda-forge] and compile from source. From the root directory of Fluidsim repository, just
run:

```sh
# TODO: remove this clone after Transonic release
hg clone https://foss.heptapod.net/fluiddyn/transonic/ ../transonic
pixi run install-editable
pixi run fluidsim-test -v
```

Then, `pip` is available and previous commands should work.

## Advice for developers

### Run the tests
Expand Down Expand Up @@ -265,13 +271,15 @@ export MESONPY_EDITABLE_VERBOSE=1
See
https://meson-python.readthedocs.io/en/latest/how-to-guides/editable-installs.html#verbose-mode

[conda-forge]: https://conda-forge.org/
[evolve]: https://www.mercurial-scm.org/doc/evolution/
[mercurial]: https://www.mercurial-scm.org/
[meson]: https://mesonbuild.com
[nox]: https://nox.thea.codes
[pdm]: https://pdm-project.org
[pip]: https://pip.pypa.io
[pipx]: https://github.com/pypa/pipx
[pixi]: https://pixi.sh/
[pytest]: https://docs.pytest.org
[pythran]: https://pythran.readthedocs.io
[topic]: https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html
Expand Down
32 changes: 32 additions & 0 deletions docker/Dockerfile_pixi
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM debian:bookworm
LABEL Pierre Augier <[email protected]>

RUN apt-get update

RUN apt-get install -y --no-install-recommends \
mercurial python3-pip wget sudo \
--option=Dpkg::Options::=--force-confdef

RUN rm -rf /var/lib/apt/lists/*

RUN groupadd -g 1000 appuser && useradd -m -r -u 1000 -g appuser -s /bin/bash appuser -s /bin/bash && usermod -a -G sudo appuser
RUN echo appuser:appuser | chpasswd
USER appuser
ARG HOME=/home/appuser
RUN mkdir -p $HOME/opt
WORKDIR $HOME/opt
RUN echo $USER $HOME $PWD && whoami

RUN $(hg debuginstall -T '{pythonexe}') -m pip install hg-evolve hg-git --no-cache-dir --user --break-system-packages

COPY --chown=appuser:appuser docker/hgrc $HOME/.hgrc

RUN mkdir -p $HOME/.local/bin
ENV PATH=$HOME/.local/bin:$PATH

RUN mkdir -p $HOME/.config/matplotlib
RUN echo 'backend : agg' > $HOME/.config/matplotlib/matplotlibrc

RUN wget https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-unknown-linux-musl.tar.gz
RUN tar -xzf pixi-x86_64-unknown-linux-musl.tar.gz .
RUN mv pixi $HOME/.local/bin
Loading

0 comments on commit 096a329

Please sign in to comment.