Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
djangorestframework-stubs
Advanced tools
Mypy stubs for Django REST Framework. Supports Python 3.8 and up.
pip install djangorestframework-stubs[compatible-mypy]
To make mypy aware of the plugin, you need to add
[mypy]
plugins =
mypy_drf_plugin.main
in your mypy.ini
file.
Any
instead of my Model
classWhen subclassing ModelSerializer
, add a type argument to type-hint the related model class, for example:
class MyModelSerializer(serializers.ModelSerializer[MyModel]):
class Meta:
model = MyModel
fields = ("id", "example")
Which means that methods where the model is being passed around will know the actual type of the model instead of being Any
. The instance
attribute on the above serializer will be Union[MyModel, typing.Sequence[MyModel], None]
.
We have Gitter here: https://gitter.im/mypy-django/Lobby If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.
This project is open source and community driven. As such we encourage contributions big and small. You can contribute by doing any of the following:
You can always also reach out in gitter to discuss your contributions!
FAQs
PEP-484 stubs for django-rest-framework
We found that djangorestframework-stubs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.