Skip to content

Rename secondary "tests" package in doc example#2122

Merged
kasteph merged 1 commit intopython-poetry:masterfrom
jtrakk:patch-1
Mar 29, 2020
Merged

Rename secondary "tests" package in doc example#2122
kasteph merged 1 commit intopython-poetry:masterfrom
jtrakk:patch-1

Conversation

@jtrakk
Copy link
Copy Markdown
Contributor

@jtrakk jtrakk commented Mar 3, 2020

If multiple distributions have tests as a top-level package, they'll conflict whenever both are installed. (Examples here and here). Two common alternative strategies are:

  1. not distributing tests (as here), or
  2. placing tests in a subdirectory of the main package, rather than adjacent (as here and here).

Either of these strategies will avoid this issue.

Users may fall into this trap because of the package documentation page, which gives an example:

packages = [
    { include = "my_package" },
    { include = "tests", format = "sdist" },
]

Having two top-level packages in a distribution is relatively unusual, but does have some use cases. Using "tests" as a top-level package name in the example is likely to lead to conflicts, however. The alternate package in the documentation example could have a unique name like "my_other_package", which would reduce the likelihood of this kind of overlap.

If multiple distributions have `tests` as a top-level package, they'll conflict whenever both are installed. (Examples [here]((https://github.com/python-poetry/poetry/issues/1905) and [here](NixOS/nixpkgs#81482). Two common alternative strategies are:

1. not distributing tests (as [here](https://github.com/pypa/sampleproject)), or 
2. placing tests in a subdirectory of the main package, rather than adjacent (as [here](http://blog.habnab.it/blog/2013/07/21/python-packages-and-you/) and [here](http://as.ynchrono.us/2007/12/filesystem-structure-of-python-project_21.html)). Each of these strategies will avoid this issue. 

Users may fall into this trap because of the [package documentation](https://python-poetry.org/docs/pyproject/#packages) page, which gives an example:

```
packages = [
    { include = "my_package" },
    { include = "tests", format = "sdist" },
]
```

Having two top-level packages in a distribution is relatively unusual, but does have some use cases.  Using `"tests"` as a top-level package name in the example is likely to lead to conflicts, however. The alternate package in the documentation example could have a unique name like `"my_other_package"`, which would reduce the likelihood of this kind of overlap.
Copy link
Copy Markdown
Member

@kasteph kasteph left a comment

Choose a reason for hiding this comment

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

Thank you! 🤖

@kasteph kasteph merged commit 7555d6d into python-poetry:master Mar 29, 2020
@github-actions
Copy link
Copy Markdown

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

area/docs Documentation issues/improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants