2

I am trying to package my tool with Hatch and want to include some extra files found in /docs in the below directory tree:

this_project
│   .gitattributes
│   .gitignore
│   LICENSE
│   MANIFEST.in
│   pyproject.toml
│   README.md
│
├───docs
│       default.primers
│
└───ribdif
      __init__.py
       __main__.py

I am installing the tool with pip install git+https://github.com/Rob-murphys/ribdif.git but am only getting the expected file inside ribdif despite specifying in the pyproject.toml per https://hatch.pypa.io/latest/config/build/#file-selection:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "ribdif"
version = "1.1.2"
authors = [
  { name="Robert Murphy", email="Robert.murphy@bio.ku.dk" },
]
description = "A program to analyse and correct for  the usefulness of amplicon sequences"
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
    "Programming Language :: Python :: 3.11",
    "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
    "Operating System :: OS Independent",
]

[tool.hatch.build]
include = [
  "ribdif/*.py",
  "/docs",
]

[project.scripts]
ribdif = "ribdif.__main__:main"
Lamma
  • 895
  • 1
  • 12
  • 26

1 Answers1

0

When installing from github using pip I believe I am populating my site-packages with the content of the produced wheel and given that I need the extra files at run time I need to add to the wheel and not the source distribution.

[tool.hatch.build.targets.wheel.force-include]
"ribdif" = "ribdif"
"docs/default.primers" = "ribdif/default.primers"

This directs the default.primers file to be in the ribdif/ directory ofthe site-packages and thus available at run time!

Lamma
  • 895
  • 1
  • 12
  • 26