Closed shaunc closed 2 years ago
Minimal example of problem I'm having:
To reproduce, clone into same directory, then in "child" run:
% python -m venv env/child
% source env/child/bin/activate
% pip install --upgrade pip
% pip install -r src/requirements.txt # installs parent via -e ../parent
% kedro info
...
no plugins installed
Aha -- the development version of kedro was installed by conda, and unfortunately that was taking precedence in the path. Sorry!
@shaunc Good to see you resolved it, but just a comment on setup.py vs. pyproject.toml...
I definitely sympathise with your preference here, and actually there's no reason you can't use pyproject.toml (or setup.cfg or whatever other system there may be) in favour of setup.py when developing a plugin. Here's a simple toy example where I changed from setup.py to pyproject.toml, and all seems to work ok. Our documentation is definitely not clear on this since it only talks about the setup.py configuration. A plugin is just a Python package, so anything which enables you to define entry points in the right way should work fine with kedro.
Note from pip -- problem w/ "editable" install using poetry:
ERROR: Project file:///Users/shauncutts/src/factfiber.ai/mlops/kedro-dvc has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660. (child_env) (base) sh
However: https://github.com/python-poetry/poetry/issues/34#issuecomment-997519115
Suggests:
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core @ git+https://github.com/python-poetry/poetry-core.git@master"]
which works! :)
Oops! ... maybe I spoke too soon. It installs but don't see the hook. Maybe I'm doing something wrong... on the poetry side its not yet clear that this should work:
... but if it works for you then they have entry-points supported somewhere, at least....
UPDATE -- another "good news" entry to the good news/bad news chain -- :) -- was able to get working in a dummy project. Maybe my main project has already collected some hairballs. Will report back when I figure it out. NB one thing to node is that editable install in this manner requires pip >=22 according to poetry people and my experience.
Ok -- have it worked out thanks to comment by layday.
I've created a script to install dev version of (currently dummy) kedro-dvc plugin within a temporary project. Seems to work for me, at least. Was able to get everything into pyproject.toml
using:
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core @ git+https://github.com/python-poetry/poetry-core.git@master"]
# NB poetry does not (yet?) support pep 621
[tool.poetry.plugins."kedro.project_commands"]
dvc = "kedro_dvc.plugin:dvc"
Very nice - I've just run the script and it also works for me 👍
Given what you wrote above I don't really understand why project.entry_points.kedro.project_commands
in pyproject.toml worked for me with pip install
at all 😅 Was this just a fortunate coincidence? Sorry for leading you astray there!
P.S. very interesting to see how you handle dev setup. This is something I've been thinking about a lot recently when I added gitpod configuration to the kedro repo. The configuration there includes a stage that does kedro new
with a starter to make a simple test project. On kedro-viz we have a larger demo project in the main branch of the repo itself which is used for testing stuff out (https://github.com/kedro-org/kedro-viz/blob/main/.gitpod.yml).
Very nice - I've just run the script and it also works for me 👍
Given what you wrote above I don't really understand why
project.entry_points.kedro.project_commands
in pyproject.toml worked for me withpip install
at all 😅 Was this just a fortunate coincidence? Sorry for leading you astray there!
Perhaps you had an ...egg-info/
left over from the setuptools build? That happened to me ... :)
vs dev environment -- thanks! ... hmm... hadn't heard about gitpod -- so thanks as well! I considered vscode containers ... but didn't get around to setting up -- at least not yet....
Description
I am trying to write a plugin for kedro -- see https://github.com/kedro-org/kedro/discussions/837#discussioncomment-2122783
I have written a stub to test plugin, and provided
setup.py
as:To test, in a .gitignored subdirectory, I have created a test project using
kedro new
. I install the standard requirements, then try to install my plugin via, which causes an error:Note, however, I can manually run the setup.py:
However, in this case, the plugin doesn't seem to register properly:
Your Environment
Include as many relevant details about the environment in which you experienced the bug:
pip show kedro
orkedro -V
): 0.17.6python -V
): 3.8.5Further remarks (feature request):
I wish you wouldn't use setuptools. I believe the entry point declarations could be put in
pyproject.toml
?