Skip to content

Commit

Permalink
Do not install Celery by default, use extra [celery] instead (#172)
Browse files Browse the repository at this point in the history
* Set optional = true for celery package and limit "< v6.x.x"

* Added -E "celery" to tox environments

* Added -E "celery" to .readthedocs.yaml

* Added "#egg=pytest-celery[celery]" to the examples requirements.txt (expected to fail until changes are merged to main)

* Hotfix/Cleanup in src/pytest_celery/vendors/worker/Dockerfile

* Updated poetry.lock
  • Loading branch information
Nusnus authored Jan 22, 2024
1 parent 2f7517c commit b5e23ad
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
post_install:
- poetry install --with docs
- poetry install -E "celery" --with docs

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
3 changes: 1 addition & 2 deletions examples/django/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

sqlalchemy>=1.2.18
django>=2.2.1
pytest-django>=4.7.0
git+https://github.com/celery/pytest-celery.git
git+https://github.com/celery/pytest-celery.git#egg=pytest-celery[celery]
pytest-xdist>=3.5.0
2 changes: 1 addition & 1 deletion examples/myworker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest>=7.4.4
git+https://github.com/celery/pytest-celery.git
git+https://github.com/celery/pytest-celery.git#egg=pytest-celery[celery]
pytest-xdist>=3.5.0
2 changes: 1 addition & 1 deletion examples/rabbitmq_management/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest>=7.4.4
git+https://github.com/celery/pytest-celery.git
git+https://github.com/celery/pytest-celery.git#egg=pytest-celery[celery]
pytest-xdist>=3.5.0
2 changes: 1 addition & 1 deletion examples/range/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest>=7.4.4
git+https://github.com/celery/pytest-celery.git
git+https://github.com/celery/pytest-celery.git#egg=pytest-celery[celery]
pytest-xdist>=3.5.0
pytest-subtests>=0.11.0
37 changes: 20 additions & 17 deletions poetry.lock

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

8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ replace = ':Version: {new_version}'

[tool.poetry.dependencies]
python = ">= 3.8,<4.0"
celery = { version = "^5", extras = ["redis", "pymemcache"] }
celery = { version = "<6.0.0", extras = [
"redis",
"pymemcache",
], optional = true }
retry = "^0.9.2"
pytest-docker-tools = "^3.1.3"
docker = "^7.0.0"
psutil = "^5.9.7"
setuptools = "^69.0.3"

[tool.poetry.extras]
celery = ["celery"]

[tool.poetry.group.dev]

[tool.poetry.group.dev.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_celery/vendors/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade \
pip \
celery[redis,memcache,pymemcache]${WORKER_VERSION:+==$WORKER_VERSION} \
celery[redis,pymemcache]${WORKER_VERSION:+==$WORKER_VERSION} \
psutil

# The workdir must be /app
Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ setenv =
PYTHONUNBUFFERED = 1
PYTHONDONTWRITEBYTECODE = 1
commands_pre =
poetry install --with dev,test
poetry install -E "celery" --with dev,test
commands =
unit: poetry run pytest tests/unit/ --maxfail=3 {posargs}
integration: poetry run pytest tests/integration/ --exitfirst --dist=loadscope {posargs}
Expand Down Expand Up @@ -70,7 +70,7 @@ commands =
[testenv:mypy]
description = Run mypy using {basepython}
commands_pre =
poetry install --only dev
poetry install -E "celery" --only dev
poetry run mypy --install-types --non-interactive
commands =
poetry run mypy --config-file pyproject.toml
Expand All @@ -79,7 +79,7 @@ commands =
description = Run code+doc lint using {basepython}
allowlist_externals = poetry, make
commands_pre =
poetry install --with dev,docs
poetry install -E "celery" --with dev,docs
commands =
poetry run pre-commit {posargs:run --all-files --show-diff-on-failure}
make -C ./docs apicheck
Expand All @@ -90,7 +90,7 @@ commands =
description = Clean up build and test artifacts using {basepython}
allowlist_externals = poetry, pytest, bash, find, make
commands_pre =
poetry install --only dev
poetry install -E "celery" --only dev
commands =
poetry run cleanpy .
make -C ./docs clean
Expand All @@ -103,22 +103,22 @@ commands =
description = Build docs using {basepython}
allowlist_externals = poetry, make
commands_pre =
poetry install --with docs
poetry install -E "celery" --with docs
commands =
make -C ./docs html

[testenv:docs-livehtml]
description = Build docs using {basepython} and serve in http://0.0.0.0:7010
allowlist_externals = poetry, make
commands_pre =
poetry install --with docs
poetry install -E "celery" --with docs
commands =
make -C ./docs livehtml

[testenv:docs-apidoc]
description = Regenerate API Reference doc section using {basepython}
allowlist_externals = poetry, make
commands_pre =
poetry install --with docs
poetry install -E "celery" --with docs
commands =
make -C ./docs apidoc

0 comments on commit b5e23ad

Please sign in to comment.