Im unsure about the new doc on packaging with hatch and wonder if someone worked out how to define a script in a pip installable package. So in short I need to be able to direct python -m build
to make a package with open_foo_bar.py
as in the example, install into the (virtual env)/bin
dir.
my package looks like this (after a python -m build step that generated dist dir)
pypi_package/
├── bin
│ └── open_foo_bar.py
├── dist
│ ├── foo-0.1.0-py3-none-any.whl
│ └── foo-0.1.0.tar.gz
├── pyproject.toml
├── README.md
└── test_pkg
├── foolib.py
└── __init__.py
Im trying to get bin/open_foo_bar.py
installed into the $(virtual env)/bin
instead it installs it into the site-packages/bin
./lib/python3.10/site-packages/bin/open_foo_bar.py
myproject.toml is
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "FOO"
version = "0.1.0"
authors = [
{ name="Mr Foo", email="foo@bar.com" },
]
description = "a Foo bar without drinks"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
'requests'
]
[project.urls]
"Homepage" = "http://footopia.s/howto_foo"
This used to be easy by defining the scripts
section in setup.py
setuptools.setup(
...
scripts ['bin/script1'],
...
)