4

I am using setuptools with pyproject.toml and setuptools_scm. I think setuptools is not working correctly, but functionality has changed so much and the documentation doesn't seem to explain the problem I'm having, so I'm kind of lost here. I want to be able to run pip install <path to my package root> and have the my bash script copied into the installed path, here .local/lib/pythonversion/site-packages/duck/. The duck package structure is:

duck/
    pyproject.toml
    README.md
    setup.cfg
    setup.py
    duck/
        __init__.py
        duck (shell script)
        quack/
            ...
        flap/
            ...

From the duck root directory, I run pip install . and I see from the duck.egg-info that setuptools_scm is listing my "duck" bash script.

After the install completes, the duck script is not in .local/lib/python3.8/duck/.

I've tried explicitly listing the file using MANIFEST.in but that has no effect, apparently.

My pyproject.toml is very simple:

[build-system]
requires   = ["setuptools>=45", "setuptools_scm[toml]>6.2"]
build-backend = "setuptools.build_meta"
[tools.setuptools_scm]

My setup.cfg is also simple:

[metadata]
name = duck
description = A very quacky package

[options]
install_requires=
    pandas>=1.4
    ...

Finally, I do have setup.py so that I can specify setuptools:

from setuptools import setup
setup(use_scm_version=True)

What I have tried

  • Created a MANIFEST.in and explicitly included duck the bash script
  • Using [package_data] directive to specify the files
  • Using [data_files] directive
  • I also thought that using [project.scripts] would be a good idea, but that is specifically designed for Python entrypoints.

According to the documentation it suffices to specify [tool.setuptools] in your pyproject.toml when you're using a VCS, and (I quote) [...] will be automatically installed with your package. I know the context is a little bit vague, but what I infer from reading the documentation is that my .toml file is sufficient to install all these git tracked files.

I can start from scratch and put all this functionality into my setup.py, but this seems (to me) like a very simple use case that setuptools not getting right.

I am hoping there is something small and/or obvious that I am either doing wrong or can change to fix this. Failing that, I will write the full setup.py.

gnat79
  • 57
  • 4
  • 1
    This question would be improved if you provided exactly what you tried. – juanpa.arrivillaga Oct 19 '22 at 17:55
  • 1
    Have you tried any of the solutions in [this related question](https://stackoverflow.com/q/3596979/9374673)? Is there something different about your use case that's not covered in that one? – Mihai Chelaru Oct 19 '22 at 18:00
  • 1
    @MihaiChelaru Yes, I'm using pyproject.toml -- which I may have to switch over to just using setup.py – gnat79 Oct 19 '22 at 18:52

0 Answers0