Skip to content

add tox env for minimal required dependencies - #79

Merged
madpah merged 13 commits into
mainfrom
dependencies-lowest_testable-tox
Dec 9, 2021
Merged

madpah merged 13 commits into
mainfrom
dependencies-lowest_testable-tox

Conversation

@jkowalleck

@jkowalleck jkowalleck commented Nov 23, 2021 •

Copy link
Copy Markdown
Member

setup to test lowest possible requirements, while still being able to test the locked/pinned dev-dependencies

caused by #44

@jkowalleck
jkowalleck requested a review from a team as a code owner November 23, 2021 16:49
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch 2 times, most recently from d6a96c4 to d465de6 Compare November 23, 2021 17:01
@jkowalleck
jkowalleck marked this pull request as draft November 23, 2021 17:02
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch 2 times, most recently from 627924b to 0e21efd Compare November 23, 2021 17:11
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch from 0e21efd to 1534a02 Compare November 23, 2021 17:42
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch from 1534a02 to d318d3d Compare November 23, 2021 17:47
Signed-off-by: Jan Kowalleck <[email protected]>
@jkowalleck

Copy link
Copy Markdown
Member Author

@madpah some of the types are found to be errorneous in py36 - later versions are fine with them.
could you see if you can fix them?

jobs:
coding-standards:
name: Linting & Coding Standards
name: Linting & CodingStandards

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

shortened some labels, so they fit on the screen

key: ${{ runner.os }}-${{ env.PYTHON_VERISON_DEFAULT }}-poetry${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: poetry install
run: poetry install --no-root

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

dont need the package itself installed. it is installed in the tox later, if needed

@madpah

madpah commented Nov 26, 2021

Copy link
Copy Markdown
Collaborator

@jkowalleck - this is a cool solution to the problem 👍

Will take a look at the py36 type errors.

@madpah

madpah commented Nov 26, 2021

Copy link
Copy Markdown
Collaborator

@jkowalleck - got rid of a bunch of typing errors for Py 3.6, but the remainder seem to be being incorrectly reported in conditional imports (that only apply to Py >= 3.8).

Thoughts?

@jkowalleck

Copy link
Copy Markdown
Member Author

@jkowalleck - got rid of a bunch of typing errors for Py 3.6, but the remainder seem to be being incorrectly reported in conditional imports (that only apply to Py >= 3.8).

Thoughts?

great job.

will look into this later and see if there is any solution that works for us.

Signed-off-by: Jan Kowalleck <[email protected]>
Signed-off-by: Jan Kowalleck <[email protected]>
Signed-off-by: Jan Kowalleck <[email protected]>
@jkowalleck

jkowalleck commented Nov 26, 2021 •

Copy link
Copy Markdown
Member Author

@madpah i think i got the typing correct for EnvironmentParser._get_metadata_for_package()
could you check, please?

But now the type-checker finds a lot of issues - which i expect to be correct-positives (not false-positives).

This would mean that the implementation is wrong for python<3.8
Are there any unittests for EnvironmentParser.__init__()? do they run in py36 properly and actually cover the lines like

if 'Author' in i_metadata.keys()

and later?

i suggest to have the EnvironmentParser._get_metadata_for_package() implementation fixed to return the needed data as a Dict[str, str] or whatever internal method is used to get the data.
i suspect this was the intention of the method in the first place, and it got lost on some point.
see https://github.com/CycloneDX/cyclonedx-python-lib/pull/79/files#r757457995

@staticmethod
def _get_metadata_for_package(package_name: str) -> email.message.Message:
if sys.version_info >= (3, 8, 0):
return metadata(package_name)

@jkowalleck jkowalleck Nov 26, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this was the same for py38 and below.
i suspect some internal implementation got lost on the way ...
related to #79 (comment)

@jkowalleck

Copy link
Copy Markdown
Member Author

this comments purpose is to move this PR to top of list.

@madpah

madpah commented Dec 2, 2021

Copy link
Copy Markdown
Collaborator

Sure @jkowalleck - will check this now.

Signed-off-by: Paul Horton <[email protected]>
Signed-off-by: Paul Horton <[email protected]>
@madpah

madpah commented Dec 2, 2021

Copy link
Copy Markdown
Collaborator

@jkowalleck - looks like I've managed to resolve a bunch of the typing issues in EnvironmentParser for Py3.6, but one left:

context  [no-untyped-call]
    ...CycloneDX', name='cyclonedx-python-lib', version=meta_version('cyclone...
                                                        ^
Found 1 error in 1 file (checked 19 source files)
ERROR: InvocationError for command /home/runner/work/cyclonedx-python-lib/cyclonedx-python-lib/.tox/mypy-lowest/bin/poetry run mypy (exited with code 1)

Would you be happy for us to ignore this or even disable this rule?

Comment thread cyclonedx/model/bom.py Resolved
@jkowalleck

jkowalleck commented Dec 2, 2021 •

Copy link
Copy Markdown
Member Author

re: #79 (comment)

@madpah what if we would take everything that is not expected to raise an error , and move it out of the try/expect?
would make code clearer and probably get rid of the typing issue - which might happen for a reason.

i am not sure if this solves the issue, but here is a patch:
#79 (comment)

could you see if this fixes the issue?
it helped for reading the code. but importlib_metadata.version is still untyped, so we need to add an type ignore on it, still.
this means: i am totally fine with your suggestion to ignore this issue. since we have no other solution.

PS: will add the ignore-hint ASAP.
PPS: added the type ignore as you proposed. now it passes in py<38 but fails in py>=38 - so i silenced "warn_unused_ignores"

Signed-off-by: Jan Kowalleck <[email protected]>
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch from d2c28cd to 0759026 Compare December 2, 2021 17:14
@jkowalleck
jkowalleck marked this pull request as ready for review December 2, 2021 18:00
@jkowalleck
jkowalleck force-pushed the dependencies-lowest_testable-tox branch from 5a5b815 to e39eb6f Compare December 2, 2021 18:02
@jkowalleck jkowalleck changed the title add tox env for minimal required dependencies [CI/CT] add tox env for minimal required dependencies Dec 4, 2021
@jkowalleck jkowalleck added CI Continuous Integration CT Continuous Testing dependencies labels Dec 4, 2021
@jkowalleck jkowalleck changed the title [CI/CT] add tox env for minimal required dependencies add tox env for minimal required dependencies Dec 4, 2021
@jkowalleck

Copy link
Copy Markdown
Member Author

I think the tox setup is not great, but it does the job.
Do you think we can roll with it, @madpah ?

@jkowalleck jkowalleck self-assigned this Dec 4, 2021
@jkowalleck jkowalleck added the QA Quality Assurance label Dec 4, 2021

@madpah madpah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All looks good enough to be @jkowalleck

@madpah
madpah merged commit 07ebedc into main Dec 9, 2021
@madpah
madpah deleted the dependencies-lowest_testable-tox branch December 9, 2021 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration CT Continuous Testing dependencies QA Quality Assurance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants