Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Fixes #1: Add option to build with poetry#2

Merged
arthaud merged 2 commits intofacebook:mainfrom
abishekvashok:main
Mar 27, 2023
Merged

Fixes #1: Add option to build with poetry#2
arthaud merged 2 commits intofacebook:mainfrom
abishekvashok:main

Conversation

@abishekvashok
Copy link
Copy Markdown
Contributor

@abishekvashok abishekvashok commented Mar 15, 2023

Add option to install dependencies with poetry in the action.
Signed-off-by: Abishek V Ashok abishekvashok@gmail.com

Poetry docs:
https://python-poetry.org/docs/#installing-with-pipx
https://python-poetry.org/docs/basic-usage/#installing-dependencies-only

Why --no-root: poetry installs projects as editable by default with --no-root we get the same behavior as pip install.

Fixes #1

Add option to install dependencies with poetry in the action.

Signed-off-by: Abishek V Ashok <abishekvashok@gmail.com>
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 15, 2023
Copy link
Copy Markdown

@arthaud arthaud left a comment

Choose a reason for hiding this comment

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

Q: how does poetry infer dependencies? It must use requirements.txt right? What's the benefit of poetry then?

requirements-path:
description: Path to requirements file, relative to `repo-directory`, to look for dependencies. Default will look for requirements.txt in the root of repo-directory
required: true
required: false
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does this do? I would assume we "require" requirements.txt

Copy link
Copy Markdown
Contributor Author

@abishekvashok abishekvashok Mar 16, 2023

Choose a reason for hiding this comment

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

@arthaud Poetry uses dependencies in pyproject.toml, it also supports .lock files like yarn and npm. So, we don't hav eto have a requirements.txt file.

We could have a check for poetry before poetry install though, like something we do for the requirements file (check if the file exists, in this case pyproject.toml)

@arthaud
Copy link
Copy Markdown

arthaud commented Mar 24, 2023

It looks like there are CI errors, could you look into those?

The condition for poetry used to evaluate to true always.
Fix this by evaluating against `true`.

Signed-off-by: Abishek V Ashok <abishekvashok@gmail.com>
@abishekvashok
Copy link
Copy Markdown
Contributor Author

abishekvashok commented Mar 24, 2023

@arthaud I think it is fixed now. Sorry for messing up earlier. You might want to re-approve for tests.

Also consider, removing needing of approval for workflows - I don't think we are anywhere near for Github actions in this repo :)

@arthaud arthaud merged commit 1987eb7 into facebook:main Mar 27, 2023
@arthaud
Copy link
Copy Markdown

arthaud commented Mar 27, 2023

Well, it looks like there are failures on master now, could you look?
https://github.com/facebook/pysa-action/actions/runs/4534111680/jobs/7987854828

@abishekvashok
Copy link
Copy Markdown
Contributor Author

abishekvashok commented Mar 28, 2023

@arthaud sure :)
It seems unrelated to this changes.

Do we have past logs stored elsewhere? The past github action logs have expired.

I see the primary cause being pysa unable to detect issues as we aren't including the modules in the search path. The action that fails detects 0 issues while the one succeeding has found 8. Thus sapp creates an empty json file which is not happily accepted by the github sariff parser. The only change between the actions is that one uses .pyre_configuration and the other doesn't. I believe adding LD_LIBRARY_PATH to search_path will fix this (make pysa able to find the issues.) I will also try to make a pr for sapp to atleast output an empty file confronting to the sariff specs if there are no vulnerabilities :)

Also for the logs, consider enabling monthly run of the github workflows in this repository. The expiration time for logs seem to be 90 days (https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts), so we can have at least 2 logs for each workflow available at any time.

@abishekvashok
Copy link
Copy Markdown
Contributor Author

abishekvashok commented Mar 28, 2023

@arthaud

So took a bit of time to dig into this. Including every module in the path was not the solution but that the submodule is too old (snapshot is from a commit in 2022, pysa and pyre-check have been both changed a lot since then)

I made a PR to fix this and stop relying on submodules/snapshots: #3
Also, for SAPP, to conform to SARIF: facebook/sapp#92

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for poetry

3 participants