-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip install -e . equivalent? #34
Comments
No, this is not possible right now. And I don't think I will add an equivalent since it always seemed like a hack to me. But I might be wrong. Why do you need |
I often depend on some local packages, for which I want to be able to change some code and not have to reinstall. |
I see. The thing is However, if you really want to to this, you can build your project |
Ah sorry, with local I mostly meant "developing local packages". I do believe |
Well, poetry can help you develop local packages by orchestrating your dependencies, sure. But it is not meant to support the use case of having only local packages that depend on each other since this is not the best practice that poetry tries to endorse. However, if you are willing to make a Pull Request, I would gladly take a look at it. |
I might be off the mark here, but in my experience, I usually use |
I don't see why you would need In poetry that would be: poetry install # install your dependencies
poetry run pytest tests/ |
I'm not sure, but when you share a module in git, with other dev members, it's nice when it is updated automatically on pull. Or is this automatically managed in pycharm or something? I use emacs without virtualenvs but just simply different python versions. |
In Pycharm you set the environment by choosing a python interpreter in your directory tree. Packages are discovered from that AFAIK. |
I guess this is a bit of a style question, but I like to build a wheel for local packages and use pip to install them into my venv. Is that the workflow that is intended by |
@winni2k Not at the moment, no. For now, poetry assumes each dependency is located in a remote repository (PyPI or a private one) or is a VCS dependency, and does not support local packages. That might change in the future, however but I can't give you an ETA. I am trying first to support the most common use cases, like installing from PyPI before diving into more specific workflow, especially if they are not the recommended way of managing packages. |
It now also does not allow me to use it in the interactive interpreter :/ I tried using Until this becomes important, I wish there'd be a nice hack. I'm wondering though how do you develop - how do you avoid having to constantly reinstall? |
@kootenpv I just tested and copying the I don't know how you develop, but I never need |
Ugh, that is not developing, that is installing a finished package. These are roughly equivalent, in your src dir:
It's called "installing a package in development mode". They are the starting point of beginning development. If you are not familiar with that, then I honestly do not understand how you do development. I know two ways of doing development without it:
Are you recommending this? (I hope not) |
No, I don't modify So, if I develop a library (or an application for that matter) I put myself in my project directory. At this point I have access to my module: I can import it in my tests to test it. You can test this yourself: clone the If you need it in another project, and that is why you install it in develop mode, the you have dependencies between project and in this case I recommend to use a private index and release preversions or installing from git repository and updating when needed. |
There are many communities of Python users, using different categories of development tools. Depending on practices (e.g. code in |
Another use case is when you’re trying to fix something in a library used by your project. From your project’s virtualenv, you run |
@merwok I understand your point, but most of the time you don't need it, in my opinion. Regarding you last example, this will be supported in the next feature release since it will add the ability to install from a directory. I know that there is a lot of different workflows out there, but I am not saying it will never make it into |
@sdispater Thanks for your way of developing (private index / from git), I wasn't aware of another way. I can agree that under some conditions it is more proper and might lead to fewer bugs! In my case, I do a lot of data science and "live" in Interactive python. It's very convenient when I can just do I understand you are hesitant from your perspective as it does not seem like a really clean use case, and it looks like the solution would have to be a bit hacky? Still, I hope you could guide us and be accepting of a solution that might help a few (and not bother others)! Currently the only way I see is something like:
Does this sound like the best way? |
I'll chime in and say I also use
|
@kootenpv Don't get me wrong, I can understand why you would use And, like I said, directory dependencies will be introduced in the next feature release so, with them, you will be able to reproduce this behavior. |
Hi! Could you please clarify how you run tests with pytest without installing poetry in the virtualenv? I can't import my package from pytest tests because it's not installed and resides one level higher than the tests. It seems like poetry has the same source layout, but for some reason the imports work (although the tests fail). Am I missing something? UPD: Even the pytest docs say that you can only run tests against an installed version of your package under this layout: https://docs.pytest.org/en/latest/goodpractices.html#tests-outside-application-code |
Sorted this one out. Should've put an empty |
What do you think about some option to generate the |
Is it related to #47 ? If i summarize it, the need is that a poetry managed project should be installable as editable. e.g. i want to debug that library used by my project, i git clone it and poetry install -e the path ? |
Or maybe the goal is just to have project console scripts installed in virtualenv ? |
@bersace If you want to test you console scripts, it's possible via the Also, I understand the use case of However, I do not think Now, that being said, if someone can give me a compelling use case where it's necessary, I will gladly change my view on the subject. |
I think I get what you mean: you want to enable the option for a package (A) to list a development version of another package (B). I perhaps see a problem though. I believe you're saying you could list B as a requirement in A in the new version by listing Isn't the problem then that if both are |
@kootenpv Exactly. I think it would take the form: [tool.poetry.dependencies]
dependency = { "path" = "relative/path/to/folder/" } And with the equivalent of [tool.poetry.dependencies]
dependency = { "path" = "relative/path/to/folder/", develop = true } Regarding the issue when the dependency is also a |
By itself, this does not update the lock file nor the |
@adam-grant-hendry Why do you want to change Usually, "installing a third-party package in development mode", it's because you're working on that third party package locally. You shouldn't be commiting local paths to In an ideal world, there would be a local version of |
@NeilGirdhar To manage dependencies. The package, though development, is required by the project. Users must be able to depend on it, but not accidentally download the actual third-party package. Local paths are necessary since, if you see from previous posts, only I appreciate your and @dimaqq opinions, but I do not agree they are solutions nor the best existing solution. |
You keep your third-part dependency in
Yes, I know about this feature. The problem with this solution is you must be very careful not to accidentally commit If I'm still not understanding you, could you flesh out the workflow you're trying to accomplish? |
@NeilGirdhar I can flesh out my workflow. Is there a place we can take this offline? This issue post is getting long and I don't want to distract from the main issue. |
@adam-grant-hendry I think the best thing is to start a new issue or discussion on poetry so that interested people can follow along? |
@NeilGirdhar I'm fine with that. Let's continue on the |
@adam-grant-hendry I'm not sure. |
@NeilGirdhar I've created a new |
@NeilGirdhar There is a reason why I said what I am saying is "in simple terms" |
There is a difference: Adding commands to poetry means adding to the front end, i.e., things you do on the command line The reason that the backend has to change is that you need to be able to install a poetry project in editable mode in an ordinary (non-poetry) virtual environment. The front-end won't help you there. |
Another possible reason to be using a setup.py is when handling with system drivers. I was working with a python project that needed control of the I2C-bus to communicate (i.e. I set everything up with adding my own user to the correct group ( I didn't spend a lot of time on it as I found the workaround in here regarding moving the setup.py from the tarball and installing my package as editable install via pip to work fine. Might even be there is already some workaround in Poetry? If that is not the case, this might not be a reason for making changes. It is however a possible solution if you are working closer with system drivers and are having issues with permissions. |
@golgor Are you looking for help? If so, I'm happy to help where I can on a Discussion. Let me know. You could provide some more info about your |
@adam-grant-hendry As mentioned I got it to work, but it might not be a good solution. I will write in the discussion, thanks for reaching out! Edit: I.e. this doesn't seem to be a problem for Poetry but rather some settings regarding the terminal setup of VS Code. I guess it doesn't make sense to write anything in the discussion then. I will look into this elsewhere. Thanks a lot though for reaching and offer help. |
utils: add missing comma in list of valid url schemes
Poetry-core implements PEP660 from version 1.0.8. This patch bumps poetry-core version in build-system section for enable editabple installation via pip ('pip install -e .'). For more info see: - python-poetry/poetry#34 (comment) - python-poetry/poetry#5056 - python-poetry/poetry-core#257
Poetry-core implements PEP660 from version 1.0.8. This patch bumps poetry-core version in build-system section for enable editabple installation via pip ('pip install -e .'). For more info see: - python-poetry/poetry#34 (comment) - python-poetry/poetry#5056 - python-poetry/poetry-core#257
Poetry-core implements PEP660 from version 1.0.8. This patch bumps poetry-core version in build-system section for enable editabple installation via pip ('pip install -e .'). For more info see: - python-poetry/poetry#34 (comment) - python-poetry/poetry#5056 - python-poetry/poetry-core#257
Cross-language project here. Poetry troubles a lot. |
Hey all, this issue has been conflated and confused many times, and the issue it was meant to address has been long since solved. Most of the conversation relates to workflow issues, X-Y questions, or possible feature requests. For those stumbling onto this issue, check out @finswimmer's summary, which I will re-state here:
poetry-core also supports PEP 660 in the stable and beta versions, which allows for a Poetry-managed project to be installed in editable mode by any PEP 517 frontend (e.g. Poetry itself, pip, etc) that also supports PEP 660. If you want to discuss workflow issues/improvements, please head over to the Discussions tab or join the Discord server. If you're looking for a feature/enhancement that can streamline your workflow related to this, please do a good look to make sure there are no duplicate issues first (or ask on Discussions/Discord if you're not sure) -- then open an issue with your suggested feature/design. I'll be locking this issue as it's considered long-solved and further comments are just sending a ton of notifications and blurring the issues under discussion. |
An addendum from @mraleson on Discord:
In essence, what I wrote about above only applies to contemporary versions of poetry-core and pip. |
We cannot run
pip install -e .
because there is nosetup.py
. What would be the way to achieve this using poetry?The text was updated successfully, but these errors were encountered: