Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to pixi #74

Merged
merged 31 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3b5533e
Switch to pixi
timmens May 18, 2024
2a35bd0
Fix pixi lockfile
timmens May 18, 2024
e660daa
Fix CI?
timmens May 19, 2024
dc731ef
Update pixi.lock
timmens May 19, 2024
1d84dcd
Update pyproject.toml
timmens May 19, 2024
2f8b73e
Update pixi.lock
timmens May 19, 2024
942670e
Update pixi environment and GitHub CI
timmens May 29, 2024
42b5c48
Merge branch 'main' into pixi
timmens May 29, 2024
d0c1181
Restrict scipy and fix broken GH-CI task
timmens May 29, 2024
8efc514
Fix pixi lockfile
timmens May 29, 2024
74e0500
Update pyproject
timmens May 29, 2024
c558577
Update lockfile
timmens May 29, 2024
bf92eeb
Delete .envs, environment.yml; Update README.md
timmens May 29, 2024
03e58b9
Move to hatch build system and remove MANIFEST.in
timmens May 31, 2024
b9de78e
Update black and ruff version for nbqa
timmens May 31, 2024
dfe8fc4
Add custom pre-commit hook to check for version mismatch with nbQA
timmens May 31, 2024
36a4c5e
Add custom pre-commit hook to check for version mismatch with nbQA
timmens May 31, 2024
3337043
Update README.md
timmens May 31, 2024
d83ffca
Changes
timmens May 31, 2024
6b50ac0
Changes
timmens May 31, 2024
b312a97
Remove Windows from pixi
timmens May 31, 2024
febe2ec
Fix environment
timmens May 31, 2024
724f12c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
083f951
Fix CI
timmens May 31, 2024
279c4ca
Merge branch 'pixi' of https://github.com/OpenSourceEconomics/lcm int…
timmens May 31, 2024
9be911d
Fix README because mdformat does not understand GitHub Markdown flavor
timmens May 31, 2024
1d22893
Fix mypy CI error?
timmens May 31, 2024
13748cc
Update lockfile
timmens May 31, 2024
acb73c0
Use pixi run -e test-cpu tests in CI
timmens May 31, 2024
2a1d6a0
Beautify a few things
timmens May 31, 2024
5941f9d
Merge branch 'main' into pixi
timmens Jun 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .envs/testenv.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/depandabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly # or daily, weekly
groups:
dependencies:
patterns:
- '*'
43 changes: 24 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,35 @@ jobs:
- macos-latest
- windows-latest
python-version:
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v3
- name: create test environment
uses: mamba-org/setup-micromamba@v1
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.0
with:
environment-file: ./.envs/testenv.yml
environment-name: lcm
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
pixi-version: v0.23.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: test-cpu
activate-environment: true
- name: Run pytest
shell: bash -l {0}
run: |
micromamba activate lcm
pytest --cov-report=xml --cov=./
run: pytest tests --cov-report=xml --cov=./
timmens marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload coverage report
if: runner.os == 'Linux' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
if: runner.os == 'Linux' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
run-mypy:
name: Run mypy on Python 3.12
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
pixi-version: v0.23.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: mypy
- name: Run mypy
shell: bash -l {0}
if: runner.os == 'Linux' && matrix.python-version == '3.11'
run: |-
micromamba activate lcm
mypy src
run: pixi run mypy
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,5 @@ venv.bak/


.pytask.sqlite3


src/lcm/_version.py
.pixi
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Just occurred to me when I wanted to update nbqa-ruff to v0.4.6 (need to keep this in sync with ruff manually, please change): How does pixi play with pre-commit? Would I still have a conda base env / the system Python to base pre-commit on? Sounds like trouble for some things...

I just confirmed that: pixi run pre-commit leads to An unexpected error has occurred: CalledProcessError: command: ('/mnt/econ/lcm/lcm/.pixi/envs/default/bin/python3.12', '-mvirtualpenv', '/home/hmg/.cache/pre-commit/repor0qq6lyq/py_env-python3.11', '-p', 'python3.11') because the tool.ruff section still specifies target-version = "py311" 😆

Can we somehow use the pixi-installed Python automatically when pre-commit is run?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Since this has happened before, and I know my forgetful brain, I've added a custom pre-commit hook that checks whether these versions are out-of-date.
  2. Yes, this can definitely lead to problems. In principle, you can enter a pixi shell, which is similar to activating a conda environment. I don't know whether the pre-commit hooks use the correct Python version in this case though

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I think we do not want that. I think this would also be difficult with the pre-commit CI, since there we would require the pixi environment as well.

I think the version now should work as before under conda.

Copy link
Member

Choose a reason for hiding this comment

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

But it worked under conda only if you activated the correct environment or your activated Python happened to be the correct version, right?

Copy link
Member Author

@timmens timmens May 31, 2024

Choose a reason for hiding this comment

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

Okay, so there may be more clever solutions that I'm not aware of, but I think the easiest for now is to use pixi like conda.

I.e., you activate the pixi environment before you work in a project.

Alternatively, you could start with pixi run pre-commit install, and then afterwards run pixi run git commit -m "commit msg", which would use the correct Python version.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
hooks:
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.4.6
hooks:
- id: ruff
# args:
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
timmens marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exclude *.sh
exclude *.yaml
exclude *.yml
exclude *.pickle
exclude pytask.ini
exclude *.lock

prune .envs
prune examples
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@

This package aims to generalize and facilitate the specification, solution, and
estimation of dynamic choice models.

## Installation

`LCM` currently needs to be installed from GitHub and requires `jax` and `jaxlib`. If
timmens marked this conversation as resolved.
Show resolved Hide resolved
you aim to run `LCM` on a GPU, you need to install `jaxlib` with CUDA support (for
Linux) or with support for AMD GPUs / ARM-based Silicon GPUs (for MacOS). In any case,
please consult the `jax`
[docs](https://jax.readthedocs.io/en/latest/installation.html#supported-platforms).
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

Empty file removed docs/source/__init__.py
Empty file.
73 changes: 0 additions & 73 deletions docs/source/conf.py

This file was deleted.

15 changes: 0 additions & 15 deletions docs/source/index.rst

This file was deleted.

50 changes: 0 additions & 50 deletions environment.yml

This file was deleted.

Loading
Loading