-
Notifications
You must be signed in to change notification settings - Fork 1
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
First commits to create cyhy-db #5
Conversation
Delete example package and files Update Python version to 3.12 in build workflows Update package name and description in setup.py Update dependencies in setup.py
Add comments to severity calculation.
This commit refactors the CVE model and test in the `cyhy_db` package. The changes include: - Replacing the `odmantic` library with `mongoengine` for the model definition. - Updating the field types and constraints in the CVE model. - Removing the `calculate_severity` method and integrating the severity calculation directly in the `save` method. - Updating the test cases to reflect the changes in the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the quibbles below, when I run ./setup-env -p 3.13.0 -f
I get an error:
src/cyhy_db/models/tally_doc.py:41: error: Incompatible types in assignment (expression has type "str", base class "Document" defined the type as "PydanticObjectId | None") [assignment]
I did confirm that all tests pass by running pytest -vs --mongo-express
.
- Remove unnecessary pins. - Remove unused dependencies. - `coveralls` comment is no longer required. - `setuptools` pin and comment is no longer required. See: - cisagov/cyhy-config@8df2e69
Co-authored-by: David Redmin <[email protected]>
Add a mypy ignore directive to TallyDoc. Document all uses of this directive in a new issue.
I was able to replicate this. I've applied the same "fix" to See: |
Thank you! I was able to verify that I am now able to run |
Add a mypy ignore directive to TallyDoc. Document all uses of this directive in a new issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong work! 💪 💼
Please take a look at the couple of minor thangs I noticed.
The reserved word `from` was replaced with `from_` in `TicketDoc`. This follows that pattern. Co-authored-by: David Redmin <[email protected]> Co-authored-by: Jeremy Frasier <[email protected]>
This breaking change is documented in: - Data migration from `cyhy-core` database #8 Co-authored-by: David Redmin <[email protected]>
😜 Co-authored-by: dav3r <[email protected]>
I'm not sure if this is a work-around for a bug, or a needed option in Pydantic. See: - BeanieODM/beanie#369 - https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name
In an attempt to reach 100% coverage I broke out the various ways `reset_latestest_by_ip` could be called... to no avail. I believe this issue explains why the list comprehension shows a branch part as uncovered: - nedbat/coveragepy#1617
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
🗣 Description
This PR contains the initial functionality of the
cyhy-db
module, which provides a object model for accessing the various document collections in a Cyber Hygiene database.This PR also includes an assortment of unit tests, though more testing will likely be added later.
💭 Motivation and context
We have two main motivations here:
🧪 Testing
All unit tests currently pass in
pytest
. This code has also been partially tested by its use in thecyhy-kevsync
module (initial PR coming soon).✅ Pre-approval checklist
in code comments.
to reflect the changes in this PR.
✅ Pre-merge checklist
✅ Post-merge checklist
v1
tag that points to new release.