-
I'm building a Python package using pyproject.toml and hatch. The structure of the project is shown below. The package located at
The # fruit_reader.py
import pandas as pd
from pathlib import Path
def read_fruits():
"""
Read fruit data from CSV file.
"""
path = Path(__file__).parent / 'data/fruits.csv'
print(f'File path is \n{path}')
df = pd.read_csv(path)
print(f'Dataframe is \n{df}') # pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "mypackage"
version = "0.1"
authors = [
{ name="Example Author", email="[email protected]" },
]
description = "A small example package"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
] I tried to include the data files as shown below but this causes the whole package to not get installed. [tool.hatch.build]
include = [
"/src/data/*.csv",
] |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey! You should put |
Beta Was this translation helpful? Give feedback.
Hey! You should put
data
undersrc/mypackage