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

Default category to main for poetry #1211

Merged
merged 9 commits into from
Jun 14, 2023
Merged

Default category to main for poetry #1211

merged 9 commits into from
Jun 14, 2023

Conversation

jssblck
Copy link
Member

@jssblck jssblck commented Jun 1, 2023

Overview

Defaults poetry dependencies to the main category when categories are not present.
According to the poetry project, this is the default behavior in poetry: python-poetry/poetry#7637

Acceptance criteria

Poetry environments using newer versions of poetry no longer fail analysis.

Testing plan

I updated our automated test for the lock file. Additionally, I ran the following manual test.

I created a poetry project:

❯ poetry new test-parsing
❯ vim pyproject.toml # add pendulum = "^2.1" to dependencies
❯ poetry install
❯ fossa analyze -o
[ INFO] Analyzing poetry project at /home/jess/projects/scratch/test-parsing/
[ERROR] ----------
  An issue occurred

  >>> Relevant errors

    Error

      Error parsing file: /home/jess/projects/scratch/test-parsing/poetry.lock.

          tomland errors number: 4
          tomland decode error:  Key package.category is not found
          tomland decode error:  Key package.category is not found
          tomland decode error:  Key package.category is not found
          tomland decode error:  Key package.category is not found


      If you believe this to be a defect, please report a bug to FOSSA support at https://support.fossa.com, with a copy of:
        /home/jess/projects/scratch/test-parsing/poetry.lock

      Traceback:
        - Parsing TOML file '/home/jess/projects/scratch/test-parsing/poetry.lock'
        - Static analysis
        - Poetry
        - Project Analysis: PoetryProjectType

With changes:

❯ cabal run fossa -- analyze /home/jess/projects/scratch/test-parsing -o
Up to date
[ INFO] Analyzing poetry project at /home/jess/projects/scratch/test-parsing/
[ INFO]
[ INFO] Scan Summary
[ INFO] ------------
[ INFO] fossa-cli branch poetry-default-category (revision 886280d344ea compiled with ghc-9.0)
[ INFO] fossa endpoint server version: N/A
[ INFO]
[ INFO] 1 projects scanned;  0 skipped,  1 succeeded,  0 failed,  0 analysis warnings
[ INFO]
[ INFO] * poetry project in "/home/jess/projects/scratch/test-parsing/": succeeded
[ INFO] -
[ INFO]
[ INFO]   Some projects may not appear in the summary if they were filtered during discovery.
[ INFO]   You can run `fossa list-targets` to see all discoverable projects.
[ INFO]
[ INFO] You can pass `--debug` option to eagerly show all warning and failure messages.
[ INFO] You can also view analysis summary with warning and error messages at: "/tmp/fossa-analyze-scan-summary.txt"
[ INFO] ------------
{"projects":[{"graph":{"assocs":[[0,[1,2]],[1,[3]]],"deps":[{"locations":[],"name":"pendulum","tags":{},"type":"PipType","version":{"type":"EQUAL","value":"2.1.2"}},{"locations":[],"name":"python-dateutil","tags":{},"type":"PipType","version":{"type":"EQUAL","value":"2.8.2"}},{"locations":[],"name":"pytzdata","tags":{},"type":"PipType","version":{"type":"EQUAL","value":"2020.1"}},{"locations":[],"name":"six","tags":{},"type":"PipType","version":{"type":"EQUAL","value":"1.16.0"}}],"direct":[0]},"path":"/home/jess/projects/scratch/test-parsing/","type":"poetry"}],"sourceUnits":[{"AdditionalDependencyData":null,"Build":{"Artifact":"default","Dependencies":[{"imports":["pip+python-dateutil$2.8.2","pip+pytzdata$2020.1"],"locator":"pip+pendulum$2.1.2"},{"imports":["pip+six$1.16.0"],"locator":"pip+python-dateutil$2.8.2"},{"imports":[],"locator":"pip+pytzdata$2020.1"},{"imports":[],"locator":"pip+six$1.16.0"}],"Imports":["pip+pendulum$2.1.2"],"Succeeded":true},"Data":null,"Files":null,"GraphBreadth":"complete","Info":null,"Manifest":"/home/jess/projects/scratch/test-parsing/","Name":"/home/jess/projects/scratch/test-parsing/","OriginPaths":["poetry.lock"],"Type":"poetry"}]}

Risks

None, this is mirroring what Poetry does so it's what Poetry devs will expect to see.

References

https://fossa.zendesk.com/agent/tickets/6362

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an # Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).

@jssblck jssblck marked this pull request as ready for review June 12, 2023 23:59
@jssblck jssblck requested a review from a team as a code owner June 12, 2023 23:59
@jssblck jssblck requested a review from spatten June 12, 2023 23:59
Copy link
Contributor

@spatten spatten left a comment

Choose a reason for hiding this comment

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

I think you'll have to fix up the changelog because of the 3.8.1 release, but other than that this looks great

@jssblck jssblck enabled auto-merge (squash) June 13, 2023 23:35
@jssblck jssblck disabled auto-merge June 13, 2023 23:42
@jssblck jssblck enabled auto-merge (squash) June 13, 2023 23:44
@jssblck jssblck merged commit 41e5632 into master Jun 14, 2023
@jssblck jssblck deleted the poetry-default-category branch June 14, 2023 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants