Skip to content

Commit d9589f4

Browse files
Merge pull request #41 from analog-garage/pixi
Switch to using pixi instead of directy using conda for development
2 parents d89e86c + 9361c1e commit d9589f4

File tree

9 files changed

+2479
-40
lines changed

9 files changed

+2479
-40
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/main.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,20 @@ jobs:
1212
python-version: ["3.9", "3.11", "3.13"]
1313
steps:
1414
- uses: actions/checkout@v3
15-
- uses: conda-incubator/setup-[email protected]
15+
- uses: prefix-dev/setup-[email protected]
1616
with:
17-
miniforge-version: latest
18-
conda-version: ">=24.11"
19-
conda-build-version: ">=25.1"
20-
environment-file: environment.yml
21-
activate-environment: mkxref-dev
22-
python-version: ${{ matrix.python-version }}
23-
condarc-file: github-condarc.yml
24-
auto-activate-base: true
25-
use-mamba: false
26-
- name: Dev install package
27-
run: |
28-
conda run -n mkxref-dev pip install -e . --no-deps --no-build-isolation
17+
pixi-version: v0.43.3
18+
cache: true
19+
auth-host: prefix.dev
20+
auth-token: ${{ secrets.GITHUB_TOKEN }}
2921
- name: ruff
3022
run: |
31-
make ruff
23+
pixi run ruff
3224
- name: mypy
3325
if: success() || failure()
3426
run: |
35-
make mypy
27+
pixi run mypy
3628
- name: Test with pytest
3729
if: success() || failure()
3830
run: |
39-
make coverage-test
31+
pixi run coverage

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ conda-meta-data.json
3737

3838

3939

40+
41+
# pixi environments
42+
.pixi
43+
*.egg-info

.idea/garpy.mkdocstrings.iml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTING.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
# Contributing to mkdocstrings-python-xref
22

3+
This project's environment and developemtn tasks are managed using [pixi]
4+
(previously it used conda and make).
5+
36
## Prerequisites
47

5-
* conda must be installed on your machine
6-
* make should be installed in your base conda environment
8+
* [install pixi][pixi-install]
79

8-
## Development install
10+
## Development setup
911

10-
To (re)create a conda development environment for this project run:
12+
To (re)create a pixi development environment for this project, from inside
13+
the source tree run:
1114

1215
```
13-
make createdev
14-
conda activate mkxref-dev
16+
pixi reinstall
1517
```
1618

17-
After you have created the environment for the first time, you can configure your IDE
18-
to use that for this project.
19-
20-
To update the environment after pulling or modifying project dependencies, you can use
21-
22-
```
23-
make updatedev
24-
```
19+
This is actually optional, since pixi will automatically install the
20+
environment the first time you run a command.
2521

26-
This is just an optimization. If it does not work (e.g. can happen when switching to an old branch), just use `createdev`.
22+
See `pixi task list` for a list of available tasks.
2723

2824
## Versioning
2925

@@ -32,3 +28,5 @@ The versions will generally track the version of [mkdocstrings_python][] on whic
3228
[mkdocstrings_python]: https://github.com/mkdocstrings/python
3329

3430

31+
[pixi]: https://pixi.sh/latest/
32+
[pixi-install]: https://pixi.sh/latest/installation/

Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This makefile is deprecated!
2+
13
CONDA := conda
24
ECHO := echo
35
RM := rm
@@ -32,13 +34,8 @@ SRC_FILES := $(wildcard src/mkdocstrings_handlers/python_xref/*.py) $(PYTHON_VER
3234
# Env names
3335
DEV_ENV := mkxref-dev
3436

35-
# Whether to run targets in current env or explicitly in $(DEV_ENV)
36-
CURR_ENV_BASENAME := $(shell basename $(CONDA_PREFIX))
37-
ifeq ($(CURR_ENV_BASENAME), $(DEV_ENV))
38-
CONDA_RUN :=
39-
else
40-
CONDA_RUN := conda run -n $(DEV_ENV) --no-capture-output
41-
endif
37+
PIXI_RUN := pixi run
38+
CONDA_RUN := $(PIXI_RUN)
4239

4340
# Testing args
4441
PYTEST_ARGS :=

environment.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- coverage >=7.4.0
1515
- pytest >=8.2
1616
- pytest-cov >=5.0
17-
- pylint >=3.0.3
1817
- mypy >=1.10
1918
- ruff >=0.4.10
2019
- beautifulsoup4 >=4.12
@@ -24,4 +23,3 @@ dependencies:
2423
- mkdocs >=1.5.3,<2.0
2524
- mkdocs-material >=9.5.4
2625
- linkchecker >=10.4
27-
- pydantic >=2.0

pixi.lock

Lines changed: 2352 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,51 @@ dependencies = [
3333
Repository = "https://github.com/analog-garage/mkdocstrings-python-xref"
3434
Documentation = "https://analog-garage.github.io/mkdocstrings-python-xref/"
3535

36+
[project.optional-dependencies]
37+
dev = [
38+
"build >=1.0.0", # python-build on conda
39+
"hatchling >=1.21",
40+
"coverage >=7.4.0",
41+
"pytest >=8.2",
42+
"pytest-cov >=5.0",
43+
"mypy >=1.10",
44+
"ruff >=0.4.10",
45+
"beautifulsoup4 >=4.12",
46+
"black >=23.12",
47+
"mike >=1.1",
48+
"mkdocs >=1.5.3,<2.0",
49+
"mkdocs-material >=9.5.4",
50+
"linkchecker >=10.4"
51+
]
52+
53+
[tool.pixi.workspace]
54+
name = "mkxref-dev"
55+
channels = ["conda-forge"]
56+
platforms = ["osx-arm64", "linux-64", "win-64"]
57+
58+
[tool.pixi.dependencies]
59+
# Use conda for these in pixi
60+
mkdocstrings-python ="*"
61+
griffe ="*"
62+
hatchling = "*"
63+
python-build = "*"
64+
coverage ="*"
65+
pytest ="*"
66+
pytest-cov ="*"
67+
mypy ="*"
68+
ruff = "*"
69+
black = "*"
70+
mike = "*"
71+
mkdocs = "*"
72+
mkdocs-material = "*"
73+
linkchecker = "*"
74+
75+
[tool.pixi.pypi-dependencies]
76+
mkdocstrings-python-xref = { path = ".", editable = true }
77+
78+
[tool.pixi.environments]
79+
default = {features = ["dev"]}
80+
3681
[tool.hatch.version]
3782
path = "src/mkdocstrings_handlers/python_xref/VERSION"
3883
pattern = "\\s*(?P<version>[\\w.]*)"
@@ -174,3 +219,53 @@ disable = [
174219
"wrong-spelling-in-comment",
175220
"wrong-spelling-in-docstring",
176221
]
222+
223+
[tool.pixi.tasks]
224+
# linting tasks
225+
mypy = "mypy"
226+
ruff = "ruff check src/mkdocstrings_handlers tests"
227+
lint = {depends-on = ["ruff", "mypy"]}
228+
229+
# testing tasks
230+
pytest = "pytest -sv -ra tests"
231+
test = {depends-on = ["pytest", "lint"]}
232+
coverage = "pytest -ra --cov --cov-report=html --cov-report=term -- tests"
233+
coverage-show = "python -m webbrowser file://$PIXI_PROJECT_ROOT/htmlcov/index.html"
234+
235+
# doc tasks
236+
docs = {depends-on = ["doc"]}
237+
show-doc = "mkdocs serve -f mkdocs.yml"
238+
show-docs = {depends-on = ["show-doc"]}
239+
240+
# cleanup tasks
241+
clean-build = "rm -rf build dist"
242+
clean-coverage = "rm -rf .coverage .coverage.* htmlcov"
243+
clean-docs = "rm -rf site"
244+
clean-test = "rm -rf .pytest_cache .mypy_cache .ruff_cache"
245+
clean = {depends-on = ["clean-build", "clean-coverage", "clean-test"]}
246+
247+
# build tasks
248+
build = {depends-on = ["build-wheel", "build-sdist", "build-conda"]}
249+
250+
[tool.pixi.tasks.build-wheel]
251+
env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
252+
cmd = "pip wheel . --no-deps --no-build-isolation -w dist"
253+
inputs = ["pyproject.toml", "LICENSE.md", "src/**/*"]
254+
outputs = ["dist/mkdocstrings_python_xref-$VERSION-py3-none-any.whl"]
255+
256+
[tool.pixi.tasks.build-sdist]
257+
env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
258+
cmd = "python -m build --sdist --no-isolation --outdir dist"
259+
inputs = ["pyproject.toml", "LICENSE.md", "src/**/*"]
260+
outputs = ["dist/mkdocstrings_python_xref-$VERSION.tar.gz"]
261+
262+
[tool.pixi.tasks.build-conda]
263+
#env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
264+
cmd = "whl2conda convert dist/*.whl -w dist --overwrite"
265+
depends-on = ["build-wheel"]
266+
inputs = ["dist/mkdocstrings_python_xref-$VERSION-py3-none-any.whl"]
267+
268+
[tool.pixi.tasks.doc]
269+
cmd = "mkdocs build -f mkdocs.yml"
270+
inputs = ["docs/*.md", "docs/*.svg", "mkdocs.yml"]
271+
outputs = ["site/*.html"]

0 commit comments

Comments
 (0)