Skip to content
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

feat: Add pixi to the template #305

Merged
merged 43 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e8de22e
edit files for add pixi
YurelyCamacho Jul 20, 2024
3a48335
add basic structure for pixi
YurelyCamacho Jul 20, 2024
2236b92
add configuration to pixipyproject.toml
YurelyCamacho Jul 25, 2024
82eca82
update pixi pyproject.toml
YurelyCamacho Jul 25, 2024
9191732
update pyproject.toml
YurelyCamacho Jul 30, 2024
d3725aa
add setuptools
YurelyCamacho Jul 31, 2024
3575944
update requires-python in base-pyproject.toml
YurelyCamacho Jul 31, 2024
a4ea5d4
change requires-python
YurelyCamacho Jul 31, 2024
a2a697e
change python version
YurelyCamacho Jul 31, 2024
c41914c
update
YurelyCamacho Jul 31, 2024
08379a4
change in files for cargo build
YurelyCamacho Jul 31, 2024
dbc6419
changes in base to hatch
YurelyCamacho Jul 31, 2024
e7b0136
update command
YurelyCamacho Jul 31, 2024
6e9d61c
changes cargo command
YurelyCamacho Jul 31, 2024
7c3bb72
change cargo build command
YurelyCamacho Jul 31, 2024
0e86b21
add pip install command
YurelyCamacho Jul 31, 2024
a6c5b4e
update files
YurelyCamacho Aug 1, 2024
f47e213
build requirement
YurelyCamacho Aug 6, 2024
7dcebd1
add build
YurelyCamacho Aug 6, 2024
ca869ff
update pyproject.toml
YurelyCamacho Aug 6, 2024
5c37bcc
test with pixi
YurelyCamacho Aug 6, 2024
de1f672
update base.sh
YurelyCamacho Aug 14, 2024
2926648
move from conda pkg build to python-build for pixi
YurelyCamacho Sep 5, 2024
46fe8fc
fix commands test
YurelyCamacho Sep 5, 2024
9eb19ce
syntax error
YurelyCamacho Sep 5, 2024
b11a8db
buiold commands
YurelyCamacho Sep 10, 2024
d694ef2
pixi commands
YurelyCamacho Sep 11, 2024
3816e96
revert command
YurelyCamacho Sep 11, 2024
0692266
update
YurelyCamacho Sep 12, 2024
bdc2624
fix build
YurelyCamacho Sep 12, 2024
abe62c8
version build
YurelyCamacho Sep 12, 2024
b1a8040
build-system table
YurelyCamacho Sep 12, 2024
c6dd07b
fix pyproject.toml
YurelyCamacho Sep 12, 2024
8e2cb2f
versions
YurelyCamacho Sep 24, 2024
81f8169
changes
YurelyCamacho Sep 25, 2024
bccecc0
version
YurelyCamacho Sep 25, 2024
337b556
update documentation for Pixi
YurelyCamacho Sep 26, 2024
b28bcce
update
YurelyCamacho Sep 26, 2024
50d615e
fix prettier issues
YurelyCamacho Sep 26, 2024
22755f7
change build to python-build
YurelyCamacho Oct 1, 2024
1a2218b
add tool.pixi.environments table
YurelyCamacho Oct 1, 2024
929cb2d
quotes
YurelyCamacho Oct 2, 2024
27dc01c
fix issue with project version
YurelyCamacho Oct 2, 2024
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
4 changes: 2 additions & 2 deletions docs/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ needs.
- **Project Structure:** Choose between "src" (code in a subdirectory) and
"flat" (all files in the top-level directory) layouts.
- **Packaging & Dependencies:** Supports Poetry, Flit, meson-python, setuptools,
PDM, Hatch, Maturin, scikit-build-core, or setuptools + pybind11 for flexible
build systems.
PDM, Hatch, Maturin, scikit-build-core, Pixi, or setuptools + pybind11 for
flexible build systems.
- **Testing & Linting:** Integrates with pytest, hypothesis, black
(auto-formatting), bandit (security), pydocstyle (documentation style),
vulture (unused code detection), and McCabe (cyclomatic complexity analysis)
Expand Down
10 changes: 10 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ packages. SciCookie support the following:
game development and automation. Staying up-to-date with the latest pybind11
documentation ensures the best practices are followed.

- [**Pixi**](https://pixi.sh/latest/): Pixi is a package manager designed to
simplify dependency management by creating reproducible development
environments. Pixi focuses on local environments for specific projects,
generating automatic lock-files to ensure that the same dependencies can be
installed across different machines. It also offers a cross-platform task
system for efficient project-specific tasks, such as building, testing, and
more. Pixi supports multiple languages and is designed to make it easy for
developers to share their projects without worrying about dependency
conflicts.

The idea behind the options in SciCookie is that you can choose from some of the
most popular system compilers to suit your needs and preferences for developing
Python packages. If you think we should add more options, you can submit your
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Python package.
[Setuptools](https://setuptools.pypa.io/en/latest/),
[PDM](https://pdm.fming.dev/), [Hatch](https://hatch.pypa.io),
[Maturin](https://pypi.org/project/maturin/0.8.2/),
[scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/) or
[setuptools + pybind11](https://pybind11.readthedocs.io/en/stable/) based on
your preference.
[scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/),
[setuptools + pybind11](https://pybind11.readthedocs.io/en/stable/) or
[Pixi](https://pixi.sh/latest/) based on your preference.
- The structure of the project can use the _src layout_ or _flat layout_. The
“src layout” moving the code that is intended to be importable into a
subdirectory. This subdirectory is typically named src. "Flat layout" refers
Expand Down
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
create = false
3 changes: 2 additions & 1 deletion src/scicookie/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"hatch",
"maturin",
"scikit-build-core",
"pybind11"
"pybind11",
"pixi"
],
"use_bandit": "no",
"use_black": "no",
Expand Down
7 changes: 7 additions & 0 deletions src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
BUILD_SYSTEM = "scikit-build-core"
{% elif cookiecutter.build_system == "pybind11" -%}
BUILD_SYSTEM = "pybind11"
{% elif cookiecutter.build_system == "pixi" -%}
BUILD_SYSTEM = "pixi"
{%- else %}
BUILD_SYSTEM = None
{%- endif %}
Expand Down Expand Up @@ -264,6 +266,11 @@ def clean_up_build_system():
build_system_dir / "pyproject.toml",
PROJECT_DIRECTORY / 'pyproject.toml'
)
elif BUILD_SYSTEM == "pixi":
shutil.move(
build_system_dir / "pyproject.toml",
PROJECT_DIRECTORY / 'pyproject.toml'
)
elif BUILD_SYSTEM == "poetry":
shutil.move(
build_system_dir / "pyproject.toml",
Expand Down
1 change: 1 addition & 0 deletions src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ build_system:
- maturin
- scikit-build-core
- pybind11
- pixi
visible: true

command_line_interface:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ jobs:
flit install
{%- elif cookiecutter.build_system == "pdm" %}
pdm install
{%- elif cookiecutter.build_system == "pixi" %}
pixi install
{%- else %}
pip install .
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
flit install
{%- elif cookiecutter.build_system == "pdm" %}
pdm install
{%- elif cookiecutter.build_system == "pixi" %}
pixi install
{%- else %}
pip install .
{%- endif %}
Expand Down
2 changes: 2 additions & 0 deletions src/scicookie/{{cookiecutter.project_slug}}/.makim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ groups:
maturin build
{%- elif cookiecutter.build_system == "pybind11" %}
python -m build
{%- elif cookiecutter.build_system == "pixi" %}
pixi run -e dev python -m build
{%- endif %}

release:
Expand Down
2 changes: 2 additions & 0 deletions src/scicookie/{{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ build:
maturin build
{%- elif cookiecutter.build_system == "pybind11" %}
python -m build
{%- elif cookiecutter.build_system == "pixi" %}
pixi run -e dev python -m build
{%- endif %}

.PHONY:release-ci
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
{%- endif %}
dev = [
{#- keep this line here -#}
{%- if cookiecutter.build_system in ["setuptools", "pybind11"] %}
"build>=0.10.0",
{%- if cookiecutter.build_system in ["setuptools", "pybind11", "pixi"] %}
"build >= 1.2.2",
{%- endif -%}
{%- if cookiecutter.use_pytest == "yes" %}
"pytest >= 7.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = [
{ name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" },
]
description = "{{ cookiecutter.project_short_description }}"
{% if cookiecutter.build_system not in ["setuptools", "pybind11"]%}
{% if cookiecutter.build_system not in ["setuptools", "pybind11", "pixi"]%}
{% if cookiecutter.project_layout == "src" -%}
packages = [
{include = "{{ cookiecutter.package_slug }}", from="src"},
Expand Down Expand Up @@ -48,7 +48,7 @@ version = "{{ cookiecutter.project_version }}"
{% else %}
dynamic = ["version"]
{% endif -%}
requires-python = ">=3.8.1,<4"
requires-python = ">=3.8.6,<4"
dependencies = [
# note: add your dependencies here
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["setuptools>=40.8.0", "wheel", "build>=1.2.2"]
build-backend = "setuptools.build_meta"

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64"]

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

[tool.pixi.dependencies]
python-build = ">=1.2.2"

[tool.pixi.environments]
dev = ["dev"]

{% include "build-system/base/pyproject.toml" %}
{% include "build-system/base/dev-deps-pyproject.toml" %}
{% include "build-system/base/urls-pyproject.toml" %}
{% include "build-system/base/dev-deps-config-pyproject.toml" %}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ dependencies:
{%- elif cookiecutter.build_system == "pybind11" %}
- pybind11
- cmake
{%- elif cookiecutter.build_system == "pixi" %}
- setuptools
- pixi
- python-build
{%- endif %}
- nodejs # used by semantic-release
{%- if cookiecutter.use_shellcheck == "yes" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ cmake
{%- elif cookiecutter.build_system == "pybind11" %}
pybind11
cmake
{%- elif cookiecutter.build_system == "pixi" %}
setuptools
pixi
build
{%- endif %}
nodejs # used by semantic-release
{%- if cookiecutter.use_shellcheck == "yes" %}
Expand Down
1 change: 1 addition & 0 deletions tests/profiles/test-depends-on.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ build_system:
- maturin
- scikit-build-core
- pybind11
- pixi
visible: true

command_line_interface:
Expand Down
1 change: 1 addition & 0 deletions tests/profiles/test-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ build_system:
- maturin
- scikit-build-core
- pybind11
- pixi
visible: true

command_line_interface:
Expand Down
20 changes: 12 additions & 8 deletions tests/smoke/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ export PATH=$(echo $PATH| sed -E "s/[^:]+\/scicookie\/[^:]+//g")

BUILD_SYSTEM="others"

COMMAND_PREFIX=
if command -v poetry &> /dev/null; then
poetry install
elif command -v flit &> /dev/null; then
flit install
elif command -v pixi &> /dev/null; then
COMMAND_PREFIX="pixi run"
pip install ".[dev]"
elif command -v meson &> /dev/null; then
BUILD_SYSTEM="mesonpy"
pip install ".[dev]"
Expand All @@ -54,23 +58,23 @@ else
pip install ".[dev]"
fi

ipython kernel install --name "python3" --user
$COMMAND_PREFIX ipython kernel install --name "python3" --user

if command -v makim &> /dev/null; then
makim tests.linter
makim docs.build
makim package.build
$COMMAND_PREFIX makim tests.linter
$COMMAND_PREFIX makim docs.build
$COMMAND_PREFIX makim package.build
elif command -v make &> /dev/null; then
make lint
make docs-build
make build
$COMMAND_PREFIX make lint
$COMMAND_PREFIX make docs-build
$COMMAND_PREFIX make build
else
echo "Makim and Make were not found in the system."
exit 1

fi

python -c "import osl_python_package as mypkg; assert mypkg.__version__ == '0.1.0'"
$COMMAND_PREFIX python -c "import osl_python_package as mypkg; assert mypkg.__version__ == '0.1.0'"
Copy link
Member

Choose a reason for hiding this comment

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

not sure .. but it looks like that there is any issue running this with pixi ... so maybe you could try a different approach:

Suggested change
$COMMAND_PREFIX python -c "import osl_python_package as mypkg; assert mypkg.__version__ == '0.1.0'"
$COMMAND_PREFIX python -c 'import osl_python_package as mypkg; assert mypkg.__version__ == "0.1.0"'


if [[ "$BUILD_SYSTEM" == "maturin" ]]; then
python -c "from osl_python_package import add; add(1, 1)"
Expand Down
1 change: 1 addition & 0 deletions tests/smoke/build-systems.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. ${SMOKE_DIR}/base.sh "build_system=maturin"
. ${SMOKE_DIR}/base.sh "build_system=scikit-build-core"
. ${SMOKE_DIR}/base.sh "build_system=pybind11"
. ${SMOKE_DIR}/base.sh "build_system=pixi"
. ${SMOKE_DIR}/base.sh "build_system=poetry"
Loading