forked from prefix-dev/pixi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
editable support for pixi-python-backend
- Loading branch information
1 parent
7487cb6
commit 6f2e57d
Showing
9 changed files
with
921 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pixi | ||
#*.egg-info |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[project] | ||
dependencies = [] | ||
name = "editable-pyproject" | ||
requires-python = ">= 3.11" | ||
version = "0.1.0" | ||
|
||
[build-system] | ||
build-backend = "hatchling.build" | ||
requires = ["hatchling"] | ||
|
||
[tool.pixi.project] | ||
channels = ["https://prefix.dev/conda-forge"] | ||
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"] | ||
preview = ["pixi-build"] | ||
|
||
[tool.pixi.host-dependencies] | ||
# To be able to install this pyproject we need to install the dependencies of | ||
# the python build-system defined above. Note that different from the | ||
# pyproject build-system this refers to a conda package instead of a pypi | ||
# package. | ||
hatchling = "==1.26.3" | ||
|
||
# The build-system section defines the build system that will be used to turn | ||
# the source code of this package into a conda package. Similarly to the above | ||
# [build-system] section this section instructs pixi which build backend to | ||
# use. The build-backend is an executable that is installed and invoked by | ||
# pixi with the sole purpose to build the package. | ||
[tool.pixi.build-system] | ||
# The name of the build backend to use. This name refers both to the name of | ||
# the package that provides the build backend and the name of the executable | ||
# inside the package that is invoked. | ||
# | ||
# The `build-backend` key also functions as a dependency declaration. At least | ||
# a version specifier must be added. | ||
build-backend = { name = "pixi-build-python", version = "*" } | ||
# These are the conda channels that are used to resolve the dependencies of the | ||
# build backend package. | ||
channels = [ | ||
"https://prefix.dev/pixi-build-backends", | ||
"https://prefix.dev/conda-forge", | ||
] | ||
|
||
[tool.pixi.dependencies] | ||
editable-pyproject = { path = "." } | ||
|
||
[tool.pixi.tasks] | ||
check-editable = "python -c 'import editable_pyproject; editable_pyproject.check_editable()'" | ||
|
||
# This section marks the project as a pixi package. | ||
# | ||
# Normally a number of fields would be set here, like the name, version, etc. | ||
# However, since all these fields are already defined in the [project] section | ||
# at the top of this file they are not required. | ||
[tool.pixi.package] |
23 changes: 23 additions & 0 deletions
23
tests/data/pixi_build/editable-pyproject/src/editable_pyproject/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
__version__ = "1.0.0" | ||
|
||
import sys | ||
from pathlib import Path | ||
import site | ||
|
||
|
||
def is_editable() -> bool: | ||
package_name = "editable_pyproject" | ||
for site_package in site.getsitepackages(): | ||
egg_link_path = Path(site_package).joinpath(f"_{package_name}.pth") | ||
if egg_link_path.is_file(): | ||
return True | ||
return False | ||
|
||
|
||
def check_editable() -> None: | ||
if is_editable(): | ||
print("The package is installed as editable.") | ||
sys.exit(0) | ||
else: | ||
print("The package is not installed as editable.") | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters