Skip to content

fix: Remove outdated Pipenv requirements flag #780

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

Merged
merged 5 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
strategy:
matrix:
sls-version: [2, 3]
pipenv-version: ['2022.8.5', '2022.8.13']
pipenv-version: ['2022.8.5', '2022.8.13', '2023.7.4', '2023.7.9']
# pipenv 2202.8.13 marks deprecation of pipenv lock --requirements
# https://github.com/pypa/pipenv/blob/30067b458bd7a429f242736b7fde40c9bd4d4f14/CHANGELOG.rst#2022813-2022-08-13
# pipenv 2023.7.9 marks deprecation of pipenv lock --keep-outdated
# https://github.com/pypa/pipenv/blob/30067b458bd7a429f242736b7fde40c9bd4d4f14/CHANGELOG.rst#202379-2023-07-09
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -95,7 +99,7 @@ jobs:
strategy:
matrix:
sls-version: [2, 3]
pipenv-version: ['2022.8.5', '2022.8.13']
pipenv-version: ['2022.8.5', '2022.8.13', '2023.7.4', '2023.7.9']
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -149,7 +153,7 @@ jobs:
strategy:
matrix:
sls-version: [2, 3]
pipenv-version: ['2022.8.5', '2022.8.13']
pipenv-version: ['2022.8.5', '2022.8.13', '2023.7.4', '2023.7.9']
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
22 changes: 16 additions & 6 deletions lib/pipenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,36 @@ async function pipfileToRequirements() {

if (semver.gt(pipenvVersion, LEGACY_PIPENV_VERSION)) {
// Using new pipenv syntax ( >= 2022.8.13)
// Generate requirements from existing lock file.
// See: https://pipenv.pypa.io/en/latest/advanced/#generating-a-requirements-txt
try {
await spawn('pipenv', ['lock', '--keep-outdated'], {
res = await spawn('pipenv', ['requirements'], {
cwd: this.servicePath,
});
} catch (e) {
const stderrBufferContent =
(e.stderrBuffer && e.stderrBuffer.toString()) || '';
if (stderrBufferContent.includes('must exist to use')) {
if (stderrBufferContent.includes('FileNotFoundError')) {
// No previous Pipfile.lock, we will try to generate it here
if (this.log) {
this.log.warning(
'No Pipfile.lock found! Review https://pipenv.pypa.io/en/latest/pipfile/ for recommendations.'
);
} else {
this.serverless.cli.log(
'WARNING: No Pipfile.lock found! Review https://pipenv.pypa.io/en/latest/pipfile/ for recommendations.'
);
}
await spawn('pipenv', ['lock'], {
cwd: this.servicePath,
});
res = await spawn('pipenv', ['requirements'], {
cwd: this.servicePath,
});
} else {
throw e;
}
}

res = await spawn('pipenv', ['requirements'], {
cwd: this.servicePath,
});
} else {
// Falling back to legacy pipenv syntax
res = await spawn(
Expand Down
2 changes: 1 addition & 1 deletion tests/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/individually/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.1.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/non_build_pyproject/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/non_poetry_pyproject/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/pipenv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/poetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}
2 changes: 1 addition & 1 deletion tests/poetry_individually/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"serverless-python-requirements": "file:serverless-python-requirements-5.3.1.tgz"
"serverless-python-requirements": "file:serverless-python-requirements-6.0.0.tgz"
}
}