-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to update requirements.txt locally
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ | ||
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ | ||
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ | ||
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ | ||
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ | ||
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ | ||
// ┃ Copyright (c) 2017, the Perspective Authors. ┃ | ||
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ | ||
// ┃ This file is part of the Perspective library, distributed under the terms ┃ | ||
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ | ||
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ | ||
|
||
/// Use this script to update the `requirements-*.txt` files in the | ||
/// `python/perspective` directory. This only needs to be done when the actual | ||
/// dependencies _or_ supported Python versions change - to update these deps | ||
/// otherwise is to invite the wrath of the CI gods. | ||
|
||
import sh from "./sh.mjs"; | ||
import * as fs from "fs"; | ||
|
||
const VERSIONS = [ | ||
// "3.7", | ||
"3.8", | ||
"3.9", | ||
"3.10", | ||
"3.11", | ||
]; | ||
|
||
for (const version of VERSIONS) { | ||
sh` | ||
pip3 install "python/perspective[dev]" | ||
--dry-run | ||
--report=report.json | ||
--python-version=${version} | ||
--only-binary=:all: | ||
--platform=manylinux_2_12_x86_64 | ||
--platform=manylinux_2_17_x86_64 | ||
--ignore-installed | ||
--target=. | ||
`.runSync(); | ||
|
||
const data = JSON.parse(fs.readFileSync("report.json")); | ||
let output = ""; | ||
for (const { | ||
metadata: { version, name }, | ||
} of data.install) { | ||
output += `${name}==${version}\n`; | ||
} | ||
|
||
fs.writeFileSync( | ||
`python/perspective/requirements-${version.replace(".", "")}.txt`, | ||
output | ||
); | ||
} | ||
|
||
fs.rmSync("report.json"); |