Saravanan666/pypi-org huggingface dataset:
Package: django-sharding
Django Sharding is a library and part-framework for sharding Django applications.Note: Does not support Django 1.10.3 due to abug in the release.It helps you to scale your applications by sharding your data across multiple databases in a consistent way.What is Sharding?Sharding is a way of horizontally partitioning your data by storing different rows of the same table in multiple tables across multiple databases. This helps to increase the number of connections to a given resource as well as improves read performance of your application.Read The DocumentationFor information about how to setup sharding in your application,read the documentation.Developer ExperienceI wrote this library after working on this problem forWaveand not being able to find a library that suited our needs. What we were looking for was something that was powerful, extensible and customizable. This library was created for just that purpose and includes at least one implementation of each part of the pipeline with room to replace any individual components.InfluencesThe package was influenced by my experiences at Wave as well as the help and code of my co-workers.InstallationCheck out theinstallation sectionof the docs for basic package setup.Basis Setup & UsageSharding by UserSelect a model to shard by and open up the models.py file. Here we’ll use the user model:fromdjango.contrib.auth.modelsimportAbstractUserfromdjango_sharding_library.decoratorsimportshard_storage_configfromdjango_sharding_library.modelsimportShardedByMixin@shard_storage_config()classUser(AbstractUser,ShardedByMixin):passAdd that custom User to your settings file using the string class path:AUTH_USER_MODEL='<app_with_user_model>.User'Create Your First Sharded ModelDefine your new model, eg:fromdjango.dbimportmodelsfromdjango_sharding_library.decoratorsimportmodel_configfromdjango_sharding_library.fieldsimportTableShardedIDFieldfromdjango_sharding_library.modelsimportTableStrategyModel@model_config(database='default')classShardedCarIDs(TableStrategyModel):pass@model_config(sharded=True)classCar(models.Model):id=TableShardedIDField(primary_key=True,source_table_name='app.ShardedCarIDs')ignition_type=models.CharField(max_length=120)company=models.ForeignKey('companies.Company')defget_shard(self):returnself.company.user.shardRunning migrationsRun them as normal, for example:./manage.py makemigrations <app_name>

# To let django run the migrations in all the right places.
./manage.py migrate <app>

# To specify the database to run it on
./manage.py migrate <app> --database=<database_alias>Acccessing sharded data# TODO: Update this with methods.shard=User.shardCar.objects.using(shard).get(id=123)
Package: django-shareable
Provides tempatetags for ‘Tweet This’ and ‘Share this on Facebook’.A fork of django-social-share by Flavio Curella.Installation$ pip install django-shareableAdd the app toINSTALLED_APPS:INSTALLED_APPS += ['django_shareable']It’s recommended to adddjango.core.context_processors.requestto your `` TEMPLATE_CONTEXT_PROCESSORS`` list. This way the templatetags will use the correct scheme and hostname.Ifdjango.core.context_processors.requestis not present, it will simply concatenate the current site’s domain (fromdjango.contrib.sites) and the object’s relative URL together.Usage{% post_to_facebook <object_or_url> <link_text> %}

{% post_to_twitter <text_to_post> <object_or_url> <link_text> %}<text_to_post>may contain any valid Django Template code. Note that Facebook does not support this anymore.<object_or_url>is optional. If you pass a django model instance, it will use itsget_absolute_urlmethod. Additionally, if you havedjango_bitlyinstalled, it will use its shortUrl on Twitter.<link_text>is also optional. It defines the text used for theaelement. Defaults to ‘Post to Facebook’ and ‘Post to Twitter’{% post_to_twitter_url <text_to_post> <object_or_url> %}Will add atweet_urlvariable to the context, containing the URL for the Twitter sharer popup.{% post_to_facebook_url <object_or_url> %}Will add afacebook_urlvariable to the context, containing the URL for the Facebook sharer popup.Example:{% load social_share %}

{% post_to_facebook object_or_url "Post to Facebook!" %}
{% post_to_twitter "New Song: {{object.title}}. Check it out!" object_or_url "Post to Twitter" %}Templates are indjango_shareable/templatetags/post_to_twitter.htmlanddjango_shareable/templatetags/post_to_facebook.html. You can override them to suit your mileage.
Package: django-shared
Table of ContentsChangelogUsageContentsUtils for django-configurationsModule utilsManagement CommandsTemplate TagsThis reusable app contains functionality I use across my projects. Feel free to use and expand.The package is also on PyPI:https://pypi.python.org/pypi/django-shared/Changelog0.0.1initial releaseUsageAdd to yourINSTALLED_APPSsetting:INSTALLED_APPS=[...'shared',]ContentsUtils for django-configurationsshared.configurations.ExternalCredentialsMixin for a Configuration class of django-configurations. Enables one to load specific variables from <myproject>/configs/<DJANGO_CONFIGURATION>.py.
Good to separate critical information from the settings itself.Usually you do not check the configs into your code versioning system!Usage example:# in settings.py (following the default django-configurations setup)classCommon(Configurations):DATABASES={'default':ExternalCredentials.get_credentials_module().DATABASE,}# in <myproject>/configs/<DJANGO_CONFIGURATION>.py; e.g. sampleproject/configs/Dev.pyDATABASE={'ENGINE':'django.db.backends.postgresql_psycopg2','NAME':'db_name','USER':'db_user','PASSWORD':'db_password',}Module utilsfunction list_remove_duplicates(seq, idfun=None)Removes duplicates from a list. To preserve the list order, specify a function for the list ids asidfun.Management Commandspython manage.py settings <SOMESETTING>Print the given setting value usingpprint.Template Tagscopyrightscontainscopyright_yearsdisplays are year span fromsettings.COPYRIGHT_YEAR_START(default: 2012) until now, e.g.2012 - 2014
Package: django-shareddb
This proxy database backend is designed to speed up multi-threaded testing setups.It enables those setups (for instance usingLiveServerTestCase) to use Django’s
standardTestCase- where each test runs in its own transaction -
instead of the much slowerTransactionTestCasethat needs to flush the whole
database between each tests.It isNOTintended for production use, only for faster testing setups.This project support Django versions 1.6, and Python 2.7, 3.2 and 3.3.SetupFirst, install django-shareddb:$ pip install django-shareddbThen, simply update your settings to use its wrapping engine:DATABASES={'default':{'ENGINE':'shareddb.backends.shareddb','INNER_ENGINE':'django.db.backends.postgresql_psycopg2','NAME':'test-dbsharing',}}Since altering those settings is very frequent, django-shareddb also provides
a simplepatch_databasesfunction:DATABASES={'default':{'ENGINE':'django.db.backends.postgresql_psycopg2','NAME':'test-dbsharing',}}ifos.environ['FAST_TESTS']:importshareddbDATABASES=shareddb.patch_databases(DATABASES)Notepatch_databasesaccepts two keyword arguments,whitelist(only alter databases from that list) andblacklist(never alter databases from that list).Theblacklisthas priority over thewhitelist.Once the settings are ready, simply replace your calls to Django’s LiveServerTestCase with the django-shareddb variant:fromshareddbimporttestcasesclassMyTests(testcases.LiveServerTestCase):deftest_something(self):# Your test hereThe django-shareddbLiveServerTestCaseis simply a clone of Django’s version,
but usesdjango.test.TestCaseinstead ofdjango.test.TransactionTestCase.LinksThe code of this project is available on GitHub:https://github.com/rbarrois/django-shareddbIt is available on PyPI:https://pypi.python.org/pypi/django-shareddbIssues, questions, and new features should be opened on GitHub:https://github.com/rbarrois/django-shareddb/issuesTestingThis libraries has been succesfully tested with sqlite and postgresql.If you want to test it with other databases, please clone it and alterdev/settings.pyfor your setup, then run./manage.py test.
Package: django-shared-schema-tenants
A lib to help in the creation applications with shared schema without sufferingDocumentationThe full documentation is athttps://django-shared-schema-tenants.readthedocs.io.QuickstartInstall Django Shared Schema Tenants:pip install django-shared-schema-tenantsAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(...'shared_schema_tenants.apps.SharedSchemaTenantsConfig',...)Add Django Shared Schema Tenants’s URL patterns:fromshared_schema_tenantsimporturlsasshared_schema_tenants_urlsurlpatterns=[...url(r'^',include(shared_schema_tenants_urls)),...]Add TenantMiddleware to yourMIDDLEWARES:MIDDLEWARES=[# ...'shared_schema_tenants.middleware.TenantMiddleware',# ...]FeaturesTenants synced with django requests:The active tenant can be extracted from the domain of the request and from a specific http header attribute.Easy data isolation between tenants:You retrieve and create data the same way you do without tenants. The active tenant can be retrieved from the request, and can also be forcedly set.Partially shared data:If there is data that can be accessed from more then one tenant in your applidation, you don’t need to duplicate it.Running TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ toxCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.0 (2017-08-10)First release on PyPI.
Package: django-share-me-share-me
django-share-me-share-me=======================Model and front end library for choosing and integrating social media share widgets, similar to AddThis.#Install```pip install django-share-me-share-me```#CMS Usage:To make social settings administerable, include social_share_settings and rake the database:```python#settings.pyINSTALLED_APPS = (...'share_me_share_me',...)``````> python manage.py schemamigration share_me_share_me --initial> python manage.py migrate share_me_share_me```To make track social shares:```python#urls.py(r'^', include('share_me_share_me.urls')),```#Template Usage:To output share icons based on the settings from the cms, use the"social_share_settings_tags" template tags. In this case I'm using"Font Awesome" to render the icons.```#social-share-partial.html{% load share_me_share_me_tags %}{% get_social_share_links as social_links %}{% if social_links|length > 0 %}<ul class="social sticky">{% for link in social_links %}{% get_social_share_link link object.get_absolute_url object.title as link_url %}<li><a href="{{ link_url }}" target="_blank"><i class="fa fa-{{link.font_awesome_class}}"></i></a></li>{% endfor %}</ul>{% endif %}```#Sticky UsageFor sticky behavior, include or compile in the styles and javscript.See screencast of sticky widget in action: http://screencast.com/t/Gm8Sah4IMQ```html#base-template.html<!-- Include Font Awesome  for easier social icons --><link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" /><!-- Include js plugin and css or compile into your source js --><link rel="stylesheet" href="{% static 'ccl/sticky.min.css' %}"/><script src="{% static 'js/sticky.jqueryplugin.js'%}"></script><script>$(".sticky").sticky({topSelector : "#main",bottomSelector : "#footer",fixedMargin : 160,topMargin : 0,bottomMargin : 0});</script>```*topSelector* is the selector for the item the sticky widget should top-align with.*bottomSelector* is the selector for the item the sticky widget should not go below.*topMargin* refers to the top margin the sticky item will have when aligned to the top selector item![topMargin example](/../master/docs/screenshots/top_margin.png?raw=true "topMargin example")*fixedMargin* refers to the top margin the sticky item will have when the screen has scrolled past the top selector item![fixedMargin example](/../master/docs/screenshots/fixed_margin.png?raw=true "fixedMargin example")*bottomMargin* refers to the bottom margin the sticky item will have when aligned to the bottom selector item![bottomMargin example](/../master/docs/screenshots/bottom_margin.png?raw=true "bottomMargin example")
Package: django-sharepoint-auth
Django SharePoint Auth======================*Django SharePoint Auth* allows you to authenticate using your **managed** or **federated** Active Directory credentials.Installation------------Run `pip install django-sharepoint-auth`Add the `ActiveDirectoryBackend` to your `AUTHENTICATION_BACKENDS` setting:```pythonAUTHENTICATION_BACKENDS = (...'sharepoint_auth.auth.ActiveDirectoryBackend',)```Settings--------###AD_USER_CREATION**default:** `True`Allow creation of new users after successful authentication.###AD_DOMAIN_WHITELIST**default:** `None`Either `None` meaning allow all or a list of domains that can authenticate through Active Directory.###AD_DOMAIN_BLACKLIST**default:** `[]`A list of domain that will be block from authenticating through Active Directory.
Package: django-shares
NOTE: This is not stable yet and will likely change!  Please don’t use in production until the 1.0 release.django-sharingdjango-sharing is a python sharing module written for django that handles object sharing.  Don’t clone.  Not stable.ExampleBasic example:from django.contrib.contenttypes import generic
from django.db import models
from django_sharing.models import Share

class Car(models.Model):
    """A model that will be shared."""
    # Add the reverse relation since the shared object is a generic object.
    shares = generic.GenericRelation(Share)Extending the sharing model:from django.contrib.contenttypes import generic
from django.db import models
from django_sharing.models import AbstractShare

class CarShare(AbstractShare):
    """Extending the share model to add additional attributes."""
    day = models.CharField(max_length=50)

class Car(models.Model):
    """A model that will be shared."""
    # Add the reverse relation since the shared object is a generic object.
    shares = generic.GenericRelation(CarShare)Running TestsFrom the tests directory where the manage.py file is, run the following command:python manage.py test
Package: django-sharing
Django SharingDjango row level sharing app limiting content access by user in Django admin.FeaturesProvides admin view, change and delete permissions, restricting content access and limiting available actions per user.FiltersForeignKeyfields by view permissions.FiltersManyToManyFieldfields by view permissions.Automatically enables sharing on all admin classes (optional).InstallationInstall or add django-sharing to your python path.Add'sharing'to the project’sINSTALLED_APPSsetting.Add'sharing.backends.SharingBackend'to the project’sAUTHENTICATION_BACKENDSsetting.UsageIn order for django-sharing to limit content access your various admin classes need to include theShareAdminMixinclass. For example:# admin.py
from django.contrib import admin
from sharing.admin import ShareAdminMixin

class ArticleAdmin(ShareAdminMixin, admin.ModelAdmin):
    pass

admin.site.register(Article, ArticleAdmin)It is crucial forShareAdminMixinto be the first ancestor class in the admin class’ definition.Alternatively you can automatically enable sharing for all models registered with the admin site. django-sharing includes anadmin_mixin_sharemethod which will apply theShareAdminMixinclass to all models registered with the admin site. Call the methodafteradmin.autodiscover()in urls.py:# urls.py
from django.conf.urls.defaults import *
from django.contrib import admin

import sharing

admin.autodiscover()
sharing.admin_mixin_share()

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
)Once theShareAdminMixinclass has been applied your admin change views should includeGroupandUsershare inlines and restrict content appropriately.AuthorsPraekelt FoundationShaun SephtonChangelog0.0.2Resolved class name issue on save_model.0.0.1Initial release.
Package: django_shark
The Shark framework is a framework that allows for creating MVPs super fast. Django is great for creating models and views,
but you still have to write your own html and css. In Shark there’s no need for this. You define in your view what you want
to see and it gets rendered using Bootstrap and all html, css and javascript is generated for you.More info athttp://getshark.org/If you’re interested, drop me a line:b@rtje.net
Package: django-shawty
django\_shawty=============This is an implementation in Django for Shawty webserver integration.  This is a very simpleDjango app that adds a single new model that can work with the Shawty Webserver calledShawtyURL.  This model contains classmethods that allow you to communicate with Shawty andstore/retrieve short URLs.## PREREQSdjango\_shawty requires the following packages to be installed:[South](http://south.aeracode.org/)[Requests](http://docs.python-requests.org/en/latest/)## INSTALLINGYou can install django\_shawty simply by running a "pip install django-shawty" and adding'shawty' to your INSTALLED\_APPS. Then you can run the south migrations to initialize the modelsin your database.## CONFIGdjango\_shawty has a set of configurations that you can use to define how to interact with theShawty webserver.SHAWTY\_REQUEST\_URL (string)- The URL of the Shawty server in the form of http://www.shawty.comSHAWTY\_USE\_DB (bool) - Determine whether or not django\_shawty shouldstore the shoretened URLs in the DBSHAWTY\_USE\_CACHING (bool) - Determine whether or not django\_shawty should store/retreive shorturls from a cache backendSHAWTY\_CACHE\_EXPIRE (int) - The time (in seconds) after which the cache for the URL should expire## ExampleTo get a new short URL for a set of links, simply invoke the ShawtyURL classmethod "get\_short\_urls"passing a python list of links.  For example:from shawty.models import ShawtyURLlinks = [link1, link2, link3]shortenedlinks = ShawtyURL.get\_short\_urls(links)print shortened\_links> {link1:shortlink1, link2:shortlink2, link3:shortlink3}
Package: django-sheets
Use Google Sheets as context variables in Django templatesUsageIn your template:{% load sheets %}
{% csv "1uPsdcGUnUsf3d2xGHRGUUb7_k5IQPtBvfQY61u8Z8wE" as data %}
<table>
    <thead>
        <tr>
        {% for header in data.headers %}
            <th>{{ header }}</th>
        {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in data.rows %}
        <tr>
            {% for cell in row %}
                <td>{{ cell }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
    </tbody>
</table>View the output, you should seeOrigin (English)Name (English)Origin (Native)Name (Native)AustraliaNicole KidmanAustraliaNicole KidmanAustriaJohann StraussÖsterreichJohann StraußBelgium (Flemish)Rene MagritteBelgiëRené MagritteBelgium (French)Rene MagritteBelgiqueRené MagritteBelgium (German)Rene MagritteBelgienRené MagritteDocumentationDocumentation is available athttps://django-sheets.readthedocs.org.History0.1.2 (2014-24-03)Added gid parameter for multi-sheet documents0.1.1 (2014-22-01)Added .headers and .rows methods (aliases for [0] and [1:])0.1.0 (2014-18-01)First release on PyPI.
Package: django-shell
Django Shell FunctionsInstallationpip install django-shellUsagefrom django_shell import reset_pwd
# def reset_pwd(password='1q2w3e4r5t6y7u8i9o0p', username='admin')
reset_pwd()
reset_pwd('1q2w3e4r5t6y7u8i9o0p')
reset_pwd('1q2w3e4r5t6y7u8i9o0p', 'admin')
Package: django-shell-ipynb
This Django app adds one shell command,shell_ipynb, which starts up
the IPython Notebook as your Django shell instead of the default. The
IPython Notebook has several advantages, including that you can save a
whole experimentation session as a reusable notebook, and HTML-based
completion and code documentation.InstallationThe easiest way to installdjango-shell-ipynbis to usepip.
Either do this from pypi:pip install django-shell-ipynbOr directly from github:pip install git+git://github.com/cpbotha/django-shell-ipynb.gitAfter successful installation, adddjango_shell_ipynbto your Django
project’sINSTALLED_APPS.After having done this, you can start up the IPython Notebook Django
shell with:python manage.py shell_ipynbAt which point your browser should start up with the IPython Dashboard,
from which you can create new or edit existing notebooks.AlternativesYou can get the same behaviour with theshell_plusmanagement
command added bydjango-extensionsapp, which
comes with a whole bunch of other management commands you might want or
not want.After releasing 0.2.0, I also discovereddjango_ipython_notebook. However, that
one internally uses the deprecateddjango.core.management.setup_environ()function hardcoded forsettings, and executes ipython usingos.system(), both of which
are not ideal.
Package: django-shellng
A management command to start a shell and auto-import all models. Unlike django command extensions shell_plus it doesn’t print out a load of gunk to the shell. Provides a mechanism so that you can add in extra imports that are specific to your project.Install:$ pip install django-shellngAdd into installed apps:INSTALLED_APPS += ('shellng',)Usage:$ ./manage.py shellngTo import more things add a file containing a methodshellngand assign that
in settings. For example, make a file in the root of your Django project (or
somewhere importable) called:shellng_local.pyIn it, place the following:def shellng(imported_objects):
    modules = ('urllib',)  # This will add in urllib.
    for mod in modules:
        imported_objects[mod] = __import__(mod)imported_objectsis a dictionary of all modules to be imported. You can add
or remove to it as you want in the methods. Finally add in tosettings.py:SHELLNG_METHODS = ('shellng_local',)
Package: django-shell-plus
django-shell+=================A management command to start a shell, and auto-import all models, and the datetime module.Usage::$ django-admin.py shell+or::$ ./manage.py shell+Also included: a command to update permissions.$ django-admin.py update_permissionsInstallation::$ pip install django-shell-plusAnd then add `shell_plus` to your `settings.INSTALLED_APPS`.Changelog---------1.1.7~~~~~Make update_permissions use new app-loading API.1.1.6~~~~Use the new (!) app-loading from django. Remove code that uses deprecated APIs.1.1.5~~~~~Import `cache` from `django.core.cache`, and `reverse`,`resolve` from `django.core.urlresolvers`, because I often fire up a shell, just to do this to check something.
Package: django-shells
Better shells for yourmanage.py.DocumentationThe full documentation is athttps://django-shells.readthedocs.org.QuickstartInstall django-shells:pip install django-shellsThen add'shells'to yourINSTALLED_APPS.FeaturesTODOCreditsTools used in rendering this package:Cookiecuttercookiecutter-pypackageHistory0.1.0 (2015-11-27)First release on PyPI.Support for ptpython, ptipython, pgcli, and mycli implemented.
Package: django-shibboleth-eds
# django-shibboleth-edsapp to embed [shibboleth embedded discovery service (eds)][1] into a django project.# install1. Install the app (i.e. by using pip)2. add it to `INSTALLED_APPS`:```pythonINSTALLED_APPS += ('shibboleth_eds',)```3. Add it to `urls.py`:```pythonurlpatterns += [url(r'^ds/', include('shibboleth_eds.urls', namespace='shibboleth_eds')),]```4. Run `manage.py collectstatic`.# configureAdjust the template `discovery.html` to fit into your project. Modify the settings found in `views.py` according to your needs.[1]: http://shibboleth.net/products/embedded-discovery-service.html "Shibboleth Embedded Discovery Service"