Skip to content

Commit

Permalink
build: drop pdm for pixi only dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
daylinmorgan committed Sep 11, 2024
1 parent 5d99650 commit a213871
Show file tree
Hide file tree
Showing 7 changed files with 2,881 additions and 2,990 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ jobs:
# - "test312"
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
- uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.18.0
# setup-pixi tries to cache using a non-existent pyproject.lock
# cache: true
pixi-version: v0.29.0
cache: true
manifest-path: pyproject.toml

- name: Install pycashier for tests
run: pixi run -e ${{ matrix.environment }} pdm install -d -G dev

- name: Run tests
run: pixi run -e ${{ matrix.environment }} pytest
8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ Please submit an issue with a detailed bug report or feature request prior to op
> Most important development tasks are covered by recipes within the [`Makefile`](./Makefile).
> See `make help` for more info.
The development for `pycashier` is managed by a combination
of [`pixi`](https://github.com/prefix-dev/pixi)
and [`pdm`](https://github.com/pdm-project/pdm).

It's only necessary to install `pixi` as `pdm` is installed directly in the `pixi`-managed `conda` environment.
The development for `pycashier` is managed by [`pixi`](https://github.com/prefix-dev/pixi).
You can use the included `Makefile` to setup `pixi` envs and `pre-commit`.

```sh
make env
Expand All @@ -26,7 +23,6 @@ Or directly calling the commands invoked my `make env`:

```sh
pixi install -e dev
pixi run -e dev pdm install
pixi run -e dev pre-commit install
pixi shell -e dev
```
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ build: ## build-{dist,docker}
$(MAKE) build-docker

build-dist: ## make wheel & source distribution
pdm build
pixi run build-wheel

## build-docker |> build and tag docker image with version
build-docker:
Expand All @@ -39,7 +39,6 @@ conda-env: pixi.toml pixi.lock ##
pixi install -e dev

setup-env: ##
pixi run -e dev pdm install
pixi run -e dev pre-commit install

.PHONY: version-check
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ghcr.io/prefix-dev/pixi:0.18.0 AS build
FROM ghcr.io/prefix-dev/pixi:0.29.0 AS build

COPY . /app
WORKDIR /app
RUN pixi install --frozen --environment build
RUN pixi install --frozen --environment prod
RUN pixi install -vv --frozen --environment build
RUN pixi install -vv --frozen --environment prod
RUN pixi run -e build -vv build-wheel
RUN pixi run -e prod -vv postinstall-production
RUN pixi shell-hook -e prod > /shell-hook
Expand All @@ -12,7 +12,7 @@ RUN echo 'pycashier "$@"' >> /shell-hook
# cleanup unnecessary files from environment to reduce image size
RUN bash docker/purge.sh

FROM debian:bookworm-slim as production
FROM debian:bookworm-slim AS production

RUN groupadd -g 2009 pycashier && useradd -u 2009 -g 2009 pycashier
USER pycashier
Expand Down
1,092 changes: 0 additions & 1,092 deletions pdm.lock

This file was deleted.

4,640 changes: 2,820 additions & 1,820 deletions pixi.lock

Large diffs are not rendered by default.

110 changes: 51 additions & 59 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name = "pycashier"
description = "cash in on expressed barcode tags"
authors = [{ name = "Daylin Morgan", email = "[email protected]" }]
dependencies = [
"rich>=12.0.0",
"tomlkit>=0.10.1",
"click-rich-help>=22.1.0",
"click>=8.1.0",
"polars>=0.20.4",
"rich>=12.0.0",
"tomlkit>=0.10.1",
"click-rich-help>=22.1.0",
"click>=8.1.0",
"polars>=1.0.0",
]
requires-python = ">=3.8"
readme = "README.md"
Expand All @@ -22,8 +22,10 @@ documentation = "https://docs.brocklab.com/pycashier"
pycashier = "pycashier.cli:main"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[tool.mypy]
check_untyped_defs = true
Expand All @@ -40,58 +42,33 @@ ignore_missing_imports = true

[tool.ruff]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I001"
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I001",
]
# docstrings are longer because of formatting
# ruff will handle the code formatting for us
ignore = ["E501"]

[tool.coverage.run]
omit = [
"tests/",
"env/"
]


[tool.pdm]
version = { source = "scm" }
# need python 3.9 for these which I usually have anyways
ignore_package_warnings = ["sphinx*", "myst-parser"]

[tool.pdm.dev-dependencies]
dev = [
"pre-commit<3.0.0,>=2.15.0",
"mypy>=0.982",
"pytest>=7.2.0",
"pytest-cov>=4.1.0",
]
docs = [
"sphinx",
"sphinx-autobuild",
"sphinx-copybutton",
"myst-parser",
"shibuya",
]

omit = ["tests/", "env/"]

[tool.pixi.project]
name = "pycashier"
authors = ["Daylin Morgan <[email protected]>"]
channels = ["conda-forge" , "bioconda"]
channels = ["conda-forge", "bioconda"]
platforms = ["linux-64"]


[tool.pixi.environments]
dev = ["base", "bioconda", "dev", "build"]
prod = ["base","bioconda", "prod"]
build = ["build"]
test = ["bioconda", "dev", "test"]
dev = ["base", "bioconda", "dev", "build", "docs", "tutorial"]
prod = ["base", "bioconda", "prod"]
build = ["base", "build"]
test = ["base", "bioconda", "dev", "test"]
test38 = ["bioconda", "dev", "test", "test38"]
test39 = ["bioconda", "dev", "test", "test39"]
test310 = ["bioconda", "dev", "test", "test310"]
Expand All @@ -100,18 +77,32 @@ test310 = ["bioconda", "dev", "test", "test310"]
pip = "*"

[tool.pixi.feature.base.dependencies]
# https://bioconda.github.io/faqs.html#what-versions-are-supported
python = ">=3.8,<3.11"
# https://bioconda.github.io/faqs.html#what-versions-are-supported
# when pixi add polars to pypi-dependencies it was trying to build it with cargo
# adding it here to use pre-built objects from conda-forge
polars = ">=1.0.0"

[tool.pixi.feature.docs.dependencies]
sphinx = "*"
sphinx-autobuild = "*"
sphinx-copybutton = "*"
sphinx-tabs = "*"
myst-parser = "*"
shibuya = "*"

[tool.pixi.feature.dev.dependencies]
pdm = ">=2.12.4,<2.13"
pre-commit = "<3.0.0,>=2.15.0"
mypy = ">=0.982"
pytest = ">=7.2.0"
pytest-cov = ">=4.1.0"

[tool.pixi.feature.prod.dependencies]
tomlkit = ">=0.12.4,<0.13"
rich = ">=13.7.1,<13.8"
click-rich-help = ">=22.1.1,<22.2"
click = ">=8.1.7,<8.2"
polars = ">=0.20.13,<0.21"
rich = ">=12.0.0"
tomlkit = ">=0.10.1"
click-rich-help = ">=22.1.0"
click = ">=8.1.0"
polars = ">=1.0.0"

[tool.pixi.feature.bioconda.dependencies]
cutadapt = ">=4.6,<5"
Expand All @@ -121,7 +112,10 @@ pysam = ">=0.22.0,<0.23"

[tool.pixi.feature.test.dependencies]
pytest = ">=7.2.0"
pytest-cov= ">=4.1.0"
pytest-cov = ">=4.1.0"

[tool.pixi.feature.tutorial.dependencies]
ipykernel = "*"

[tool.pixi.feature.test38.dependencies]
python = "3.8.*"
Expand All @@ -131,12 +125,10 @@ python = "3.9.*"
python = "3.10.*"

[tool.pixi.feature.build.dependencies]
build = "*"
pdm-backend = "*"
git = "*" # for scm-versioning with pdm

[tool.pixi.feature.dev.tasks]
postinstall = "pdm install"
python-build = ">=1.2.1,<2"
setuptools = "*"
setuptools_scm = "*"
git = "*" # for scm-versioning with setuptools_scm

[tool.pixi.feature.build.tasks]
build-wheel = "python -m build --no-isolation --wheel ."
Expand Down

0 comments on commit a213871

Please sign in to comment.