Saravanan666/pypi-org huggingface dataset:
Package: dj-rest-auth
Dj-Rest-AuthDrop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well
with SPAs (e.g., React, Vue, Angular), and Mobile applications.RequirementsDjango 2, 3, or 4 (See Unit Test Coverage in CI)Python 3Quick SetupInstall packagepip install dj-rest-authAdddj_rest_authapp to INSTALLED_APPS in your django settings.py:INSTALLED_APPS=(...,'rest_framework','rest_framework.authtoken',...,'dj_rest_auth')Add URL patternsurlpatterns=[path('dj-rest-auth/',include('dj_rest_auth.urls')),](Optional) Use Http-Only cookiesREST_AUTH={'USE_JWT':True,'JWT_AUTH_COOKIE':'jwt-auth',}TestingInstall required modules withpip install -r  dj_rest_auth/tests/requirements.pipTo run the tests within a virtualenv, runpython runtests.pyfrom the repository directory.
The easiest way to run test coverage is withcoverage,
which runs the tests against all supported Django installs. To run the test coverage
within a virtualenv, runcoverage run ./runtests.pyfrom the repository directory then runcoverage report.ToxTesting may also be done usingtox, which
will run the tests against all supported combinations of Python and Django.Install tox, either globally or within a virtualenv, and then simply runtoxfrom the repository directory. As there are many combinations, you may run them
inparallelusingtox --parallel.Thetox.iniincludes an environment for testing codecoverageand you can run it and view this report withtox -e coverage.Linting may also be performed viaflake8by runningtox -e flake8.DocumentationView the full documentation here:https://dj-rest-auth.readthedocs.io/en/latest/index.htmlAcknowledgementsThis project began as a fork ofdjango-rest-auth. Big thanks to everyone who contributed to that repo!A note on Django AllAuth from @iMericaThis project has optional and very narrow support for Django-AllAuth. As the maintainer, I have no interest in making this package support all use cases in Django-AllAuth. I would rather focus on improving the quality of the base functionality or focus on OIDC support instead. Pull requests that extend or add more support for Django-AllAuth will most likely be declined. Do you disagree? Feel free to fork this repo!
Package: dj-rest-auth-mfa
dj-rest-auth-mfaOverviewdj-rest-auth-mfais a Django App that is actually a plugin for thedj-rest-auththat adds mfa support to email/username accounts, by using thedjango-mfa2package.Requirements:Make sure the requirements fordjango-allauth,dj-rest-authanddjango-mfa2are metInstallationTo installdj-rest-auth-mfarun:pipinstalldj-rest-auth-mfaIn the settings.py you should have the following:INSTALLED_APPS = [
    # ...
    "corsheaders",
    "rest_framework",
    "rest_framework.authtoken",
    "mfa",  # this is django-mfa2
    "allauth",  # this is django-allauth
    "dj_rest_auth", # this is dj-rest-auth
    "dj_rest_auth_mfa"  # this package
]


MIDDLEWARE = [
    "corsheaders.middleware.CorsMiddleware",
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    "allauth.account.middleware.AccountMiddleware", # this is important for allauth
]Configurations:beside the configurations required by django-allauth and those required by dj-rest-auth,
and the configurations necessary for django-mfa2, there are the following configurations that should be defined in the django settings.py file:RECOVERY_ITERATION=720000# this is the recommended value for hashing iterationsMFA_MANDATORY=FalseMFA_ADAPTER_CLASS="dj_rest_auth_mfa.adapters.DjangoMFA2Adapter"MFA_GRACE_WINDOW_DAYS=7FeaturesCurrently only the following methods are supportedMFA_UNALLOWED_METHODS=["RECOVERY","TOTP]ContributingContributions to this project are welcomed! The Contributing Guide is still under construction.When creating a pull request make sure to use the following template:Change Summary
 - item one
 - item two
Related issue number
 - issue a
 - issue b
Checklist
  [ ] code is ready
  [ ] add tests
  [ ] all tests passing
  [ ] test coverage did not drop
  [ ] PR is ready for reviewLicensedj-rest-auth-saml is licensed under the MIT License - see the LICENSE file for details.
Package: dj-rest-auth-social
Dj-Rest-Auth-SocialDrop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well
with SPAs (e.g React, Vue, Angular), and Mobile applications.RequirementsDjango 2 or 3Python 3Quick SetupInstall packagepip install dj-rest-auth-socialAdddj_rest_authapp to INSTALLED_APPS in your django settings.py:INSTALLED_APPS=(...,'rest_framework','rest_framework.authtoken',...,'dj_rest_auth')Add URL patternsurlpatterns=[path('dj-rest-auth/',include('dj_rest_auth.urls')),](Optional) Use Http-Only cookiesREST_USE_JWT=TrueJWT_AUTH_COOKIE='jwt-auth'TestingInstall required modules withpip install -r  dj_rest_auth/tests/requirements.pipTo run the tests within a virtualenv, runpython runtests.pyfrom the repository directory.
The easiest way to run test coverage is withcoverage,
which runs the tests against all supported Django installs. To run the test coverage
within a virtualenv, runcoverage run ./runtests.pyfrom the repository directory then runcoverage report.ToxTesting may also be done usingtox, which
will run the tests against all supported combinations of python and django.Install tox, either globally or within a virtualenv, and then simply runtoxfrom the repository directory. As there are many combinations, you may run them
inparallelusingtox --parallel.Thetox.iniincludes an environment for testing codecoverageand you can run it and view this report withtox -e coverage.Linting may also be performed viaflake8by runningtox -e flake8.DocumentationView the full documentation here:https://dj-rest-auth.readthedocs.io/en/latest/index.htmlAcknowledgementsThis project began is a fork ofdj-rest-auth. Big thanks to everyone who contributed to that repo!
Package: dj-rest-commerce
Django rest framework E-commerce package which has simple beautiful eCommerce features.Features:Below some features::Product Management.Category, Brand, Model, Brand, Serial number Management.Semi-multi vendor (for the beta version).Easy order Management system.Quick startAddcommerceapp in yourINSTALLED_APPSsettings like this:INSTALLED_APPS = [
    ...
    'commerce',
    'rest_framework',
]Include the app URLconf in your project urls.py like this::path(‘api/v1/commerce/’, include(‘commerce.urls’)),Migrations file from your application then again run migration in the app::python manage.py makemigrations commercepython manage.py migrate commercepython manage.py migrate (optional if have already migrate not need to run the command again.)API endpoint:1. Root API:api/v1/commerce/Download the postman collection from here:http://surl.li/bocru
Package: dj-rest-filters
dj-rest-filtersdj-rest-filters is a Django application allowing users to declaratively add dynamic QuerySet filtering from URL parameters. Its uses Django Rest Framework serializers in backend so it provides same syntax as of serializers. You can validate you query parameter in same way as you validate in your serializer and it also provides filtering mechanism against custom query parameters.Installationpip install dj-rest-filtersThen add 'djfilters' to your INSTALLED_APPS.UsageFilteringfromrest_frameworkimportgenericsfromdjfilters.backendimportDjFilterBackendclassTodoView(generics.GenericAPIView):serializer_class=...filter_class=TodoFilterfilter_backends=[DjFilterBackend]queryset=Todo.objects.all()Validation OnlyWhen queryset is declared, filter will be used to filter that queryset. But when there is not any queryset, filter will just be used to validate the provided query parameters.fromrest_frameworkimportgenericsclassTodoView(generics.GenericAPIView):serializer_class=...filter_class=MyFilterFilter ContextJust like serializer context, context can be passed to filter by usingget_filter_contextfunction like this.fromrest_frameworkimportgenericsclassTodoView(generics.GenericAPIView):....defget_filter_context(self):context={'extra_data':'some_extra_data'}returncontextAccessing Validated Query ParamsAfter query param validation, validated parameters can be accessed usingrequest.cleaned_args.For detailed documentation, clickhere.
Package: djrest-wrapper
# Django Rest Framework Wraper
A customized wrapper for djangorestframework
### Installation`bash pip installdjrest-wrapper`### Quick Start
simply set these variables insettings.py`python REST_FRAMEWORK = { 'EXCEPTION_HANDLER': 'djrest_wrapper.exceptions.handler.exception_handler', 'DEFAULT_RENDERER_CLASSES':['djrest_wrapper.renderers.defaultjson.DefaultJsonRenderer'],'DEFAULT_PAGINATION_CLASS': 'djrest_wrapper.paginations.default.DefaultPagination', } `
Package: djreviews
DJANGO REVIEWS & RATINGAdd reviews and ratings functionalities to your dango app.InstallationpipinstalldjreviewsUsageExtending functionality in modelsfromdjango.dbimportmodelsfromdjreviews.modelsimportBaseReviewModel,BaseReviewedModelclassProductReview(BaseReviewModel):"""Product Reviews"""classProduct(BaseReviewedModel):name=models.CharField(max_length=20)description=models.TextField()objects=models.Manager()# importantREVIEW_MODEL=ProductReviewusage in viewsproduct=Product.objects.get(pk=product_pk)customer=Customer.objects.get(pk=customer_pk)product.add_review(content=review_text,rating=rating_score,reviewer=customer,)# ORProductReview.objects.add_review(content=review_text,rating=rating_score,reviewed_object=product,reviewer_object=customer,)in templates{% for review in object.reviews.all|dictsortreversed:"id" %}<div><p>{{ review.reviewer }}</p><p>rating: {{ review.rating }}</p><p>review: {{ review.content }}</p></div>{% empty %}<p>No reviews</p>{% endfor %}
Package: dj-revproxy
dj-revproxy-----------Django reverse proxy. Allows you to proxy any website behind a prefix.Requirements------------- `Python <http://www.python.org>`_ 2.x superior to 2.5 and Django- `Django <http://www.djangoproject.org>`_  >= 1.2- `restkit <http://www.couchdbkit.org>`_ >= 2.1.2Installation------------Install from sources::$ python setup.py installOr from Pypi::$ easy_install -U dj-revproxyConfiguration-------------Add `revproxy`  to the list of applications::INSTALLED_APPS = (...'revproxy')Usage-----Since 0.2, there is 2 ways to use dj-revproxy.1. Generic view+++++++++++++++You can use ``proxy_request`` function to proxy any url. You can use it in your code::proxy_request(request, "http://example.com")This code will proxy current request to ``http://example.com`` domain.This function can take 5 parameters:- destination: string, the proxied url. Required- path: string, If no path is given it will try to detect the url usingthe prefix if it's given. If not full request.path will be used infinl destination url.- prefix: string, the prrefix behind we proxy the pathheaders: dict, custom HTTP headers- no_redirect: boolean, False by default, do not redirect to "/"if no path is given- decompress: boolean, False by default. If true the proxy willdecompress the source body if it's gzip encoded.It return an instance of ``django.http.HttpResponse``. You can use it  directlyin your urls.py (which is the eaiest way to use). Ex::(r'^gunicorn(?P<path>.*)', "revproxy.proxy_request", {"destination": "http://gunicorn.org"}),2. Configure multiple proxy behind one generic prefix+++++++++++++++++++++++++++++++++++++++++++++++++++++To configure a proxy add a tupple to the REVPROXY_SETTINGS list::REVPROXY_SETTINGS = [("_google", "http://google.com"),("_friendpaste", "http://www.friendpaste.com"),("_couchdb", "http://127.0.0.1:5984"),]Then configure your proxied urls automatically do something like this in``urls.py``::from django.conf.urls.defaults import *import revproxyurlpatterns = patterns('',...(r'^proxy/', include(revproxy.site_proxy.urls)),)Which will allow you to proxy Google on the url::http://127.0.0.1:8000/proxy/_googleor even::('^proxy/(?P<prefix>[^\/]*)(.*)', "revproxy.site_proxy"),
Package: djrill
Djrill integrates theMandrilltransactional
email service into Django.PROJECT STATUS: INACTIVEAs of April, 2016, Djrill is no longer actively maintained (other
than security updates). It is likely to keep working unless/until
Mandrill changes their APIs, but Djrill will not be updated for
newer Django versions or Mandrill changes.
(more info)You may be interested indjango-anymail,
a Djrill fork that supports Mailgun, Postmark, SendGrid, and other
transactional ESPs (including limited support for Mandrill).In general, Djrill “just works” with Django’s built-indjango.core.mailpackage. It includes:Support for HTML, attachments, extra headers, and other features ofDjango’s built-in emailMandrill-specific extensions like tags, metadata, tracking, and MailChimp templatesOptional support for Mandrill inbound email and other webhook notifications,
via Django signalsDjrill is released under the BSD license. It is tested against Django 1.4–1.9
(including Python 3 with Django 1.6+, and PyPy support with Django 1.5+).
Djrill usessemantic versioning.ResourcesFull documentation:https://djrill.readthedocs.org/en/v2.1/Package on PyPI:https://pypi.python.org/pypi/djrillProject on Github:https://github.com/brack3t/DjrillDjrill 1-2-3Install Djrill from PyPI:$pipinstalldjrillEdit your project’ssettings.py:INSTALLED_APPS=(..."djrill")MANDRILL_API_KEY="<your Mandrill key>"EMAIL_BACKEND="djrill.mail.backends.djrill.DjrillBackend"DEFAULT_FROM_EMAIL="you@example.com"# if you don't already have this in settingsNow the regularDjango email functionswill send through Mandrill:fromdjango.core.mailimportsend_mailsend_mail("It works!","This will get sent through Mandrill","Djrill Sender <djrill@example.com>",["to@example.com"])You could send an HTML message, complete with custom Mandrill tags and metadata:fromdjango.core.mailimportEmailMultiAlternativesmsg=EmailMultiAlternatives(subject="Djrill Message",body="This is the text email body",from_email="Djrill Sender <djrill@example.com>",to=["Recipient One <someone@example.com>","another.person@example.com"],headers={'Reply-To':"Service <support@example.com>"}# optional extra headers)msg.attach_alternative("<p>This is the HTML email body</p>","text/html")# Optional Mandrill-specific extensions:msg.tags=["one tag","two tag","red tag","blue tag"]msg.metadata={'user_id':"8675309"}# Send it:msg.send()See thefull documentationfor more features and options.
Package: djrillcelery
DjrillCelery extends theDjrillpackage with a backend that sends mail with celery tasks.PrerequisitesInstall Djrill:https://djrill.readthedocs.org/en/latest/Install Celery:https://pypi.python.org/pypi/djrillQuickstartInstall DjrillCelery from PyPI:$pipinstalldjrillceleryEdit your project’ssettings.py:INSTALLED_APPS=(..."djrillcelery")EMAIL_BACKEND="djrillcelery.mail.backends.DjrillCeleryBackend"Now, for every mail that is sent a new task is created.
Package: djrobots
Our internal utility to easily have robots.txt both for development and productionInstallpip install djrobotsUsageInclude djrobots urls to your URLconf and your're done!(r'^robots\.txt$', include('djrobots.urls')),and add djrobots to your INSTALLED_APPS.If you want to disable all in your website, use in your settingsDJROBOTS_DISALLOWALL = TrueSitemapIf you want to specify the sitemap urls in your robots.txt, provide the view name in the settingsDJROBOTS_SITEMAPS = 'sitemap-root'DJROBOTS_SITEMAPS is a special setting, you can use an array to specify more sitemaps in your robots.txtDJROBOTS_SITEMAPS = ['sitemap-root', 'department-sitemap']or you can mix view names with raw urlsDJROBOTS_SITEMAPS = ['sitemap-root', 'department-sitemap', '/my-sitemap-index.xml']CustomizationBy default djrobots provides a robots.txt template for production and a robots-debug.txt for development with a default configuration used internally at Lotrek.If you want to specify more directives you can extend default templates, robots.txt and robots-debug.txt{% extends "djrobots/base-robots.txt" %}
{% block content %}
User-agent: *
Disallow: /cgi-bin/
Disallow: /tmp/
Disallow: {% url 'documents' %}

Host: example.com

{% endblock %}Run tests$ pip install -r requirements-dev.txt
$ make test
Package: dj-saferunner
A mechanism for running processes which might have side effects (e.g.: calling an external API etc.) in a way that is safe by default during testing and provides useful introspection functionality.It will: Run a list of tasks. If possible, it will run them asyncronouslyInTEST_MODE:It will not run the codeIt will store information about the calls made inUsageInstall and configurepip install dj-saferunnerConfig optionsDjango settingsSAFERUNNER_USE_SENTRY- set toTrueto swallow errors and log to SentryIn your code:beforefrommyapp.tasksimportping_googleping_google(url='http://foo.com')afterfrommyapp.tasksimportping_googlefromsaferunner.process_runnerimportsafely_run_processestask_list=[# task, args, async(ping_google,{"url","http://foo.com"},False)]safely_run_processes(run_id='identifier giving some context about where this is run',task_list=task_list)In your testsWhen in test mode, by default the saferunner will not execute your code. Instead it will log your calls using django's cacheexample testdeftest_run_some_tasks(self):clear_run_cache()run_id='this_is_a_test'task_list=[(hello,{"msg":"hi"},False),(do_something_slowly,{"sleep":10},True),]safely_run_processes(run_id=run_id,task_list=task_list)res=get_process_run(run_id)The results ofget_process_runwould look something like this:[{
	'task_name': 'hello',
	'task_args': "OrderedDict([('msg', 'hi')])",
	'is_async': False
}, {
	'task_name': 'do_something_slowly',
	'task_args': "OrderedDict([('sleep', 10)])",
	'is_async': True
}]Explicitly running side effect codeIn your tests, You can forcesaferunnerto execute safely run code.You might want to do this, for example, if you want to test code inside your function from a higher level.
Ideally you should not really need to do this too often. We would recommend that it is preferred to test your
functions by calling them directly (as opposed to checking for side effects in a higher level function)Run all side effect code:Will essentially turnsaferunneroff for this test@override_settings(FORCE_RUN_SIDE_EFFECTS='__all__')You can also specify a specific task to pass through:This will forcesaferunnerto explicitly run this exact function/method@override_settings(FORCE_RUN_SIDE_EFFECTS=task.name)
@override_settings(FORCE_RUN_SIDE_EFFECTS=task.__name__)FAQ:Q: Why not just use mocks?
A:
The use-case for this is for code that might get executed often
(for example code in signals), and which might have unwanted
side-effects if accidentally run durung tests (e.g.: send SMSes or making API calls).
We want to err on the side of caution here and mock by default during testing
and be explicit about when we want to run this codePS: DHH would probably call this test induced damage!TODOMake it work Class methods
Package: dj-scaffold
============dj-scaffold============dj-scaffold installs a script which allows the easy creation of a standardDjango project layout.dj-scaffold add a commend lbstartapp to django, which allows the easy creationof a standard Django app layout.dj-scaffold.py==============After installing dj-scaffold, simply run the following command (from withinthe directory in where the new project directory should be created)::dj-scaffold.py project_nameThe script will prompt for values to replace boilerplate variables with. Thesevariables allow for both the file contents and path names to be customized tothis specific project.directory structure-------------------|+docs/|+env/   #python virtual env, created by scripts/create_env.py|~requirements.txt|~scripts/    #some scripts for this project| |-create_env.py    #initialize python virtual env and install requirements| `-env.rc    #start python virtual env. Create $mg as a shortcut for python manger.py. you can use $mg in any folder.|~sites/    #django's project files. Added some default settings. default db is sqlite, set up template folder and static folder for project.| |+media/    #media folder| |+static/    #static folder(css/js...)| |~settings/  #settings files| | |-__init__.py| | |-base.py  #base settings| | |-dev.py   #settings for develop environment| | |-local.sample| | |-pre.sample  #you can create pre.py to set which settings file you want to use(default is dev)| | `-production.py  ##settings for production environment| `+templates/    #templates folder|+tools/`~deploy/`-dj_scaffold.wsginote: project's app put in sites/ folder. sites/you app/lbstartapp===============================add dj_scaffold to INSTALLED_APPS.run commend::python manage.py lbstartapp app_name
Package: dj-scheduledtasks
dj-scheduledtasksRun tasks at a scheduled timeInstallationpip installpip install dj-scheduledtasksadd to installed apps:INSTALLED_APPS=[...'scheduledtasks',]Getting startedfromscheduledtasks.modelsimportScheduledTaskAdding a reverse lookup to your modelYou might want to be able to access the list of scheduled tasks on a model. To make this easy, you can add aGenericRelationfieldfromdjango.contrib.contenttypes.fieldsimportGenericRelationfromscheduledtasks.modelsimportScheduledTaskclassTodo(models.Model):...scheduled_tasks=GenericRelation(ScheduledTask)You can then accessscheduled_tasks_setjust as you would any otherForeignKeyfieldSchedule a task:Explicit schedule# minimal usageScheduledTask.schedule('example_project.tasks.remind_if_due')# minimal usageScheduledTask.schedule('remind_if_due')Schedule from a related objectYou can also schedule infer the scheduled time from an object by passing the object instance, a field and an offset. e.g.:# run a task 60 minutes after the due dateScheduledTask.schedule_by_object(todo,'example_project.tasks.remind_if_due','due_date',offset=60).. or just use the model directlyCreate a taskWays to run a taskCleanup old tasks
Package: djsciops
DataJoint SciOps Customer ToolsA suite of customer CLI tools for DataJoint SciOps.Python RequirementDjsciops requires a minimum python version of3.8GUIPreviewInstallationWindowsExtract theAxon.exeto the desired directoryRunAxon.exeIf Windows Defender notifies you that the app is unrecognized, clickMore info, thenRun anywayWhen authenticating, if Windows Firewall notifies you that network access has been blocked, clickAllow accessMacOSExtract theAxon.dmgto the desired directoryOpenAxon.dmgMoveAxon.appto your Applications folderRunAxonIfAxonis blocked from opening, clickOKNavigate toSystem Preferences->Security & Privacy->GeneralClickOpen Anyway
Package: dj-searchurl
This simple Django utility allows you to utilize the12factorinspiredSEARCH_URLenvironment variable to configure your Haystack application.UsageConfigure your Search index insettings.pyfromSEARCH_URL:HAYSTACK_CONNECTIONS = {"default": dj_search_url.conf()}Parse an arbitrary Database URL:HAYSTACK_CONNECTIONS = {"default": dj_search_url.conf("elasticsearch://..")}InstallationInstallation is simple too:$ pip install dj-search-url
Package: dj-search-url
This simple Django utility allows you to utilize the12factorinspiredSEARCH_URLenvironment variable to configure your Haystack application.UsageConfigure your Search index insettings.pyfromSEARCH_URL:HAYSTACK_CONNECTIONS = {"default": dj_search_url.conf()}Parse an arbitrary Database URL:HAYSTACK_CONNECTIONS = {"default": dj_search_url.conf("elasticsearch://..")}InstallationInstallation is simple too:$ pip install dj-search-url