Saravanan666/pypi-org huggingface dataset:
Package: django-pubsubpull
django-pubsubpullis intended to help you decouple micro-services.
It provides mechanisms that allow services to publish changes, subscribe
to change notifications, and pull records.In practice what we’ll end up with is along the lines of:Use Django slumber and async to provide a load of basic
infrastructure this is going to need.Provide new models for tracking database level changes to certain
tables (models), and database triggers to ensure that they are
properly recorded.All operations will be based on HTTP using GET, PUT and DELETE only.Django middleware to capture as much information about the request
and the underlying changes we can and to tie that in to the records
of database changes recorded there.Support for Django 1.0 through 1.7. We may support 1.8 and later if
we can make our middleware subsume the functionality of the old
transaction middleware.Only support Postgres 9.4 and later.The use cases we envisage include:A service needs to locally cache a copy of some attributes of an
object held in another micro-service, generally for performance
reasons (for example, a billing service needing copies of a
customer’s location so that it can choose the correct rates).A service needs to record meta-data about user instructed changes for
audit trail purposes (for example, any change to a customer email
subscription is recorded with full details of who made the change and
when it was made).A service needs to be notified of certain API calls so that it can in
turn trigger other behaviours (for example, a comms service sending a
welcome email when a new user is created).The three parts are:Publish: A service will notify it’s subscribers about any changes to
the requested model instances. Ultimately the publish will hook into
a database trigger to ensure that changes are always properly
recorded no matter how it occurs.Subscribe: A service can request change notifications be sent to it
from the publishing service. The subscriber is able to specify a URL
that is used for a PUT request when changes are notified.Pull: A service can iterate over all of the instances of a particular
model and then periodically iterate over new ones.
Package: django-pubtools
django-pubtools is a helper library for creating publishable django models.[![Circle CI](https://circleci.com/gh/gregplaysguitar/django-pubtools.svg?style=svg)](https://circleci.com/gh/gregplaysguitar/django-pubtools)[![codecov](https://codecov.io/gh/gregplaysguitar/django-pubtools/branch/master/graph/badge.svg)](https://codecov.io/gh/gregplaysguitar/django-pubtools)[![Latest Version](https://img.shields.io/pypi/v/django-pubtools.svg?style=flat)](https://pypi.python.org/pypi/django-pubtools/)## OverviewExtend the `AbstractPublishableModel` class to create a publishable model class.- Publishable content can be in either draft, preview, or published status.- Draft content may be previewed on the site by a logged-in staff member- Preview content may be previewed publicly, via a special url## Installationpip install django-pubtools## Example implementationmodels.py:```pythonfrom django.db import modelsimport pubtools.modelsclass Article(pubtools.models.AbstractPublishableModel):title = models.CharField(max_length=100)```views.py:```pythonfrom django.http import HttpResponsefrom .models import Articledef article(request, id):# pass the request to enable staff previewarticles = Article.objects.published(request)article = articles.get(id=id)return HttpResponse(article.title)```admin.py:```pythonfrom django.contrib import adminfrom baseclasses.admin import PublishableModelAdminMixinfrom .models import Article@admin.register(Article)class ArticleAdmin(PublishableModelAdminMixin, admin.ModelAdmin):list_display = ['title']```## Reference### `pubtools.models.AbstractPublishableModel`##### Model fields- `created` (datetime, set on creation)- `last_updated` (datetime, updated on save)- `pub_date` (date)- `pub_status` (one of draft, review or published)##### Model methods- `published` (property) return True if the instance is published- `get_prev_published(qs=None, loop=False)` get previous published instance- `get_next_published(qs=None, loop=False)` get next published instance### `pubtools.models.PublishableModelQuerySet`##### Manager/queryset methods- `published(self, request=None)` If request is passed, and a preview statusflag is in request.GET, then check if the user is a staff member, andreturn objects with the requested status if so. Otherwise, return onlypublished objects.### `pubtools.admin.PublishableModelAdminMixin`- Overrides `view_on_site` to add a flag to urls for draft/preview content.- Adds a "Publish selected" action to the admin
Package: django-pudb
PuDB integration for Django <https://github.com/akanouras/django-pudb>InstallingRunpip installdjango-pudbIn yoursettings.py:Add'django_pudb.PudbMiddleware'at/near the end of yourMIDDLEWARE_CLASSESSetDEBUG_PROPAGATE_EXCEPTIONS = TrueRun./manage.py runserver--nothreadingNow you should see PuDB pop up in your console window whenever a view
raises an exception.NotesThis package has zero requirements on purpose, so that you can install it
(system|user)-wide, and still get to install Django in your virtualenvs.As PuDB doesn’t support threading (yet, hopefully), django-pudb doesn’t either.Changelog0.1.0 (2014-05-06)Initial version.Just the middleware; zero magic.Licence (MIT)Copyright (C) 2014 Antonis Kanouras <antonis@metadosis.eu>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Package: django-pudb3
django-pudbDjango middleware to view exceptions in PuDBhttps://github.com/hwalinga/django-pudb3What is thisThis is Django middleware that will intercept exceptions and puts you in PuDB.Note that you can already use PuDB with Django without this usingimport pudb; pu.dbor by runningpudb3 manage.py runserver(however the latter is a bit clumsy). This piece of middleware is purely to intercept exceptions.InstallingNB. You should have PuDB installed already.pip install django-pudb3In yoursettings.py:Add'django_pudb.PudbMiddleware'at/near the end of yourMIDDLEWARE_CLASSESSetDEBUG_PROPAGATE_EXCEPTIONS = TrueRun./manage.py runserver --nothreadingNow you should see PuDB pop up in your console window whenever a view
raises an exception.NotesThis package has zero requirements on purpose, so that you can install it
(system|user)-wide, and still get to install Django in your virtualenvs.As PuDB doesn't support threading (yet, hopefully), django-pudb doesn't either.Changelog0.2.0 (2020-10-23)Updated to work with newer versions of Django and Python.0.1.0 (2014-05-06)Initial version.
Just the middleware; zero magic.SupportsMinimal Django version is 1.10.Despite the name, also still works in Python2.7 last time I checked.Original projectThis is an updated version ofhttps://github.com/akanouras/django-pudbLicence (MIT)Copyright (C) 2014 Antonis Kanourasantonis@metadosis.euHielke Walingahielkewalinga@gmail.comPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Package: django-pulse
Monitoring Django Application Health over HTTP.QuickstartInstall django-pulse:pip install django-pulseAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'django_pulse.apps.DjangoPulseConfig',...)Add django-pulse’s URL patterns:fromdjango_pulseimporturlsasdjango_pulse_urlsurlpatterns=[...url(r'^',include(django_pulse_urls)),...]FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxHistory0.1.0 (2016-12-04)First release on PyPI.
Package: django-puppeteer-pdf
Converts HTML to PDFProvides Django views to wrap the HTML to PDF conversion usingpuppeteer.Forked from:django-wkhtmltopdf.Requirementscli for puppeteerpuppeteer-pdf.Python 2.6+ and 3.3+ are supported.
See travis-ci build status for detailsNoteCurrent version is only tested as a use of django rest framework rendererexamples/drf_renderer.pyDocumentation is not up to date but you can see working use cases inexamplesdirectoryReporting bugs and issues is welcomedInstallationRunpip installdjango-puppeteer-pdf.By default it will execute the firstpuppeteer-pdfcommand found on yourPATH.It is recommended to specify full path of puppeteer-pdf using one of the way mentioned below.If you can’t add puppeteer-pdf to yourPATH, you can setPUPPETEER_PDF_CMDto a
specific executable:e.g. insettings.py:PUPPETEER_PDF_CMD = '/path/to/my/puppeteer-pdf'or alternatively as env variable:export PUPPETEER_PDF_CMD=/path/to/my/puppeteer-pdfYou may also setPUPPETEER_PDF_CMD_OPTIONSinsettings.pyto a dictionary
of default command-line options.The default is:PUPPETEER_PDF_CMD_OPTIONS = {
    'format': 'A4',
}DocumentationDocumentation is available athttp://django-puppeteer-pdf.readthedocs.org/en/latest/.LicenseMIT licensed. See the bundledLICENSEfile for more details.
Package: django-purchase-core
A reusable Django app for creating, logging and verifying purchases.Quick startInstall Django Purchase Core & Dependencies:>>> pip install django-purchase-coreAdd “purchase”, “rest_framework’, and “rangefilter” to your INSTALLED_APPS setting like this:INSTALLED_APPS=[...,'rest_framework','purchase','rangefilter',...,]Add the following to app_config.urls:fromdjango.conf.urlsimporturl,includeurlpatterns=[...,path("api/",include("purchase.urls")),...,]Run Django Commands:>>> python manage.py makemigrations
>>> python manage.py migrateConfigure configuration and credentials for your game in the admin panel.Add progress level update processingTo work with subscription you first need to set authorization and user model:setup “PURCHASE_USER_ATTACHED” in you settings.py to True (not provided equals False, when it False no signal will be called, user model wont be used)...PURCHASE_USER_ATTACHED=True...configure user model (in your settings.py)USER_MODEL=YourUserModelconfigure auth and permission classes for DRF (in your settings.py)REST_FRAMEWORK={"DEFAULT_PERMISSION_CLASSES":["rest_framework.permissions.IsAuthenticated"],"DEFAULT_AUTHENTICATION_CLASSES":["path.to.your.auth.class.or.base"],}to handle completed purchase setup receiver to update progress, which will receive “instance”fromdjango.dispatchimportreceiverfrompurchase.signalsimportpurchase_completed@receiver(purchase_completed)defpurchase_completed(sender,**kwargs):purchase=kwargs["instance"]user=purchase.user# User completed purchasepurchase_id=purchase.purchase_id# Your product ID, as it presented in store...To work with subscription you first need to set authorization and user model:configure user model, auth and permission classes for DRF (in your settings.py, as for purchase with user)...USER_MODEL=YourUserModel......REST_FRAMEWORK={..."DEFAULT_PERMISSION_CLASSES":["rest_framework.permissions.IsAuthenticated"],..."DEFAULT_AUTHENTICATION_CLASSES":["path.to.your.auth.class.or.base"],...}...setup receiver for signal, which will receive “instance” as Subscription model instancefromdjango.dispatchimportreceiverfrompurchase.signalsimportsubscription_completed@receiver(subscription_completed)defsubscription_completed(sender,**kwargs):subscription=kwargs["instance"]user=subscription.user# User completed subscriptionsubscription_id=subscription.product_id# your subscription ID, as it presented in store...
Package: django-pure-admin
==========DJANGO PURE ADMIN==========Step by step i will change admin template of Django. Some UI i will take from here: https://gurayyarar.github.io/AdminBSBMaterialDesign/.. image:: http://res.cloudinary.com/responsivebreakpoints/image/upload/c_scale,w_555/v1505836384/Screen_Shot_2017-09-19_at_8.48.19_PM_kzwtuu.png:width: 500px:height: 500px:scale: 50%:alt: Login admin:align: center.. image:: http://res.cloudinary.com/responsivebreakpoints/image/upload/c_scale,w_952/v1505836583/Screen_Shot_2017-09-19_at_8.48.03_PM_ktd6iz.png:width: 800px:height: 800px:scale: 50%:alt: App list:align: center.. image:: http://res.cloudinary.com/responsivebreakpoints/image/upload/c_scale,w_849/v1505836653/Screen_Shot_2017-09-19_at_8.49.26_PM_qrkxbs.png:width: 800px:height: 800px:scale: 50%:alt: Change list:align: center.. image:: http://res.cloudinary.com/responsivebreakpoints/image/upload/c_scale,w_1138/v1505836693/Screen_Shot_2017-09-19_at_8.50.31_PM_n31pq1.png:width: 800px:height: 800px:scale: 50%:alt: Change form:align: centerInstallation============* Download and install latest version of Django Pure Admin:.. code:: pythonpip install django-pure-admin* Add 'pure_admin' application to the INSTALLED_APPS setting of your Django project settings.py file (note it should be before 'django.contrib.admin'):.. code:: pythonINSTALLED_APPS = (...'pure_admin','django.contrib.admin',)
Package: django-pureftpd-admin
=====Pureftpd admin=====Pureftpd admin is a Django project to manage accounts in pureftpd server based on mysql auth backend.Quick start-----------=====Pureftpd admin=====Pureftpd admin is a Django project to manage accounts in pureftpd server based on mysql auth backend.Quick start-----------1. Add "pureftpd_admin" to your INSTALLED_APPS setting like this::INSTALLED_APPS = (...'django.contrib.staticfiles', #!!!'pureftpd_admin',)2. Include the polls URLconf in your project urls.py like this::url(r'^', include('pureftpd_admin.urls')),3. Write you own settings with default django options and this::FTPUSERS_DEFAULT_UIDFTPUSERS_DEFAULT_GIDFTPUSERS_DEFAULT_UPLOAD_BANDWIDTHFTPUSERS_DEFAULT_DOWNLOAD_BANDWIDTHFTPUSERS_DEFAULT_UPLOAD_RATIOFTPUSERS_DEFAULT_DOWNLOAD_RATIOFTPUSERS_DEFAULT_QUOTA_SIZEFTPUSERS_DEFAULT_QUOTA_FILESFTPUSERS_DEFAULT_IPACCESSFTPUSERS_DEFAULT_HOSTNAME # if not defined used platform.node()4. Create database in Mysql for storage user::./manage.py syncdb# or if you use South./manage.py syncdb --all or ./manage.py migrate5. Start the development or production server and visit http://127.0.0.1:8000/admin/ftpusers/to create a new ftp user (default Admin interface should be enabled).6. Create config pureftpd for authenticate through sql backend - mysql::./manage.py generate_conf --help.
Package: django-purge
PurgeDocumentation:https://django-purge.readthedocs.ioSource:https://github.com/gregschmit/django-purgePyPI:https://pypi.org/project/django-purge/Purge is a reusable Django app for regularly purging old database entries, like
logs.The Problem: Tables/models like sessions and logs can grow without limit.The Solution: This app allows you to schedule database purging of old
records. You can also make FilePurgers which can purge old files based on
datestamps in the filename or timestamps in the meta-data (atime/mtime/ctime).How to Use$pipinstalldjango-purgeIncludepurgein yourINSTALLED_APPS. Then, create your
database purgers or file purgers in the admin interface.Then, either periodically call thepurgemanagement command (e.g., via a
system cronjob), or install and configuredjango-cron(addpurge.cronto yourCRON_CLASSESin yoursettings.py). The builtinCronJobclass is set to run every 4
hours. You can change this by altering yoursettings.pyand addingPURGE_CRON_RUN_AT_TIMESto an array of times you want to run the job at
(e.g.,['1:00']to run at 1am).ContributingEmailgschmi4@uic.eduif you want to contribute. You must only contribute code
that you have authored or otherwise hold the copyright to, and you must
make any contributions to this project available under the MIT license.To collaborators: don’t push using the--forceoption.Dev QuickstartPurge comes with asettings.pyfile, technically making it a Django project as
well as a Django app. First clone, the repository into a location of your
choosing:$gitclonehttps://github.com/gregschmit/django-purgeThen you can go into thedjango-purgedirectory and do the initial
migrations and run the server (you may need to typepython3rather thanpython):$cddjango-purge$pythonmanage.pymakemigrations$pythonmanage.pymigrate$pythonmanage.pycreatesuperuser...$pythonmanage.pyrunserverThen you can see the models athttp://127.0.0.1:8000/admin.
Package: django-pursed
A simple wallet django applicationCreating a New WalletA wallet is owned by a user. Should you be using a custom user model,
the wallet should still work properly as it the wallet points tosettings.AUTH_USER_MODEL.fromwallet.modelsimportWallet# wallets are owned by users.wallet=user.wallet_set.create()Despositing a balance to a walletfromdjango.dbimporttransactionwithtransaction.atomic():# We need to lock the wallet first so that we're sure# that nobody modifies the wallet at the same time# we're modifying it.wallet=Wallet.select_for_update().get(pk=wallet.id)wallet.deposit(100)# amountWithdrawing a balance from a walletfromdjango.dbimporttransactionwithtransaction.atomic():# We need to lock the wallet first so that we're sure# that nobody modifies the wallet at the same time# we're modifying it.wallet=Wallet.select_for_update().get(pk=wallet.id)wallet.withdraw(100)# amountWithdrawing with an insufficient balanceWhen a user tries to withdraw from a wallet with an amount greater
than its balance, the transaction raises awallet.errors.InsufficientBalanceerror.# wallet.current_balance  # 50# This raises an wallet.errors.InsufficentBalance.wallet.withdraw(100)This error inherits fromdjango.db.IntegrityErrorso that when it is
raised, the whole transaction is automatically rolled-back.Transferring between walletsOne can transfer a values between wallets. It useswithdrawanddepositinternally. Should the sending wallet have an insufficient
balance,wallet.errors.InsufficientBalanceis raised.withtransaction.atomic():wallet=Wallet.select_for_update().get(pk=wallet_id)transfer_to_wallet=Wallet.select_for_update().get(pk=transfer_to_wallet_id)wallet.transfer(transfer_to_wallet,100)CURRENCY_STORE_FIELDTheCURRENCY_STORE_FIELDis a django field class that contains how
the fields should be stored. By default, it usesdjango.models.BigIntegerField. It was chosen that way for
simplicity - just make cents into your smallest unit (0.01 -> 1, 1.00
-> 100).You can change this to decimal by adding this to your settings.py:# settings.pyCURRENCY_STORE_FIELD=models.DecimalField(max_digits=10,decimal_places=2)You need to run./manage.py makemigrationsafter that.
Package: django-push
PubSubHubbub support for Django.Author: Bruno Renié andcontributorsLicence: BSDUsageThe documentation isavailable on ReadTheDocs.ContributingLinks to the PubSubHubbub specs:0.4,0.3.The project is on github:https://github.com/brutasse/django-pushTo setup a development environment, run:mkvirtualenv django-push
pip install -r requirements-dev.txt DjangoThen run the tests:python setup.py testUsetoxto run the tests across all supported Python / Django version
combinations:pip install tox
toxTo get code coverage stats:pip install coverage
coverage run runtests.py
coverage html
open htmlcov/index.html
Package: django-pusher
Django Pusher is an application that makes it easier to utilize pusher.com with reusable applications. It solves
the problem of authentication of private/presence channels as well as helping to prevent namespace clashes.UsageDjango Pusher provides a pusher object gotten by:from django_pusher.push import pusherpusherMimics the Generic Python Library provided by pusher.com except it adds aregisterandunregistercommand.
Package: django-pusherable
# django-pusherableReal-time object access notifications via [Pusher](https://pusher.com).## InstallationInstall django-pusherable:```bashpip install django-pusherable```## ConfigurationThen add `pusherable` to your `INSTALLED_APPS`. You will also need to add your Pusherapp credentials to `settings.py`. These are available on your app keys page:```pythonPUSHER_APP_ID = u""PUSHER_KEY = u""PUSHER_SECRET = u""PUSHER_CLUSTER = u""```## MixinsTo begin receiving notifications about an object use the mixins:```pythonfrom pusherable.mixins import PusherDetailMixin, PusherUpdateMixinclass PostDetail(PusherDetailMixin, DetailView):model = Postclass PostUpdate(PusherUpdateMixin, UpdateView):model = Postform_class = PostUpdateForm```When the view is accessed it will send an event on the channel`modelname_pk` which contains a JSON representation of the object (model instance)being accessed as well as the user.The data will be in the form:```json{"object": {"question": "What's up?","pub_date": "2013-08-08T11:16:24","id": 1},"user": "admin"}```Which fields are included and excluded within the `object` is configurable via`pusher_include_model_fields` and `pusher_exclude_model_fields`. For example,the following would exclude the `pub_date` from the event payload:```pythonclass PostUpdate(PusherUpdateMixin, UpdateView):model = Postform_class = PostUpdateFormpusher_exclude_model_fields = 'pub_date'```## Template tagsTo subscribe to these events on your page you can use the templatetags:```{% load pusherable_tags %}{% pusherable_script %}```The `pusherable_script` tag will include the Pusher library. Place this in thehead of your page:```{% pusherable_subscribe 'update' object %}```The `pusherable_subscribe` tag will begin subscribe you to the channel for theobject. The first argument is the type of event you want to subscribe to.The default events are `update` and `view`.When a new event is received it will pass event type and data to a Javascriptfunction called `pusherable_notify`. Create this function and use it to alert yourusers to the new event. For example:```html<script>function pusherable_notify(event, data) {alert(data.user + "has begun to " + event + " " + data.model);}</script>```## Running TestsPusherable comes with test requirements and a test runner:```bashpip install -r requirements-test.txtpython runtests.py```## Creditsdjango-pusherable was built by [Aaron Bassett](https://twitter.com/aaronbassett) for Pusher.