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

Enable pixi #39

Merged
merged 9 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
46 changes: 19 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- name: Setup pixi
uses: prefix-dev/setup-[email protected]
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python packages
run: pip install ".[lint]"
pixi-version: v0.32.0
environments: dev
activate-environment: true

- name: Run ruff
run: ruff check .
run: pixi run lint

build:
name: Build
Expand All @@ -41,22 +38,18 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v5
- name: Setup pixi
uses: prefix-dev/setup-[email protected]
with:
python-version: "3.10"

- name: Install Python packages
run: |
pip install --upgrade pip
pip install build twine
pip --verbose install .
pixi-version: v0.32.0
environments: dev
activate-environment: true

- name: Print package version
run: python -c "from flopy4 import version; print(version.__version__)"

- name: Build package
run: python -m build
run: pixi run build

test:
name: Test
Expand All @@ -68,7 +61,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-12, windows-2022 ]
python: [ "3.10", "3.11", "3.12" ]
python: [ "310", "311", "312" ]
env:
GCC_V: 11
steps:
Expand All @@ -81,13 +74,12 @@ jobs:
with:
repo: modflow6-nightly-build

- name: Setup Python
uses: actions/setup-python@v5
- name: Setup pixi
uses: prefix-dev/setup-[email protected]
with:
python-version: ${{ matrix.python }}

- name: Install Python packages
run: pip install ".[test]"
pixi-version: v0.32.0
environments: test${{ matrix.python }}
activate-environment: true

- name: Run tests
run: pytest -v -n auto
run: pixi run test
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
build/
docs/examples/*.ipynb
venv/
.vscode
.DS_Store
.ruff_cache
*.egg-info
**/__pycache__/
**/__pycache__/

# pixi environments
.pixi
*.egg-info
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"purpose": ["debug-test"]
}
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"test"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
1 change: 1 addition & 0 deletions open-vscode.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pixi run -e dev code . | exit
7,975 changes: 7,975 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ test = [
"pytest-dotenv",
"pytest-xdist",
]
build = [
"build",
"twine",
]

[tool.setuptools]
include-package-data = true
Expand Down Expand Up @@ -107,3 +111,37 @@ ignore = [
"E722", # do not use bare `except`
"E741", # ambiguous variable name
]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-64"]

[tool.pixi.system-requirements]
macos = "12.0"

[tool.pixi.pypi-dependencies]
flopy4 = { path = ".", editable = true }

[tool.pixi.feature.py310.dependencies]
python = "3.10"

[tool.pixi.feature.py311.dependencies]
python = "3.11"

[tool.pixi.feature.py312.dependencies]
python = "3.12"

[tool.pixi.environments]
test310 = { features = ["py310", "test"], solve-group = "py310" }
test311 = { features = ["py311", "test"], solve-group = "py311" }
test312 = { features = ["py312", "test"], solve-group = "py312" }
dev = { features = ["py312", "test", "lint", "build"], solve-group = "py312" }

[tool.pixi.feature.build.tasks]
build = { cmd = "python -m build" }

[tool.pixi.feature.test.tasks]
test = { cmd = "pytest -v -n auto" }

[tool.pixi.feature.lint.tasks]
lint = { cmd = "ruff check ." }
Loading