Skip to content
Draft
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
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,20 @@ jobs:
# and is recommending this work-around for the time being, see
# https://status.coveralls.io/incidents/pdbt7vdzlvpj
fail-on-error: false

check-environment:
name: Check dependencies in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
with:
run-install: false
- name: Check pyproject.toml and environment.yml are in sync
run: |
pixi workspace export conda-environment --name conda-smithy | sed '/^$/d' > environment.yml
if ! git diff --exit-code environment.yml; then
echo "error: pyproject.toml [tool.pixi] and environment.yml are out of sync"
echo "Run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please post the diff here? There's no need for a developer to force pixi to figure out this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff is currently empty because the two files are consistent.
This CI check guarantees they will remain in sync moving forward.

In the future if a dev adjusts a dependency they have to do it in pyproject.toml and environment.yml consistently, or they just do it in pyproject.toml and run the pixi workspace export command which applies the correct consistent change to environment.yml.

As far as I know there is no better way to do it. But seems OK, no?

@isuruf Does this answer your question?
(Apologies if I misunderstood/don't get what you are looking for)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean report the failing diff in the CI test, so that a PR author can apply the diff without needing to have pixi.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AFAIK the line if ! git diff --exit-code environment.yml is not redirecting output anywhere, so it'll be printed by default 🤔 See this example with a single line change in README.md:

❯ git status
On branch linter-revamp
Your branch is up to date with 'origin/linter-revamp'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")
❯ if ! git diff --exit-code; then
∙   echo "There are changes"
∙ fi
diff --git i/README.md w/README.md
index f10ed6ba..08723d03 100644
--- i/README.md
+++ w/README.md
@@ -15,6 +15,8 @@ Overview
 [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
 [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
 
+A change
+
 Installation
 ------------
 
There are changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
echo "Run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"
echo "Please apply the above diff or run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"

exit 1
fi
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ nppBackup/
.mypy_cache/

conda_smithy/_version.py

# pixi environments
.pixi/*
!.pixi/config.toml
Comment thread
cdeil marked this conversation as resolved.
pixi.lock

venv
oryx-build-commands.txt
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,22 @@ When everything is configured you can trigger a build with a push to the feedsto
Developing conda-smithy
-----------------------

To develop conda smithy, use your favortite conda-based environment manager and create an environment based on the `environment.yml`.
To develop conda-smithy, create an environment with all dependencies and install conda-smithy in editable mode.

### Using pixi

```
pixi install
pixi run pytest
```

### Using conda

```
$ conda env create
conda env create
conda activate conda-smithy
pip install --no-build-isolation -e .
pytest tests
```

Releasing conda-smithy
Expand Down
80 changes: 37 additions & 43 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
name: conda-smithy
channels:
- conda-forge
- nodefaults
- conda-forge
- nodefaults
dependencies:
Comment thread
cdeil marked this conversation as resolved.
- python>=3.6
# Development dependencies
- pip
- python-build
- setuptools>=45
- setuptools_scm>=8.1
- tomli>=1.0.0
- pre-commit
- mock
- pytest
- pytest-cov
# # Part of some optional lint tests
- conda-recipe-manager >=0.9
- conda-souschef
# Runtime dependencies
- conda >=4.2
- conda-build >=25.3.1
- conda-package-handling >=1.9.0
- jinja2
- requests
- pycryptodome
- referencing
- pygit2
- pygithub >=2,<3
- ruamel.yaml
- conda-forge-pinning
- vsts-python-api
- toolz
- shellcheck
- scrypt
- license-expression
- libarchive
- cirun >=0.30
- pydantic >=2.11,<3
- pixi >=0.59.0
- jsonschema
- backports.strenum
- exceptiongroup
# py-rattler's API subject to change, pin to minor
- py-rattler >=0.22,<0.23
- rattler-build-conda-compat >=1.4.5,<2.0.0a0
- pre-commit *
- mock *
- pytest *
- pytest-cov *
- conda-recipe-manager >=0.9
- conda-souschef *
- conda >=4.2
- conda-build >=25.3.1
- conda-package-handling >=1.9.0
- jinja2 *
- requests *
- pycryptodome *
- referencing *
- pygit2 *
- pygithub >=2,<3
- ruamel.yaml *
- conda-forge-pinning *
- vsts-python-api *
- toolz *
- shellcheck *
- scrypt *
- license-expression *
- libarchive *
- cirun >=0.30
- pydantic >=2.11,<3
- pixi >=0.59.0
- jsonschema *
- backports.strenum *
- exceptiongroup *
- py-rattler >=0.22,<0.23
- rattler-build-conda-compat >=1.4.5,<2.0.0a0
- python >=3.9
Comment on lines +36 to +37

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- rattler-build-conda-compat >=1.4.5,<2.0.0a0
- python >=3.9
- rattler-build-conda-compat >=1.4.12,<2.0.0a0
- python >=3.11

As per recently merged PRs.

- pip
- pip:
- -e .
Comment on lines +39 to +40

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this please

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is added by pixi workspace export conda-environment because of the pypi-dependencies table, and I see no way to disable that. We may need to edit it out by hand with sed or something.

@cdeil, if you are into Rust, adding a --no-pip flag to the subcommand in Pixi would be straightforward. This the Rust module: https://github.com/prefix-dev/pixi/blob/802105d11f030187916ee812e66572a388c76c3d/crates/pixi_cli/src/workspace/export/conda_environment.rs#L166-L170

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just out of curiosity, why do you want to remove this? Isnt it just as nice that you dont have to run pip install -e anymore?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like tools doing sneaky things. It's a hack anyway that -e . works at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I implemented the --no-pypi prefix-dev/pixi#6380

24 changes: 24 additions & 0 deletions news/pixi-dev-support.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* Add Pixi dev support in `pyproject.toml`, keeping `conda` support as-is.
This is for devs working on `conda-smithy`.
Comment on lines +3 to +4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Add Pixi dev support in `pyproject.toml`, keeping `conda` support as-is.
This is for devs working on `conda-smithy`.
* Add Pixi-driven development support in `pyproject.toml`, keeping `conda` support as-is. (#2525)


**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,53 @@ markers = [
"legacy_appveyor: Test designed to run as if prior to the azure migration",
"cli: CLI tests outside of test/test_cli.py",
]

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

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

# Runtime dependencies
[tool.pixi.dependencies]
conda = ">=4.2"
conda-build = ">=25.3.1"
conda-package-handling = ">=1.9.0"
jinja2 = "*"
requests = "*"
pycryptodome = "*"
referencing = "*"
pygit2 = "*"
pygithub = ">=2,<3"
"ruamel.yaml" = "*"
conda-forge-pinning = "*"
vsts-python-api = "*"
toolz = "*"
shellcheck = "*"
scrypt = "*"
license-expression = "*"
libarchive = "*"
cirun = ">=0.30"
pydantic = ">=2.11,<3"
pixi = ">=0.59.0"
jsonschema = "*"
"backports.strenum" = "*"
exceptiongroup = "*"
# py-rattler's API subject to change, pin to minor
py-rattler = ">=0.22,<0.23"
rattler-build-conda-compat = ">=1.4.5,<2.0.0a0"
Comment thread
cdeil marked this conversation as resolved.
Comment thread
cdeil marked this conversation as resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
rattler-build-conda-compat = ">=1.4.5,<2.0.0a0"
rattler-build-conda-compat = ">=1.4.12,<2.0.0a0"

As per recently merged PRs.


# Development and testing dependencies
[tool.pixi.feature.dev.dependencies]
pre-commit = "*"
mock = "*"
pytest = "*"
pytest-cov = "*"
# Part of some optional lint tests
conda-recipe-manager = ">=0.9"
conda-souschef = "*"

[tool.pixi.environments]
default = { features = ["dev"], solve-group = "default" }