Skip to content

Commit f906249

Browse files
committed
[DEVOPS-693] pixi all the way, including for doc
- fix test for remove the jinja dependency - pixi task for build the doc, used in RTD - tweak RTD configuration - replace install_in_analyst bat by pixi task - use pixi to run pylint from pre-commit
1 parent 4168153 commit f906249

34 files changed

Lines changed: 5477 additions & 12268 deletions

.github/workflows/python_analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
contents: read
3232
pull-requests: read
3333
with:
34-
package-manager: 'conda'
34+
package-manager: 'pixi'
3535
app-name: 'grid_apps'
3636
python-version: '3.10'
3737
call-workflow-pre-commmit:
@@ -49,7 +49,7 @@ jobs:
4949
contents: read
5050
pull-requests: read
5151
with:
52-
package-manager: 'conda'
52+
package-manager: 'pixi'
5353
python-versions: '["3.10", "3.11", "3.12"]'
5454
cache-number: 1
5555
os: '["ubuntu-latest", "windows-latest"]'

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,15 @@ dmypy.json
145145
# tempory generated files
146146
pyproject-sha.toml
147147

148-
#version ignore
148+
# auto-generated version file
149149
grid_apps/_version.py
150+
151+
# not using poetry to lock, but pixi
152+
poetry.lock
153+
154+
# pixi environments
155+
.pixi/*
156+
!.pixi/config.toml
157+
158+
# generated conda env files by pixi
159+
*.pixi.conda.yml

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ repos:
6363
hooks:
6464
- id: pylint
6565
name: pylint
66-
entry: .\\devtools\\conda_env_pylint.bat
66+
entry: pixi run --locked pylint
6767
language: system
6868
require_serial: true # pylint does its own parallelism
6969
types: [python]
@@ -72,7 +72,7 @@ repos:
7272
rev: v2.3.0
7373
hooks:
7474
- id: codespell
75-
exclude: (-lock\.ya?ml|\benvironments/.*\.ya?ml|\.ipynb|^THIRD_PARTY_SOFTWARE\.rst)$
75+
exclude: (^pixi.lock|-lock\.ya?ml|\benvironments/.*\.ya?ml|\.ipynb|^THIRD_PARTY_SOFTWARE\.rst)$
7676
entry: codespell -I .codespellignore
7777
- repo: https://github.com/pre-commit/pre-commit-hooks
7878
rev: v5.0.0

.readthedocs.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
version: 2
22

3-
# Set the version of Python and other tools you might need
43
build:
5-
os: "ubuntu-22.04"
4+
os: ubuntu-24.04
65
tools:
7-
python: "mambaforge-22.9"
6+
python: "3.10" # pre-install for the py310 environment of pixi
7+
jobs:
8+
post_checkout:
9+
# Download and uncompress binary for the desired version of Git LFS
10+
- |
11+
set -e
12+
LFS_VERSION="3.4.0"
13+
wget "https://github.com/git-lfs/git-lfs/releases/download/v${LFS_VERSION}/git-lfs-linux-amd64-v${LFS_VERSION}.tar.gz"
14+
tar xzf "git-lfs-linux-amd64-v${LFS_VERSION}.tar.gz" --strip-components=1 "git-lfs-${LFS_VERSION}/git-lfs"
15+
rm "git-lfs-linux-amd64-v${LFS_VERSION}.tar.gz"
16+
# Modify LFS config paths to point where git-lfs binary was downloaded
17+
- git config filter.lfs.process "$(pwd)/git-lfs filter-process"
18+
- git config filter.lfs.smudge "$(pwd)/git-lfs smudge -- %f"
19+
- git config filter.lfs.clean "$(pwd)/git-lfs clean -- %f"
20+
# Make LFS available in current repository
21+
- ./git-lfs install
22+
# Download content from remote
23+
- ./git-lfs fetch
24+
# Make local files to have the real content on them
25+
- ./git-lfs checkout
826

9-
# Build documentation in the docs/ directory with Sphinx
10-
sphinx:
11-
configuration: docs/source/conf.py
27+
create_environment:
28+
- asdf plugin add pixi
29+
- asdf install pixi latest
30+
- asdf global pixi latest
31+
- asdf plugin add uv
32+
- asdf install uv latest
33+
- asdf global uv latest
1234

13-
conda:
14-
environment: docs/environment.yml
15-
16-
python:
17-
install:
18-
- method: pip
19-
path: .
35+
build:
36+
html:
37+
- pixi run --frozen build-docs html $READTHEDOCS_OUTPUT

deps-lock-config.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

devtools/conda_env_pylint.bat

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/environment.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
# '
99
# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1010

11+
import os
1112
from datetime import datetime
12-
from importlib.metadata import version
13+
from importlib.metadata import version as get_version
1314

1415
from packaging.version import Version
1516

@@ -26,38 +27,63 @@
2627
author = "Mira Geoscience Ltd."
2728
project_copyright = "%Y, Mira Geoscience Ltd"
2829

30+
package_name = "grid-apps"
31+
32+
full_version = Version(get_version(package_name))
33+
# The full public version, including alpha/beta/rc tags
34+
release = full_version.public
35+
# remove the post release segment, if any
36+
if full_version.is_postrelease:
37+
release = release.rsplit(".post", 1)[0]
38+
# The short X.Y.Z version.
39+
version = full_version.base_version
2940

3041
# -- General configuration ---------------------------------------------------
3142
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
3243

33-
# The full version, including alpha/beta/rc tags.
34-
release = version("grid-apps")
35-
# The shorter X.Y.Z version.
36-
version = Version(release).base_version
37-
38-
autodoc_mock_imports = [
39-
"numpy",
40-
"geoh5py",
41-
"geoapps_utils",
42-
"pydantic",
43-
"discretize",
44-
]
44+
nitpicky = True
4545

4646
extensions = [
4747
"sphinx.ext.autodoc",
4848
"sphinx.ext.autosummary",
49+
"sphinx.ext.intersphinx",
4950
"sphinx.ext.todo",
51+
"sphinx.ext.viewcode",
52+
"sphinx_issues",
53+
"sphinxcontrib.googleanalytics",
5054
]
5155

56+
intersphinx_mapping = {
57+
# use None to auto-fetch objects.inv
58+
"numpy": ("https://numpy.org/doc/1.26/", None),
59+
"python": ("http://docs.python.org/3", None),
60+
}
61+
5262
templates_path = ["_templates"]
5363
exclude_patterns = []
5464
todo_include_todos = True
5565

66+
googleanalytics_id = os.environ.get("GOOGLE_ANALYTICS_ID", "")
67+
if not googleanalytics_id:
68+
googleanalytics_enabled = False
69+
70+
issues_github_path = f"mirageoscience/{package_name}"
71+
5672
# -- Options for auto-doc ----------------------------------------------------
5773
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#module-sphinx.ext.autodoc
5874

5975
autodoc_typehints = "signature"
6076

77+
autodoc_mock_imports = [
78+
"discretize",
79+
"geoapps_utils",
80+
"geoh5py",
81+
"numpy",
82+
"pydantic",
83+
"scipy",
84+
"tqdm",
85+
]
86+
6187
# -- Options for HTML output -------------------------------------------------
6288
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
6389

environments/env-python-3.10.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

environments/env-python-3.11.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)