Skip to content

build: add pyproject.toml for pip/uv installable packaging#54

Open
zhangxin81 wants to merge 1 commit into
deepseek-ai:mainfrom
zhangxin81:feat/add-pyproject-packaging
Open

build: add pyproject.toml for pip/uv installable packaging#54
zhangxin81 wants to merge 1 commit into
deepseek-ai:mainfrom
zhangxin81:feat/add-pyproject-packaging

Conversation

@zhangxin81

Copy link
Copy Markdown

What

Add a PEP 621 pyproject.toml with a setuptools build backend so DeepSpec is installable as a package.

Today DeepSpec ships as a plain repo with only requirements.txt, so there is no build backend: pip install ., building a wheel, or depending on DeepSpec as a git dependency from another project all fail (nothing to build). This adds standard packaging while keeping the repo layout unchanged.

Details

  • Build backend: setuptools>=77.0.0 / setuptools.build_meta.
  • Package scope: deepspec* only. scripts/, config/, tests/, and eval_datasets/ remain repo tooling/data and are not shipped in the wheel.
  • Dependencies: mirror requirements.txt so pip install . and pip install -r requirements.txt stay in lockstep. Data-preparation-only deps (datasets, openai) move to an optional [data] extra since they are not needed for training/eval imports.
  • requires-python = ">=3.11": matches the numpy==2.4.4 floor.
  • As before, install a torch build matching your CUDA/accelerator if the default wheel is not appropriate.

Testing

Built a wheel locally with uv build --wheel:

  • Wheel builds successfully.
  • All library subpackages are included (deepspec/modeling/{dspark,eagle3}/**, deepspec/data, deepspec/utils/**, etc.).
  • scripts/, config/, tests/, eval_datasets/ are correctly excluded.
  • METADATA reports the expected name/version, Requires-Python, and pinned Requires-Dist.

Why

Enables downstream projects to depend on DeepSpec via a standard install (e.g. a git dependency in another project's pyproject.toml) instead of manual sys.path / PYTHONPATH wiring.

DeepSpec shipped as a plain repo with only requirements.txt, so it could
not be installed as a package (pip install ., or a git dependency from
another project). Add a PEP 621 pyproject.toml with a setuptools backend
so the deepspec library is importable after a standard install.

- Packages the deepspec* library only; scripts/, config/, tests/, and
  eval_datasets/ stay as repo tooling and are not shipped.
- Runtime dependencies mirror requirements.txt; data-preparation-only
  deps (datasets, openai) move to an optional [data] extra.
- requires-python >=3.11 (matches the numpy==2.4.4 floor).
zhangxin81 added a commit to zhangxin81/VeOmni that referenced this pull request Jul 6, 2026
Install DeepSpec as a pinned git dependency instead of a sys.path-only
bootstrap, and address reviewer comments on the draft trainer.

- Add an opt-in `deepspec` extra: git source pinned by commit in
  [tool.uv.sources] (the commit adds DeepSpec's pyproject.toml, proposed
  upstream in deepseek-ai/DeepSpec#54; repoint to upstream once merged) and
  an empty [[tool.uv.dependency-metadata]] so DeepSpec's own torch/
  transformers pins do not conflict with VeOmni's stack. DEEPSPEC_PATH /
  sibling checkout stays as a dev fallback.
- draft_trainer: report the true global-token loss (mean all-reduce over the
  fsdp group inverts DeepSpec's world-size backward scaling) instead of
  DeepSpec's per-rank mean-of-means metric.
- draft_trainer: freeze embed_tokens / lm_head by substring match so nested
  HF param names (model.embed_tokens.weight) are matched in the fallback path.
- Update integration docs, uv.md, and integration docstrings to describe the
  deepspec extra as the primary install path.
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.

1 participant