Saravanan666/pypi-org huggingface dataset:
Package: cubicweb-mercurial-server
Summarymercurial server integration cubeSimple setupThis is the simplest setup, with mercurial-server and the Cubicweb
application running on the same server.get and install mercurial-server:apt-get install mercurial-serverOr from sources:hg clone http://hg.opensource.lshift.net/mercurial-server
# remove installdoc from installfiles target of Makefile, then run (as root):
# (files go to /etc/mercurial-server and /var/lib/mercurial-server)
# (command line for debian-like systems, for redhat like, see official doc).
make setup-adduserOfficial documentation can be found athttp://www.lshift.net/mercurial-server.htmland in the README file in the mercurial-server sources.login as the user running the Cubicweb app with the mercurial_server cube;
make sure this user has a rsa ssh key in ~/.ssh/id_rsa.pub and run:sudo mkdir -p /etc/mercurial-server/keys/root/$USER
sudo cp ~/.ssh/id_rsa.pub /etc/mercurial-server/keys/root/$USER
sudo -u hg /usr/local/share/mercurial-server/refresh-authBasic usageThe user running the Cubicweb instance must have the SSH key registered in
mercurial-server configuration (see above) unlocked and available through an
SSH agent.Run and connect to the web interface, and add a new mercurial-server repository.You can clone it immediately, start coding and push it back to the server.Your changes are integrated into the CW application on a regular basis through a
vcsfile cube recurring task (see [VCSFILE] check-revision-interval setting in
your all-in-one.conf).Permission levelsThe ‘deny’, ‘read’ and ‘write’ permission levels are supported by all versions
of mercurial-server.  The ‘publish’ permission level is added byhttps://bitbucket.org/lshift/mercurial-server/pull-request/2/add-support-for-phases.
Package: cubicweb-ner
Summary-------Cube for named entities source and recognition (NER).This cube provides:- the notion of NerSource (i.e. Named Entities Source), e.g. dbpedia or dbpedia-en (forDbpedia in english).- the notion of NerEntry, which is a token/word/entry that could be recognized.Basically it requires a "label" and a "cwuri", but an "unormalize_label"could be given for quicker match, a "weight" for disambiguation ora "lang" for sorting. It should be related to a NerSource.- the notion of NerProcess, which is an entity type that stores the parametersfor a Named Entities Recognition: a "name", an "host" (appid or url of a sparql endpoint),a request (RQL or SPARQL, with the "token" key for substitution), a type ('rql' or 'sparql')for now, and a lang (for sorting).Basically a lexic could be defined (NerSource), that contains entries (NerEntry).Thus processes (NerProcess) could be defined in other applications to retrieve these entriesin some content.Installation------------Creation of the instance:* Create an instance using: cubicweb-ctl create ner <name-of-instance>* Create the instance's database using: cubicweb-ctl db-create <name-of-instance>Creating entities-----------------For creating a NerSource (in a cw shell):session.create_entity('NerSource', name=<name of the source>)E.g.:session.create_entity('NerSource', name=u"dbpedia-38-en")For creating a simple NerEntry (in a cw shell):session.create_entity('NerEntry', label=<label of the entry>, cwuri=<uri of the entry>)E.g.:session.create_entity('NerEntry', label=u"Barack Obama", cwuri=u"http://dbpedia.org/page/Barack_Obama"ner_source=123)or :session.create_entity('NerEntry', label=u"Barack Obama", cwuri=u"http://dbpedia.org/page/Barack_Obama",ner_source=123, unormalize_label=u"barack obama", lang=u'fr', weight=1)For creating a NerProcess, probably in another application (in a cw shell):session.create_entity('NerProcess', name=<name of the process>, host=<name/url of the host>,type=<rql or sparql>, request=<rql or sparql query with %(token)s>)E.g.:session.create_entity('NerProcess', name=u'dbpedia38-en', host=u'ner',type=u'rql', lang=u'en',request=u'Any U WHERE X label %(token)s, X cwuri U, ''X ner_source NS, NS name "dbpedia38-en"')or :session.create_entity('NerProcess', name=u'dbpedia-sparql', host=u'http://dbpedia.org/sparql',type=u'sparql', lang=u'en',request=u'''SELECT ?uriWHERE{?uri rdfs:label "%(w)s"@en .?uri rdf:type ?typeFILTER(?type IN (dbpedia-owl:Agent, dbpedia-owl:Event,dbpedia-owl:MeanOfTransportation,dbpedia-owl:Place,dbpedia-owl:TopicalConcept))}''')Commands--------A command "NerImportDbpedia" exists to import the labels from a dbpedia dump:* Download the 'labels_en.nt' from Dbpedia (e.g. http://wiki.dbpedia.org/Downloads38),in the Dataset "Titles". WARNING ! You should download the NT file.* Decompress the file* Use the command:cubicweb-ctl ner-import-dbpedia <instance name> labels_en.nt --name=<name of the source>where <name of the source> could be "dbpedia38-en" for example.Adapters--------The "INamedEntitiesContentAbstract" adapter could be use to imply that an etypehas a content where Named Entities Recognition could be applied.
Package: cubicweb-nosylist
SummaryThis cube provides nosy-list “a la roundup” usable to notify users of events
they subscribed to such as content modification, state change, etc.A nosy list is an ad-hoc mailing list for entities where to which user can
register, or be automatically registered on some action.Usageto use this cube:add to your schema:CWUser interested_in X
X nosy_list CWUserwhere X are entity types considered as notification base, eg controlling
who will be notified for events related to X.configure on which relation the nosy list should be propagatedfromcubes.nosylistimporthooksasnosylist_hooks# relations where the "main" entity (eg holding the reference nosy list, so# should be in one `X` types cited above) is the subject of the relationnosylist_hooks.S_RELS|=set(('documented_by','attachment','screenshot'))# relations where the "main" entity (eg holding the reference nosy list, so# should be in one `X` types cited above) is the object of the relationnosylist_hooks.O_RELS|=set(('for_version','comments'))write hooks that add user to nosy list when desired (for instance, when a
user is adding a comment to an entity, add him to the entity’s nosy list)define your notification views / hooks, which should rely on the default
recipients finder mecanism to get notified users (automatic if you’re using
cubicweb base classes)
Package: cubicweb-notebooks
A cube to deal with Jupyter-notebooks and voici viewInstallationOpen the project in a terminal and run:pip install -e .This will install the cube in your active virtual environment
ascubicweb-notebooks.The following sections indicate additional steps when you
install this cube as a dependency or as an instance.As a dependencyIf you plan to use this cube as a dependency for your own cube,
add it to your__pkginfo__.pyas follows:__depends__ = {
    # ... Your previous dependencies
    "cubicweb-notebooks": None,
}If the target cube is already used as an instance, you need to migrate it
with the help of its python shell (replaceYOUR_INSTANCE_NAMEby your instance name):cubicweb-ctl shell YOUR_INSTANCE_NAMEIn the python prompt, enter the following command:add_cube("notebooks")PressCtrl-Dthen restart your instance.
The cube should now be available in your instance.As an instanceIf you plan to use this cube directly as an instance, create and start
your instance with the following commands (replacenotebooks-instanceby the name of your choice):cubicweb-ctl create notebooks notebooks-instance
cubicweb-ctl start -D notebooks-instanceLearn MoreVisit theofficial documentationto learn more about CubicWeb.
Package: cubicweb-oaipmh
This cube registers a Pyramid route/oaiagainst which all OAI-PMH
requests should be performed.An “admin-email” configuration option should be defined to reference the email
address of an administrator of the OAI-PMH repository.The implementation relies onselective harvestingin the sense that only
entity types registering aset specifierwill be visible through OAI-PMH
protocol.To register an entity type for OAI-PMH harvesting, one should implement
subclasses ofOAIPMHRecordAdapteradapter with a selection context and at
least a concrete definition ofset_definitionclass method. Other things
like the record view or identifier attribute are configurable through this
adapter.Seetest/datafor concrete examples of possible registrations of entity
types as OAI-PMH records.
Package: cubicweb-oauth2
SummaryOauth2/OpenID connect authentication client for cubicweb.All configuration is done inall-in-one.conf. Defaults values should work
fine with Keycloak, for other provider refer to the documentation of the
content of the JWT token.oauth2-enabledshould be set toyesonce it is configuredoauth2-client-idandoauth2-client-secretshould be set (given by the
provider).For OpenID connect providersoauth2-server-urlcan be set. For keycloak it
ishttps://<server>/auth/realms/<realm>. The configuration is then obtained
from the metadata url /.well-known/openid-configurationIf you want to avoid a request to the metadata url, or if your provider
doesn’t implement OpenID, you should to configureoauth2-authorization-url,oauth2-token-urlandoauth2-jwk-path.oauth2-token-loginis used to map a field of the JWT token with CubicWeb
login.On the provider side, the callback url should be configured tohttps://<cubicweb>/oauth2/callbackAt this point you should be able to log in an existing user through the login
page using the “Log in with Oauth2” button.If you want to automatically register new users, you must setoauth2-register-usertoyesand configureoauth2-default-group,oauth2-token-firstname,oauth2-token-surnameandoauth2-token-email.If your instance only accepts users from the Oauth2 provider, you can setoauth2-auto-loginwhich skip the login page and start oauth2 authentication
directly.If your instance require authenticated users from Oauth2 provider only, you
can setoauth2-force-logintoyes, this will redirect all unauthenticated
requests to oauth2 login.How to test this with keycloakUsing standard flow and confidential (client_id/client_secret) access.test_full_login() might be a good entry point to understand the authentication
flow.Here is how to test this with keycloak:Create a new client using urlhttp://:8080Set Access Type to “confidential” with standard flow enabledGet client_id & client_secret from the “Credentials” tabEnable the oauth2 cube to your projectIn all-in-one.conf set these parameters:oauth2-enabled=yes
oauth2-server-url=https://keycloak/auth/realms/master
oauth2-client-id=<client_id>
oauth2-client-secret=<client_secret>Start your instance, go to login page and click on “Log in with Oauth2”
Package: cubicweb-osmfrance
SummaryManipulating french regions, départements, communes, etc. polygons from
OpenStreetMap or IGN, for display on maps using leaflet.Data import from OSMShapefiles are taken fromhttp://osm13.openstreetmap.fr/~cquest/openfla/export/(also shared onhttps://www.data.gouv.fr/fr/organization/openstreetmap)Different resolution (from 5 meters to 100 meters can be used depending
on the scale of maps to display).The following example imports shapes for regions, departements,
arrondissements, epci and communes:$cubicweb/bin/cubicweb-ctlosmfrance_import_shp<myinstance>\>--regions=path/to/regions-20140306-100m-shp.zip\>--departements=path/to/departements-20140306-100m-shp.zip\>--arrondissements=path/to/arrondissements-20140306-100m-shp.zip\>--epci=path/to/epci-20140306-100m-shp.zip\>--communes=path/to/communes-20140306-100m-shp.zipData import from IGNShapefiles are taken from GEOFLA version 1.1:http://www.data.gouv.fr/en/dataset/geofla-communeshttp://www.data.gouv.fr/fr/dataset/geoflar-arrondissementshttp://www.data.gouv.fr/en/dataset/geofla-departements-30383060$cubicweb/bin/cubicweb-ctlign_import_shp<myinstance>> --departements=path/to/DEPARTEMENT.SHP \
> --arrondissements=path/to/ARRONDISSEMENT.SHP \
> --communes=path/to/COMMUNE.SHPQueries on dataThe following query returns the polygon corners (as latitude, longitude
coordinates) for Communes (cities) only:Any DISPLAY(G, 4326) LIMIT 10 WHERE X geometry G, X is CommuneThe following returns all types:Any DISPLAY(G, 4326) LIMIT 10 WHERE X geometry GDisplaying dataThe leaflet cube can be used for displaying these polygons on a map; the
CW view used for that isleaflet-geojsonFor example, the query:Any DISPLAY(G, 4326),X LIMIT 20 WHERE X geometry G, X is Departementshould display 20 departements, using X (the Departement eid) as Z
value (color value) using a yellow-red colormap.The corresponding URL using the leaflet view is:http://<server>/view?rql=Any+DISPLAY%28G%2C+4326%29%2CX+LIMIT+20+WHERE+X+geometry+G%2C+X+is+Departement&vid=leaflet-geojson
Package: cubicweb-person
Summarypersonprovides person informations :firstnamesurname / lastnamecivilityarbitrary text descriptiona relation to an email address (NB, theEmailAddressentity is
automatically provided by cubicweb).If theaddressbookcube is used, persons will also havephoneandpostal_addressrelations to store more contact information.There is a special relation called ‘primary_email’. A person can be linked to
multiple email addresses (using the ‘use_email’ relation). The primary email
must be unique. At the creation of the first email, this relation is
automatically added (though you can change it later, of course).RecommendsaddressbookcubeUsageIn addition of basic entity views, this cube provides :VCardPersonView, displays a person in the VCard file format(.. _VCard on wikipedia:http://en.wikipedia.org/wiki/VCard) .This view creates a file calledvcard.vcfwhich can be open in
your addressbook application (Kmail, Thunderbird and so on). In
order to generate this file, you have to access to a specific view
using an url address with?vid=vcardsuffix.How to personalize the person primary view in order to add a link
for the vcard ?classPersonalizedPersonPrimaryView(PersonPrimaryView):defrender_entity_attributes(self,entity):super(PersonalizedPersonPrimaryView,self).render_entity_attributes(entity)self.w(u'<div><a href="%s">export contact as vcard</a></div>'%entity.absolute_url(vid='vcard'))Thisviewwillnotbeselectedbydefault.Youhavetoregisteredthisvieworaddaselector.Formoreinformation,pleaserefertoXXXinthedoc.acivility facet, this facet (XXX: ref to facet doc) will be shown
if a view displays a result set of at least two Person entities with
different civilities.ContributingInformation on how to contribute can be found herehttps://www.logilab.org/Card/contributing
Package: cubicweb-postgis
SummaryAdd types and functions to work with geometric attributes that are stored in a
Postgis database (that is a PostgreSQL database with Postgis extension
enabled).The present cube supports only version2.0 and laterof Postgis.It introduces one new type when defining attributes in the data model schema:aGeometrytype. Additionally, you should give the following elements
along with aGeometryattribute:geom_type. The Postgis type of geometries that this attribute will
accept, for examplePOINT,MULTILINESTRINGorPOLYGON,srid. The spatial reference system the geometry coordinates will live
in. This is an integer and a foreign key that must match thesridkey
in thespatial_ref_systable. Most of the time, it will be the same as
the spatial system EPSG code,coord_dimension. The number of dimensions used by geometries. Defaults
to 2.aGeographytype (see thedescription).Then you can also use geometric functions likeST_INTERSECTS,ST_WITHINorST_UNIONto work with this new type.SeePostgis manualfor reference documentation about Postgis.ExampleInschema.py, one can declare aCityentity like the following.classCity(EntityType):name=String(required=True)geometry=Geometry(geom_type='POLYGON',srid=4326)You may then make queries like:# get all cities in a given bounding boxrql('City C WHERE C geometry G HAVING(ST_WITHIN(G, ST_MAKEENVELOPE(''%(left)s,%(bottom)s,%(right)s,%(top)s, 4326)) = TRUE)',{'left':2.2,'right':2.6,'top':49,'bottom':48})# get all cities at a given distance from a point, sorted by distancerql('Any C, ST_DISTANCE(G, ST_SETSRID(ST_MAKEPOINT(2.2, 48.4), 4326)) ''ORDERBY 5 WHERE ''C geometry G HAVING ('' ST_DWITHIN(G, ST_SETSRID(ST_MAKEPOINT(2.2, 48.4), 4326), 0.1) = TRUE)')
Package: cubicweb-preview
General descriptionPreview cube adds the ability to preview the effect of a form submission.The main idea is:submit the form data to a special controller, that will
insert / update data in the database transaction, as normalgenerate the previewrollback the database changes to leave the database unchangedThe only exceptions to this rules are downloadable entities, like images : when
an html page (as a preview example view) that contains newly created / updated
images is rendered, the actual image content is queried by users’ browser a
while after the above-mentionned database rollback was performed. The solution
adopted in this cube is to save such contents on the disk, and keep it for some
time (that can be set using the preview-time option) so that it can be previewed
and clean it up afterwards.UsageSimplest usage concerns automatic entity forms, where you generally want to
preview the just created or updated entity : in this case, import
PreviewFormMixin from cubicweb_preview.utils and make your form inherit it :
you’re done. For example, to apply it to all AutomaticEntityForm forms, use:from cubicweb.selectors import yes
from cubicweb_web.views.autoform import AutomaticEntityForm
from cubicweb_preview.views.forms import PreviewFormMixin

class PreviewAutomaticEntityForm(PreviewFormMixin, AutomaticEntityForm):
    __select__ = AutomaticEntityForm.__select__ & yes()You can of course customize the preview, using PreviewFormMixin preview_vid
and preview_rql attributes, that will be used by the controller to create a
result set (using preview_rql, if not None) and apply a view (which name is
preview_vid value, default to “index”) to it.Below is an example for a CubicWeb instance using the file and preview cubes,
that can be used to preview the list of all images when you add or edit one :
we request all images through the preview_rql setting and display them using
the primary viewfrom cubicweb.selectors import is_instance
from cubicweb_web.views.autoform import AutomaticEntityForm
from cubicweb_preview.views.forms import PreviewFormMixin

class ImageForm(PreviewFormMixin, AutomaticEntityForm):
   __select__ = AutomaticEntityForm.__select__ & is_instance('Image')
   preview_vid = 'primary'
   preview_rql = 'Any X WHERE X is Image'
   preview_mode = 'inline'Note that the previously created images are stored in the database while the
previewed one is temporarily stored on disk. By default, the previewed image
will be kept for one hour on disk, which can be set using the preview-store-time
option.Thepreview_modeattribute acceptsnewtab(the default, opening
the preview in a new browser windows/tab within a custom template), orinline(will show the preview below the form).AuthorsThis cube has been written by SecondWeb S.A.S. and is now maintained
and developped by Logilab S.A.LicenseThis cube is distributed under the LGPL-2 license.
Package: cubicweb-prometheus
SummaryExporting prometheus metrics.This cube provides a pyramid tween that will, when active, collect the metrics
configured in the settings pyramid.ini and expose them on route/metrics.ConfigurationInclude the metrics you want in pyramid.ini:prometheus.pyramid.http_requests = True
prometheus.pyramid.current_requests = True
prometheus.pyramid.slow_routes = True
prometheus.pyramid.time_routes = True
prometheus.pyramid.count_routes = True

prometheus.cubicweb.sql.time = Histogram
prometheus.cubicweb.rql.time = Histogram
...
Package: cubicweb-pyramid
Add the ‘pyramid’ command to cubicweb-ctl”.This cube also add aCWSessionentity type so that sessions can be
stored in the database, which allows to run a Cubicweb instance
without having to set up a session storage (like redis or memcache)
solution.However, for production systems, it is greatly advised to use such a
storage solution for the sessions.The handling of the sessions is made by pyramid (see thepyramid’s documentation on sessionsfor more details).For example, to set up a redis based session storage, you need thepyramid-redis-sessionpackage, then you must configure pyramid to
use this backend, by configuring thepyramid.inifile in the instance’s
config directory (near theall-in-one.conffile):[main]cubicweb.defaults=no# we do not want to load the default cw session handlingcubicweb.auth.authtkt.session.secret=<secret1>cubicweb.auth.authtkt.persistent.secret=<secret2>cubicweb.auth.authtkt.session.secure=yescubicweb.auth.authtkt.persistent.secure=yesredis.sessions.secret=<secret3>redis.sessions.prefix=<my-app>:redis.sessions.url=redis://localhost:6379/0pyramid.includes=pyramid_redis_sessionspyramid_cubicweb.authpyramid_cubicweb.loginSee the documentation ofPyramid Cubicwebfor more details.WarningIf you want to be able to log in a CubicWeb application
served by pyramid on a unsecured stream (typically when
you start an instance in dev mode using a simplecubicweb-ctlpyramid-D-linfomyinstance), youmustsetcubicweb.auth.authtkt.session.securetono.SecretsThere are a number of secrets to configure inpyramid.ini. They
should be different one from each other, as explained inPyramid’s
documentation.For the record:cubicweb.session.secret:This secret is used to encrypt the session’s
data ID (data themselved are stored in the backend, database or
redis) when using the integrated (CWSessionbased) session data
storage.redis.session.secret:This secret is used to encrypt the session’s
data ID (data themselved are stored in the backend, database or
redis) when using redis as backend.cubicweb.auth.authtkt.session.secret:This secret is used to encrypt
the authentication cookie.cubicweb.auth.authtkt.persistent.secret:This secret is used to
encrypt the persistent authentication cookie.
Package: cubicweb-registration
This CubicWeb component provides a public registration feature (users
can register and create an account without the need for admin
intervention).To activate the user registration feature in your CubicWeb
application, just add this cube in your instance ; either depend on it
in your cube’s __pkginfo__ or run theadd_cudecommand in a
CubicWeb shell:$ cubicwebctl shell youapp
entering the migration python shell
just type migration commands or arbitrary python code and type ENTER to execute it
type "exit" or Ctrl-D to quit the shell and resume operation
>>> add_cube('registration')
>>> ^DThen add or modify theregistration-cypher-seedconfiguration
option in your application’sall-in-one.conffile:[REGISTRATION]# seed used to cypher registration data in confirmation email link
registration-cypher-seed=<change me>