π₯
Objective
my_project/
βββ src/
β βββ my_package/
β βββ __init__.py
β βββ main.py
βββ resources/ <-- Or place inside your package
β βββ data.json
βββ config.yaml <-- Or config.env
βββ pyproject.toml <-- Dependencies & Metadata
Using the pathlib library, we would do like so :
from pathlib import Path
# Points to the directory of the current file
current_dir = Path(__file__).parent
asset_path = current_dir.parent / "resources" / "data.json"
with open(asset_path, "r") as f:
print(f.read())
π Todo List
Granular steps to finish the task
- Repository structured like an actual python package
- assets / resources restructured in a way they are part of the source
- removal of shell script and ducquehome variable
π§ͺ Tests
When the package is easily installable and the resources are located correctly.
π₯ Objective
Using the
pathliblibrary, we would do like so :π Todo List
Granular steps to finish the task
π§ͺ Tests
When the package is easily installable and the resources are located correctly.