Skip to content

Prepare package for PyPI: fix versioning, lazy imports, Python constraint#3

Merged
codeSamuraii merged 2 commits into
mainfrom
copilot/prepare-package-for-pypi
Apr 13, 2026
Merged

Prepare package for PyPI: fix versioning, lazy imports, Python constraint#3
codeSamuraii merged 2 commits into
mainfrom
copilot/prepare-package-for-pypi

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown

Package wasn't publishable to PyPI: version was hardcoded in two places, import pyfuse eagerly pulled in optional backend deps (redis, aio-pika), and requires-python >=3.13 was unnecessarily restrictive given no 3.13-specific features are used.

Versioning — single source of truth

  • pyproject.toml is authoritative; pyfuse/core/version.py reads it at runtime via importlib.metadata, falls back to _FALLBACK_VERSION for editable/source installs
  • Exposes pyfuse.__version__ in __init__.py and __all__

Lazy backend imports

  • RedisBackend import in remote.py moved inside _create_backend(), matching existing pattern for LocalBackend/RabbitMQBackend
  • backends/__init__.py only re-exports the abstract Backend base
# Before: top-level import — fails without redis installed
from pyfuse.worker.backends.redis import RedisBackend

# After: lazy, inside _create_backend()
if scheme in ("redis", "rediss"):
    from pyfuse.worker.backends.redis import RedisBackend
    return RedisBackend(url, **kwargs)

Python version constraint

  • Lowered requires-python from >=3.13 to >=3.10 (sys.stdlib_module_names is the floor)
  • Updated classifiers and README badge

Isolated installation tests (tests/test_packaging.py)

  • Version consistency: fallback matches pyproject.toml, __version__ is exported
  • Installs in a fresh venv without extras, verifies import + core API + CLI entrypoint

Copilot AI and others added 2 commits April 13, 2026 18:23
- Single source of truth for version: pyproject.toml is authoritative,
  importlib.metadata reads it at runtime, _FALLBACK_VERSION as fallback
- Expose __version__ in pyfuse.__init__
- Make RedisBackend import lazy in remote.py (consistent with other backends)
- Remove eager backend imports from backends/__init__.py
- Lower requires-python from >=3.13 to >=3.10 (no 3.13-specific features)
- Add test_packaging.py: version consistency + isolated venv install tests
- Update README badge and classifiers

Agent-Logs-Url: https://github.com/codeSamuraii/pyfuse/sessions/92c23804-a854-46b3-978f-2599f056b232

Co-authored-by: codeSamuraii <17270548+codeSamuraii@users.noreply.github.com>
…r script

- Catch PackageNotFoundError instead of bare Exception in version.py
- Extract _venv_python() and _create_venv_and_install() helpers in test
- Use multi-line script string instead of semicolons

Agent-Logs-Url: https://github.com/codeSamuraii/pyfuse/sessions/92c23804-a854-46b3-978f-2599f056b232

Co-authored-by: codeSamuraii <17270548+codeSamuraii@users.noreply.github.com>
@codeSamuraii codeSamuraii marked this pull request as ready for review April 13, 2026 19:13
@codeSamuraii codeSamuraii merged commit 4a32d7f into main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants