Saravanan666/pypi-org huggingface dataset:
Package: cubicweb-ckanpublish
SummaryThis cube enables data publishing to a CKAN opendata portal.ConfigurationThe cube essentially provides hooks to push data in a CKAN instance. The
mapping from CubicWeb entities is handled by adapters which themselves rely on
dedicated attributes on the entities:ICKANDatasetadapter relies on ackan_dataset_idattribute on the
adapted entity. As its name suggests, the latter is used to relate a
CubicWeb entity to a CKAN dataset (the fundamental entity type in CKAN
data model).ICKANResourceadapter relies on ackan_resource_idattribute. It
is used to related some CubicWeb entity type to a CKAN resource.The push of a resource on CKAN instance should be triggered by the
addition of a relation between the dataset-like entity and a resource-like
entity in CubicWeb. This is handled by theLinkResourceToDatasetHookhook,
which is abstract and should thus subclass by setting itsrtypeattribute.Seetest/datafor a minimal example.TestingTesting this cube requires a running CKAN instance with a (dedicated)
organization and a user with editors permission in the organization.
Corresponding information are expected in thetest/ckanconfig.pyfile.baseurl = '<url-of-ckan-instance>'
organization = '<organization-name>'
apikey  = '<api-key-of-user-with-editors-permissions-on-organization>'Note that, since CKAN does not expose an API function to purge datasets, we
can onlydeletethem in tests. So, one has to manually purge test datasets
from the CKAN at<baseurl>/ckan-admin/trash.
Package: cubicweb-comment
SummaryThecommentcube provides threadable comments feature.It is a CubicWeb component. CubicWeb is a semantic web application
framework, seehttp://www.cubicweb.orgInstallAuto-install from sources prefered withpip/Distribute:pip install cubicweb-commentIf you have troubles, useeasy_install/setuptoolsand eggs:easy_install cubicweb-commentYou can install the package manually from the uncompressedtarball:python setup.py install # auto-install dependenciesIf you don’t want the dependancies to be installed automaticly, you
can force the setup to use the standard librarydistutils:NO_SETUPTOOLS=1 python setup.py installMore details athttp://www.cubicweb.org/doc/en/admin/setupUsageThis cube creates a new entity type calledCommentwhich could basically be
read by every body but only added by application’s users.
It also defines a relationcommentswhich provides the ability to add aCommentwhichcommentsaComment.To use this cube, you want to add the relationcommentson the entity type
you want to be able to comment. For instance, let’s say your cube defines a
schema for a blog. You want all the blog entries to be commentable.
Here is how to define it in your schema:fromyams.buildobjsimportRelationDefinitionclasscomments(RelationDefinition):subject='Comment'object='BlogEntry'cardinality='1*'Once this relation is defined, you can post comments and view threadable
comments automatically on blog entry’s primary view.DocumentationLook in thedoc/subdirectory or readhttp://www.cubicweb.org/doc/en/
Package: cubicweb-datacat
Data catalog implementing a (partial) DCAT model. As described in theDCAT
W3C recommendation, “a data catalog conforms to DCAT if:It is organized into datasets and distributions.An RDF description of the catalog itself and its datasets and
distributions is available.The contents of all metadata fields that are held in the catalog, and
that contain data about the catalog itself and its dataset and
distributions, are included in this RDF description, expressed using the
appropriate classes and properties from DCAT, except where no such class
or property exists.All classes and properties defined in DCAT are used in a way consistent
with the semantics declared in this specification.DCAT-compliant catalogs MAY include additional non-DCAT metadata fields
and additional RDF data in the catalog’s RDF description.”The recommendation also defines aDCAT profilewhich “is a specification
for data catalogs that adds additional constraints to DCAT. A data catalog that
conforms to the profile also conforms to DCAT. Additional constraints in a
profile may include:A minimum set of required metadata fieldsClasses and properties for additional metadata fields not covered in DCATControlled vocabularies or URI sets as acceptable values for propertiesRequirements for specific access mechanisms (RDF syntaxes, protocols) to
the catalog’s RDF description”This implementation is mainly focused on the European UnionDCAT Application
Profile. It also offers data validation and transformation processes.
Package: cubicweb-editorjs
** Warning this cube is not intended for use in production currently **SummaryAdd editorjs format for RichString.
This cube adds the application/vnd.cubicweb.editorjs mimetype to the available
formats for RichStrings.
It also adds a widget which allows to edit the RichString using the EditorJS library (a WYSIWYG editor).Status of this projectThis project has been initiated as a POC to test integration of EditorJS in CubicWeb.Features:setting the format of a RichString to application/vnd.cubicweb.editorjsedition on analready existingRichString attribute with EditorJSrendering a RichString using this mime type in some conditions (see below)RQL plugin allowing to edit and execute RQL queriesKnown bugs:when switching to application/vnd.cubicweb.editorjs the editor is not loaded
which means that only already saved attributes can be edited with EditorJSthe rich string is not rendered when it is asynchroneously loaded (after the
page's scripts have run). This happens with CubicWeb web in tab views.the breadcrumb displays the json instead of a rendered version of the RichStringit makes automatic tests of client cubes failImplementation flaws:the implementation use monkeypatches toadd the application/vnd.cubicweb.editorjs format to the known format listoverride some viewsoverride entitiesprintable_valuemethod (might not be the best place
to add the widget)missing mttransforms for application/vnd.cubicweb.editorjs to htmlimages uploads are not supportedUsage in react applicationsReact applications don't suffer most of the problems seen above as they handle the rendering themselves.
Displaying an EditorJS is as easy as:function Edit() {
  const instanceRef = React.useRef<EditorJS | null>(null);
  async function handleSave() {
    if (instanceRef.current !== null) {
      const savedData = await instanceRef.current.save();
      rqlClient.queryRows(
        `Set X content %(content)s Where X is BlogEntry, X eid ${eid}`,
        { content: JSON.stringify(savedData) }
      );
    }
  }
  return (
    <>
      <EditorJs
          instanceRef={(instance) => (instanceRef.current = instance)}
          data={JSON.parse(blogEntry.content)}
      />
      <button onClick={handleSave}>Save</button>
    </>
  )
}For rendering, a library likehttps://github.com/jeremyrajan/editorjs2htmlcan be used.if (contentFormat === "application/vnd.cubicweb.editorjs") {
    const edjsParser = EditorJsToHTML();
    const html = edjsParser.parse(JSON.parse(blogEntry.content)).join("");
    return <div dangerouslySetInnerHTML={{ __html: html }} />;
}
Package: cubicweb-elasticsearch
SummarySimple ElasticSearch indexing integration for CubicWebParameterselasticsearch-locations (CW_ELASTICSEARCH_LOCATIONS)index-name (CW_INDEX_NAME)elasticsearch-verify-certs (CW_ELASTICSEARCH_VERIFY_CERTS)elasticsearch-ssl-show-warn (CW_ELASTICSEARCH_SSL_SHOW_WARN)Pyramid debug panelTo activate the debug panel, you’ll need to installpyramid_debugtoolbar,
typically with:pip install pyramid_debugtoolbarThen, you’ll have activate the debug toolbar and include the ElasticSearch
panel in yourpyramid.ini:pyramid.includes =pyramid_debugtoolbardebugtoolbar.includes =cubicweb_elasticsearch.pviews.espanelAlltextfieldThecubicweb_elasticsearch.search_helpers.compose_searchreferencies
a customalltextfield which contains all indexed text. This field  must be
defined in the custom Indexer mapping.HTTPS and SSL certificates in communication with serverIn some cases (ElasticSearch Kubernetes deployment for example), self signed
certificates are used and can be ignored using elasticsearc-verify-certs, in
this case, the python binding will issue warnings for each request, which is
cumbersome when running requests in accplugincommand. You can useelasticsearch-ssl-show-warn (CW_ELASTICSEARCH_SSL_SHOW_WARN)to remove
those warnings (default is to show them). Most of the time, a better solution
is to have proper certificates to authenticate the servers you are talking to.
Package: cubicweb-elections
SummaryCube for elections data from data.gouv.frInstallationCreate an instance:cubicweb create elections my_instance_electionsCreate the database:cubicweb db-create my_instance_electionsDo not launch the db-initInsert postgis:psql my_instance_elections -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql my_instance_elections -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sqlFinish the db initialization:cubicweb db-init my_instance_electionsPush the osm data (see README of osmfrance cube for more details):Shapefiles are taken fromhttp://osm13.openstreetmap.fr/~cquest/openfla/export/(also shared onhttps://www.data.gouv.fr/fr/organization/openstreetmap)Launch the command:cubicweb-ctl osmfrance_import_shp my_instance_elections --regions=/path/to/osm/dataosm/regions-20140306-100m-shp.zip --departements=/path/to/osm/dataosm/departements-20140306-100m-shp.zip --arrondissements=/path/to/osm/dataosm/arrondissements-20131220-100m-shp.zip  --epci=/path/to/osm/dataosm/epci-20140306-100m-shp.zip --communes=/path/to/osm/dataosm/communes-20140306-100m-shp.zipPush the elections data:cubicweb-ctl elections-import my_instance_electionsRebuild the FTI index:cubicweb-ctl db-rebuild-fti my_instance_elections
Package: cubicweb-email
This cube models multipart email messages (EmailsandEmailPart) and
provides tools to import your mail box into a cubicweb instance.Email are automatically stored into`EmailThreads`.It also comes with a command line tool to import emails (mbox) files
in a CubicWeb instance. This tool is based oncwclientlib, so
connection credentials to the cubicweb instance should be stored in
your ~/.config/cwclientlibrc file.
Package: cubicweb-file
This cube modelsFiles(pdf document, word processor file, screenshots, etc).They are stored in the database and fulltext-indexed when possible.For image files, an adaptor is provided to generate thumbnails (which
are cached in <INSTANCEDIR>/cache/file/thumbnails by default).Please note that this thumbnail generation adaptor is not meant to be
considered as a “public API” for thumbnail generation. This is just a
simple solution waiting for a proper official API to manage such
features as arbitrary content rendering.
Package: cubicweb-folder
SummaryThefoldercube allows to create a tree of categories and classify entities
as you’re used to do in a file-system.UsageDefine the relationfiled_underin the schema, object must
contain all entities which can be classified in a folder.classmissing_filed_under(RelationDefinition):name='filed_under'subject=('ExtProject','Project','Card','File')object='Folder'TheFoldersBoxshows the folders hierarchy as a tree view. It’s not visible by
default (user can activate it using their preferences) but you can activate it
by default using the code snippet below:fromcubicweb_folder.viewsimportFoldersBox# make the folders box visible by defaultFoldersBox.visible=True
Package: cubicweb-forge
This cube provides a Forge application that supports the process of
collaborative developing software.SummaryThis cube provides a full-featured software to support the process of collaborative
developing software. This is built on thetrackercube and implements user
friendly representation of the project: you can associate to a projet some
screenshots, some attachments, a documentation page and so on.http://www.logilab.organdhttp://www.cubicweb.orgrun personalized version of
this cube.DependsYou should have the following cubes installed:cardcommentemailfilefoldermailinglisttagtestcardtrackernosylist
Package: cubicweb-forgotpwd
SummaryTheforgotpwdcube provides an easy way to generate a new password for an
user, eg the common”I forgot my password” functionnality.It is non-obstrusive and easy to plug.UsageThis cube creates a new entity calledFpasswd. This is an internal
entity: managers and users can’t read/delete or modify this kink of
entity.The workflow of password recovery is defined below :ask for a new password, the user must have a valid primary email
associated to his account.An email has been sent. This email contains a generated url associated to an
user. This link is valid during a short period. This time limit can be
configured in the all-in-one.conf file:[FORGOTPWD]revocation-limit=30# minutesIf the link is valid, the user can change his password in a new form.There is an automatic task that delete periodically all old Fpasswd which are
stored in the database. This task is started at the launching of the
application.
Package: cubicweb-frbr
SummaryCube for FRBR vocabulary (works, expressions, manifestations, …)InstallationCreation of the instance:Create an instance using: cubicweb-ctl create libraryui <name-of-instance>Create the instance’s database using: cubicweb-ctl db-create <name-of-instance>Getting databnf data:Download the rdf xml dumps of databnf fromhttp://data.bnf.fr/semanticweb.
You should take all the (rdf/xml) files.Import the rdf data:For now, the RDF dumps are splitted in ‘docrameau’, ‘editions’,
‘org_authors’, ‘person_authors’, ‘rameau’, ‘study’, ‘works’.
You should uncompress all the files in the same directory, and launch the command:cubicweb-ctl databnflite-import <name-of-instance> <path-to-rdf-directory>–rdf-format=xml –lib=librdf
Package: cubicweb-fresh
Expense tracking application built on the CubicWeb framework.Developping with dockerAssuming you have a postgresql running on your machine where you can connect
with peer authentication, run “make dev” it will spawn an interactive shell
inside a docker container with the code mounted in develop mode. It mean you
can edit the code locally and run it in the container.Some useful commands:cubicweb-ctldb-create-afreshwill create and initialize the databasecubicweb-ctlpyramid-D-linfo freshwill start the instance onhttp://localhost:8080Deploying on kubernetesThe filedeployment.yamlcontains several containers split in several
deployments:nginxto serve static files directlyfreshto run the application (and compile the latest translation)aninitContainersupgradebeforefreshthat upgrade the database schema
if there is a newfreshversion.fresh-schedulerto have the scheduler running.To create the initial database from an existing empty database:kubectl run -it fresh-dbcreate \
   --env CW_DB_HOST=db \
   --env CW_DB_USER=user \
   --env CW_DB_PASSWORD=pass \
   --env CW_DB_NAME=fresh \
   --image=hub.extranet.logilab.fr/logilab/fresh --command -- \
   cubicweb-ctl db-create --automatic --create-db=n fresh
kubectl delete deployment fresh-dbcreateThen generate a secret named “fresh” from where environment variables are set:kubectl create secret generic fresh-env \
   --from-literal CW_DB_HOST=db
   --from-literal CW_DB_USER=user \
   --from-literal CW_DB_PASSWORD=pass \
   --from-literal CW_DB_NAME=fresh \
   --from-literal CW_BASE_URL=https://fresh.example.comYou need to mount a cwclientlib configuration file to make
CWClientLibDataFeedParser. If you don’t use this feature, just create an empty
file.Create a file named cwclientlibrc and run:kubectl create secret generic fresh-cwclientlibrc --from-file=./cwclientlibrcCreate a persistent volume for bfss data:kubectl apply -f deploy/pvc.yamlThen deploy fresh with:kubectl apply -f deploy/deployment.yaml
Package: cubicweb-graphql
cubicweb-graphqlprovides aGraphQLinterface and querier for CubicWeb.Basic use in PythonOnce the CubicWeb instance has been launched, GraphQL queries can be executed using:from cubicweb_graphql.querier import GraphQLQuerier

query = "query getAffaire($affaire_eid: ID) { Affaire(eid: $affaire_eid) { sujet } }"
result = GraphQLQuerier.execute(connection, query, affaire_eid=self.affaire1)Access from the Web APIThe GraphQL querier can be access through the Web API:curl "http://localhost:8080/ajax" \
        -d "fname=graphql" \
        -d "query=$QUERY" \.TestingTests can be run using:python -m unittest discover -s testfrom top-level directory.
Package: cubicweb-i18nfield
SummaryThis cube provides a way to manage and display entity field (attribute)
translations, stored in the application database.To achieve this for your particular entity type, you have to:add an ‘i18nfield_of’ relation definition, linking from the ‘I18nField’
entity type to your translatable entity type(s)add a ‘ref_lang’ relation definition, linking from your entity types
to the ‘I18nLang’ entity typemake your business entity type inherit the ‘TranslatableEntityMixin’ and
list its translatable fields in its ‘i18nfields’ attributecreate a simple adapter that inherits ‘_TranslatableEntityAdapter’ and is
selectable for your translatable entity typesThat’s all for the code part. Just add at least one I18nLang instance in your
database and link your translatable entities to their reference language.The default web UI will then display a new ‘translations’ action menu to
users who can modify translatable entities, and display your translatable
entities in the web request language by default.ExampleIf you want to translate all fields of the Card entity type (from the ‘card’
cube), you will need in your schema.py file:from yams.buildobjs import RelationDefinition


class i18nfield_of(RelationDefinition):
    subject = 'I18nField'
    object = 'Card'
    cardinality = '1*'
    composite = 'object'


class ref_lang(RelationDefinition):
    subject = 'Card'
    object = 'I18nLang'
    cardinality = '1*'
    inlined = TrueAnd in the entities.py file:from cubicweb.predicates import is_instance

from cubicweb_card.entities import Card as OrigCard
from cubicweb_i18nfield.entities import (TranslatableEntityMixin,
                                      _TranslatableEntityAdapter)


class Card(TranslatableEntityMixin, OrigCard):
    i18nfields = (u'title', u'synopsis', u'content')

    def dc_title(self):
        return self.printable_value('title', format='text/plain')


class MyTranslatableEntityAdapter(_TranslatableEntityAdapter):
    __select__ = _TranslatableEntityAdapter.__select__ & is_instance('Card')Run testsIn a virtualenv:` python2-mtox `
Package: cubicweb-jsonb
Add a new attribue type to CubicWeb:Jsonb. This type is mapped to thejsonb PostgreSQL data type.DeclarationIn your schemas, you can use the new type as follow:>>> class MyEntityType(EntityType):
...     json_attribute = Jsonb(required=True)
...Get/SetTo provide a value for a Jsonb attribute, you can use either:a dict,a JSON string.For example, you can write the following code:>>> my_entity.cw_set(json_attribute={'a': [1, 2, 3]})The code below wil have exactly the same effect:>>> my_entity.cw_set(json_attribute=u'{"a": [1, 2, 3]}')Please note that, whatever way you set the value (string or dict), you will
always get back a dict when asking for it:>>> my_entity.json_attribute
{u'a': [1, 2, 3]}QueryingIn RQL, you can query a Jsonb attribute in multiple ways. For example, you can
ask for attributes containing a specific key/value pair:>>> import json
>>> rql('Any X WHERE X json_attribute J HAVING JSONB_CONTAINS(J, %(json_value)s)=True',
        {'json_value': json.dumps({u'a': 1})})You can ask for existence of a specific key:>>> rql('Any X WHERE X json_attribute J HAVING JSONB_EXISTS(J, %(key)s)=True',
        {'key': u'b'})You can get the value for a key:>>> rql('Any JSONB_GET(J, %(key)s) WHERE X json_attribute J, X eid %(eid)s',
        {'key': u'a', 'eid': 1234})Note:JSONB_GET()willalwaysreturn a string. If the value is a JSON
object (or a JSON array), you may want to usejson.loads()afterwards to
have a dict (or a list).One final remark: as the PostgreSQL documentation suggests, you should use the
same structure for your JSON data in the same column. This makes querying much
easier.
Package: cubicweb-jsonschema
cubicweb-jsonschemacubicweb-jsonschemaprovides mappings from CubicWeb entities toJSON Schemadocuments as well as an HTTP API based on theJSON Hyper-Schemaspecification.Documentation is available athttps://cubicweb-jsonschema.readthedocs.io/TestingTests can be run using:python -m unittest discover -s testfrom top-level directory after having installed test dependencies from filetest-requirements.txt.Some tests make use of theajvprogram (more specificallyajv-cli) to
validate JSON Schema response against meta schema. This can be installed usingnpmand should be in$PATHwhen running tests. If not available
validation would not occur.
Package: cubicweb-keyword
Thekeywordcube provides classification by using hierarchies of keywords to
classify content.Each classification is represented using aClassificationentity, which will
hold a keywords tree.There is two types of keywords:Keywordwhich contains a description,CodeKeywordwhich contains the keyword description and the associated code.In order to link an entity to a keyword, you have to add a relationapplied_toin the schema.Each keyword has thesubkeyword_ofrelation definition. This allows to
navigate in the classification without a Modified Preorder Tree Traversal
representation of the data.Some methods are defined in order to get parents and children or get the status
of a keyword (leaf or root).See alsocubicweb-tagas another (simpler) way to classify content.
Package: cubicweb-mandrill
Mandrill Integration cubeprovides 2 main features :Hijack the existing functions that call config.sendmailsIn these functions, a “sendmails” service is called instead ofconfig.sendmails, this service being provided by the mandrill cube.https://www.cubicweb.org/ticket/3797393proposes to replace
config.sendmails by a service in the core.Provide an improved NotificationViewMandrill provides a template api :https://mandrillapp.com/api/docs/messages.python.html#method=send-templateThe MandrillNotificationViewMixin makes use of it and allows to send
different emails to each recipient.Beside using the send-template api of mandrill, it gives more control to
the developer on the sender, and the merge variables for each recipient.Since it is a Mixin class, it can be mixed in an existing notification to
make it instantly usable with a mandrill template.
Package: cubicweb-mediaplayer
SummaryThis cube provides basic media storage, transcoding and streaming features.StorageThis cube defines twoSoundFileandVideoFileentity
types. Each entity uses adataattribute to store original raw
data and customdata_<fmt>(e.g.data_mp3,data_ogvattributes) to store transcoded data.BFSS is used to store data on the filesystem. The root directory
is specified by themedia-dirconfiguration option.TranscodingModification hooks are responsible for reenconding media files.ffmpegis used to convert sound and video
files to streamable formats.Encoding usesCeleryas an asynchronous task queue manager, see below
for installation.Streamingjplayeris used to stream media content.InstallationSeeCeleryfor a complete documentation. Here is a quick startup usingRabbitMQas broker forCelery:apt-getinstallrabbitmq-serverRabbitMQ requires a minimal setup. For instance (all permissions for
useruseron vhostvhost):sudorabbitmqctladd_useruserpasswordsudorabbitmqctladd_vhostvhostsudorabbitmqctlset_permissions-pvhostuser'.*''.*''.*'ConfigurationCreate aceleryconfig.pyfile in the same directory as theall-in-one.conffile (namely, the application home), with
following content:BROKER_URL = 'amqp://user:password@localhost:5672/vhost'Seehttp://docs.celeryproject.org/en/latest/userguide/application.html#configurationfor more configuration options.ExecutionUse the command below to run the celery worker handler:celery-Acubicweb_celery-i<instance_name>worker[--beat]