Skip to content

Switch to using pixi instead of directy using conda for development #41

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

Merged
merged 4 commits into from
Jun 15, 2025
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 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
24 changes: 8 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,20 @@ jobs:
python-version: ["3.9", "3.11", "3.13"]
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-[email protected]
- uses: prefix-dev/setup-[email protected]
with:
miniforge-version: latest
conda-version: ">=24.11"
conda-build-version: ">=25.1"
environment-file: environment.yml
activate-environment: mkxref-dev
python-version: ${{ matrix.python-version }}
condarc-file: github-condarc.yml
auto-activate-base: true
use-mamba: false
- name: Dev install package
run: |
conda run -n mkxref-dev pip install -e . --no-deps --no-build-isolation
pixi-version: v0.43.3
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.GITHUB_TOKEN }}
- name: ruff
run: |
make ruff
pixi run ruff
- name: mypy
if: success() || failure()
run: |
make mypy
pixi run mypy
- name: Test with pytest
if: success() || failure()
run: |
make coverage-test
pixi run coverage
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ conda-meta-data.json




# pixi environments
.pixi
*.egg-info
1 change: 1 addition & 0 deletions .idea/garpy.mkdocstrings.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 13 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# Contributing to mkdocstrings-python-xref

This project's environment and developemtn tasks are managed using [pixi]
(previously it used conda and make).

## Prerequisites

* conda must be installed on your machine
* make should be installed in your base conda environment
* [install pixi][pixi-install]

## Development install
## Development setup

To (re)create a conda development environment for this project run:
To (re)create a pixi development environment for this project, from inside
the source tree run:

```
make createdev
conda activate mkxref-dev
pixi reinstall
```

After you have created the environment for the first time, you can configure your IDE
to use that for this project.

To update the environment after pulling or modifying project dependencies, you can use

```
make updatedev
```
This is actually optional, since pixi will automatically install the
environment the first time you run a command.

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

## Versioning

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


[pixi]: https://pixi.sh/latest/
[pixi-install]: https://pixi.sh/latest/installation/
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This makefile is deprecated!

CONDA := conda
ECHO := echo
RM := rm
Expand Down Expand Up @@ -32,13 +34,8 @@ SRC_FILES := $(wildcard src/mkdocstrings_handlers/python_xref/*.py) $(PYTHON_VER
# Env names
DEV_ENV := mkxref-dev

# Whether to run targets in current env or explicitly in $(DEV_ENV)
CURR_ENV_BASENAME := $(shell basename $(CONDA_PREFIX))
ifeq ($(CURR_ENV_BASENAME), $(DEV_ENV))
CONDA_RUN :=
else
CONDA_RUN := conda run -n $(DEV_ENV) --no-capture-output
endif
PIXI_RUN := pixi run
CONDA_RUN := $(PIXI_RUN)

# Testing args
PYTEST_ARGS :=
Expand Down
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- coverage >=7.4.0
- pytest >=8.2
- pytest-cov >=5.0
- pylint >=3.0.3
- mypy >=1.10
- ruff >=0.4.10
- beautifulsoup4 >=4.12
Expand All @@ -24,4 +23,3 @@ dependencies:
- mkdocs >=1.5.3,<2.0
- mkdocs-material >=9.5.4
- linkchecker >=10.4
- pydantic >=2.0
2,352 changes: 2,352 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

95 changes: 95 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,51 @@ dependencies = [
Repository = "https://github.com/analog-garage/mkdocstrings-python-xref"
Documentation = "https://analog-garage.github.io/mkdocstrings-python-xref/"

[project.optional-dependencies]
dev = [
"build >=1.0.0", # python-build on conda
"hatchling >=1.21",
"coverage >=7.4.0",
"pytest >=8.2",
"pytest-cov >=5.0",
"mypy >=1.10",
"ruff >=0.4.10",
"beautifulsoup4 >=4.12",
"black >=23.12",
"mike >=1.1",
"mkdocs >=1.5.3,<2.0",
"mkdocs-material >=9.5.4",
"linkchecker >=10.4"
]

[tool.pixi.workspace]
name = "mkxref-dev"
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64", "win-64"]

[tool.pixi.dependencies]
# Use conda for these in pixi
mkdocstrings-python ="*"
griffe ="*"
hatchling = "*"
python-build = "*"
coverage ="*"
pytest ="*"
pytest-cov ="*"
mypy ="*"
ruff = "*"
black = "*"
mike = "*"
mkdocs = "*"
mkdocs-material = "*"
linkchecker = "*"

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

[tool.pixi.environments]
default = {features = ["dev"]}

[tool.hatch.version]
path = "src/mkdocstrings_handlers/python_xref/VERSION"
pattern = "\\s*(?P<version>[\\w.]*)"
Expand Down Expand Up @@ -174,3 +219,53 @@ disable = [
"wrong-spelling-in-comment",
"wrong-spelling-in-docstring",
]

[tool.pixi.tasks]
# linting tasks
mypy = "mypy"
ruff = "ruff check src/mkdocstrings_handlers tests"
lint = {depends-on = ["ruff", "mypy"]}

# testing tasks
pytest = "pytest -sv -ra tests"
test = {depends-on = ["pytest", "lint"]}
coverage = "pytest -ra --cov --cov-report=html --cov-report=term -- tests"
coverage-show = "python -m webbrowser file://$PIXI_PROJECT_ROOT/htmlcov/index.html"

# doc tasks
docs = {depends-on = ["doc"]}
show-doc = "mkdocs serve -f mkdocs.yml"
show-docs = {depends-on = ["show-doc"]}

# cleanup tasks
clean-build = "rm -rf build dist"
clean-coverage = "rm -rf .coverage .coverage.* htmlcov"
clean-docs = "rm -rf site"
clean-test = "rm -rf .pytest_cache .mypy_cache .ruff_cache"
clean = {depends-on = ["clean-build", "clean-coverage", "clean-test"]}

# build tasks
build = {depends-on = ["build-wheel", "build-sdist", "build-conda"]}

[tool.pixi.tasks.build-wheel]
env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
cmd = "pip wheel . --no-deps --no-build-isolation -w dist"
inputs = ["pyproject.toml", "LICENSE.md", "src/**/*"]
outputs = ["dist/mkdocstrings_python_xref-$VERSION-py3-none-any.whl"]

[tool.pixi.tasks.build-sdist]
env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
cmd = "python -m build --sdist --no-isolation --outdir dist"
inputs = ["pyproject.toml", "LICENSE.md", "src/**/*"]
outputs = ["dist/mkdocstrings_python_xref-$VERSION.tar.gz"]

[tool.pixi.tasks.build-conda]
#env = {VERSION = "$(cat src/mkdocstrings_handlers/python_xref/VERSION)"}
cmd = "whl2conda convert dist/*.whl -w dist --overwrite"
depends-on = ["build-wheel"]
inputs = ["dist/mkdocstrings_python_xref-$VERSION-py3-none-any.whl"]

[tool.pixi.tasks.doc]
cmd = "mkdocs build -f mkdocs.yml"
inputs = ["docs/*.md", "docs/*.svg", "mkdocs.yml"]
outputs = ["site/*.html"]
Loading