Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This library can convert a pydantic class to a spark schema or generate python code from a spark schema.
pip install pydantic-spark
import json
from typing import Optional
from pydantic_spark.base import SparkBase
class TestModel(SparkBase):
key1: str
key2: int
key2: Optional[str]
schema_dict: dict = TestModel.spark_schema()
print(json.dumps(schema_dict))
Pydantic-spark provides a coerce_type
option that allows type coercion.
When applied to a field, pydantic-spark converts the column's data type to the specified coercion type.
import json
from pydantic import Field
from pydantic_spark.base import SparkBase, CoerceType
class TestModel(SparkBase):
key1: str = Field(extra_json_schema={"coerce_type": CoerceType.integer})
schema_dict: dict = TestModel.spark_schema()
print(json.dumps(schema_dict))
poetry install
pytest
coverage run -m pytest # with coverage
# or (depends on your local env)
poetry run pytest
poetry run coverage run -m pytest # with coverage
The linting is checked in the github workflow. To fix and review issues run this:
black . # Auto fix all issues
isort . # Auto fix all issues
pflake . # Only display issues, fixing is manual
FAQs
Converting pydantic classes to spark schemas
We found that pydantic-spark demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.