astrojuanlu / kedro-init

A simple CLI command that initialises a Kedro project from an existing Python package
BSD 2-Clause "Simplified" License
10 stars 1 forks source link

uvx kedro-init . raises "ValueError: More than one package found in project root" #6

Open tdhooghe opened 2 months ago

tdhooghe commented 2 months ago

When running uvx kedro-init . from within this root folder:

├── README.md
├── app.py
├── configs
├── connections.toml
├── insights.py
├── mock_data
├── notebooks
├── pyproject.toml
├── segmentation.py
├── src
└── uv.lock

I am facing

Traceback (most recent call last):
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/bin/kedro-init", line 10, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/kedro_init/cli.py", line 24, in cli
    for step_message in init_steps(project_root_path):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/kedro_init/init.py", line 12, in init_steps
    existing, build_config = get_or_create_build_config(project_root)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/Library/Caches/uv/archive-v0/jdZjIKlQL9ePZTQu_7Q0r/lib/python3.12/site-packages/kedro_init/build_config.py", line 77, in get_or_create_build_config
    raise ValueError("More than one package found in project root")
ValueError: More than one package found in project root
tdhooghe commented 2 months ago

i also get the error if i move everything to ./src, hence ./src being the only folder in there

uv version is 0.4.9

astrojuanlu commented 2 months ago

Thanks for reporting @tdhooghe !

Trying to reproduce from scratch, but it's difficult because I'm hitting #7.

When this first failed for you, what was tree . looking like?

astrojuanlu commented 2 months ago

I reproduced the issue with a tree like this:

❯ tree
.
├── README.md
├── pyproject.toml
├── src
│   ├── __init__.py
│   └── outputs.py
└── uv.lock