Skip to content
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

Install: option to skip current project package #757

Conversation

mselee
Copy link

@mselee mselee commented Dec 21, 2018

Add --no-root option to the install command to avoid the installation of the project's root package.

Fixes #730.

Pull Request Check List

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

  • Added tests for changed code.
  • Updated documentation for changed code.

Note: If your Pull Request introduces a new feature or changes the current behavior, it should be based
on the develop branch. If it's a bug fix or only a documentation update, it should be based on the master branch.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Copy link
Contributor

@brycedrennan brycedrennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seleem1337 Thanks for addressing this issue. Its a blocking my workplace from requiring use of poetry in a large corporate environment.

I just tried out this fix and it didn't seem to work. I got this error:
{path to my package} does not contain any element

I made the following change and then it worked as expected:

        return_code = installer.run()

        if return_code != 0:
            return return_code

        if self.option("no-root"):
            return 0

        try:
            builder = SdistBuilder(self.poetry, NullEnv(), NullIO())
        except ModuleOrPackageNotFound:
            # This is likely due to the fact that the project is an application
            # not following the structure expected by Poetry
            # If this is a true error it will be picked up later by build anyway.
            return 0

        self.line(
            "  - Installing <info>{}</info> (<comment>{}</comment>)".format(
                self.poetry.package.pretty_name, self.poetry.package.pretty_version
            )
        )

        if self.option("dry-run"):
            return 0

poetry/installation/installer.py Outdated Show resolved Hide resolved
poetry/console/commands/install.py Outdated Show resolved Hide resolved
@mselee mselee force-pushed the feature/issue-730-no-root-package-option branch from ea621bb to 30a8cb1 Compare March 7, 2019 10:14
@mselee mselee force-pushed the feature/issue-730-no-root-package-option branch from 30a8cb1 to 1ff6a95 Compare March 7, 2019 10:16
@mselee
Copy link
Author

mselee commented Mar 7, 2019

@brycedrennan @sdispater thanks for the feedback! I've applied the changes.

@sdispater sdispater merged commit 37ec144 into python-poetry:develop Mar 7, 2019
@sdispater
Copy link
Member

Thanks!

Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants