Saravanan666/pypi-org huggingface dataset:
Package: oapispec
OpenAPI Spec BuilderPython library used to generate swagger docs from decorators. Doesn't screw with your requests, doesn't alter your middleware, doesn't put its dirty little hands where they don't belong. You decorate functions, register them on a schema, and generate a swagger doc.InstallUsePyPI->oapispec@https://pypi.org/project/oapispecGetting StartedIn this very simplified example thespecresulted by generating the schema is a valid swagger dict/json spec that can be used in a swagger ui.fromhttpimportHTTPStatusimportoapispecasoapischema=oapi.schema(metadata=dict(version='4.2.0',title='Super API'))@oapi.doc.namespace('Health Check')@oapi.doc.route('/ping')@oapi.doc.method('GET')defping():passspec=schema.register(ping).generate()where spec equalsvvv below vvv. Usingoapispecyou can add many more details to your spec.{"swagger":"2.0","basePath":"/","paths":{"/ping":{"get":{"responses":{},"operationId":"ping","tags":["Health Check"]}}},"info":{"title":"Super API","version":"4.2.0"},"produces":["application/json"],"consumes":["application/json"],"tags":[{"name":"Health Check"}]}Creating ModelsIn this example we create a model and use it as an expected parameter to aPOSTrequest.book_model=oapi.model.Model('Book',{'title':oapi.fields.string(required=True),'author':oapi.fields.string(required=True),'genre':oapi.fields.string(),'edition':oapi.fields.integer(),'isInPrint':oapi.fields.boolean()})@oapi.doc.namespace('Book')@oapi.doc.route('/book')@oapi.doc.method('POST')@oapi.doc.response(HTTPStatus.CREATED.value,HTTPStatus.CREATED.description,book_model)@oapi.doc.expect(book_model)defadd_book():passspec=schema.register(add_book).generate()Futher ExamplesThe best place to look is theend_to_endtest intests/end_to_end_test.py. This is always kept up to date as a strong example and test of what is possible. Note that you can see the expected output of a generated schema intests/assets/expected_full_schema_result.json. This can give you an idea of how the doc decorators work - both on their own and together - to produce the open api spec.Contributions & IssuesBoth are welcome and encouraged! For any problems your having add an issue in github. If your interested in contributing take a look at thecontributing doc. If your interested in contributing you will probably want to know how to run/test/modify the project locally so checkout thedeveloping doc
Package: oapispec2
OpenAPI Spec BuilderPython library used to generate swagger docs from decorators. Doesn't screw with your requests, doesn't alter your middleware, doesn't put its dirty little hands where they don't belong. You decorate functions, register them on a schema, and generate a swagger doc.InstallUsePyPI->oapispec@https://pypi.org/project/oapispecGetting StartedIn this very simplified example thespecresulted by generating the schema is a valid swagger dict/json spec that can be used in a swagger ui.fromhttpimportHTTPStatusimportoapispecasoapischema=oapi.schema(metadata=dict(version='4.2.0',title='Super API'))@oapi.doc.namespace('Health Check')@oapi.doc.route('/ping')@oapi.doc.method('GET')defping():passspec=schema.register(ping).generate()where spec equalsvvv below vvv. Usingoapispecyou can add many more details to your spec.{"swagger":"2.0","basePath":"/","paths":{"/ping":{"get":{"responses":{},"operationId":"ping","tags":["Health Check"]}}},"info":{"title":"Super API","version":"4.2.0"},"produces":["application/json"],"consumes":["application/json"],"tags":[{"name":"Health Check"}]}Creating ModelsIn this example we create a model and use it as an expected parameter to aPOSTrequest.book_model=oapi.model.Model('Book',{'title':oapi.fields.string(required=True),'author':oapi.fields.string(required=True),'genre':oapi.fields.string(),'edition':oapi.fields.integer(),'isInPrint':oapi.fields.boolean()})@oapi.doc.namespace('Book')@oapi.doc.route('/book')@oapi.doc.method('POST')@oapi.doc.response(HTTPStatus.CREATED.value,HTTPStatus.CREATED.description,book_model)@oapi.doc.expect(book_model)defadd_book():passspec=schema.register(add_book).generate()Futher ExamplesThe best place to look is theend_to_endtest intests/end_to_end_test.py. This is always kept up to date as a strong example and test of what is possible. Note that you can see the expected output of a generated schema intests/assets/expected_full_schema_result.json. This can give you an idea of how the doc decorators work - both on their own and together - to produce the open api spec.Contributions & IssuesBoth are welcome and encouraged! For any problems your having add an issue in github. If your interested in contributing take a look at thecontributing doc. If your interested in contributing you will probably want to know how to run/test/modify the project locally so checkout thedeveloping doc
Package: oapispec-v2
OpenAPI Spec BuilderPython library used to generate swagger docs from decorators. Doesn't screw with your requests, doesn't alter your middleware, doesn't put its dirty little hands where they don't belong. You decorate functions, register them on a schema, and generate a swagger doc.InstallUsePyPI->oapispec@https://pypi.org/project/oapispecGetting StartedIn this very simplified example thespecresulted by generating the schema is a valid swagger dict/json spec that can be used in a swagger ui.fromhttpimportHTTPStatusimportoapispecasoapischema=oapi.schema(metadata=dict(version='4.2.0',title='Super API'))@oapi.doc.namespace('Health Check')@oapi.doc.route('/ping')@oapi.doc.method('GET')defping():passspec=schema.register(ping).generate()where spec equalsvvv below vvv. Usingoapispecyou can add many more details to your spec.{"swagger":"2.0","basePath":"/","paths":{"/ping":{"get":{"responses":{},"operationId":"ping","tags":["Health Check"]}}},"info":{"title":"Super API","version":"4.2.0"},"produces":["application/json"],"consumes":["application/json"],"tags":[{"name":"Health Check"}]}Creating ModelsIn this example we create a model and use it as an expected parameter to aPOSTrequest.book_model=oapi.model.Model('Book',{'title':oapi.fields.string(required=True),'author':oapi.fields.string(required=True),'genre':oapi.fields.string(),'edition':oapi.fields.integer(),'isInPrint':oapi.fields.boolean()})@oapi.doc.namespace('Book')@oapi.doc.route('/book')@oapi.doc.method('POST')@oapi.doc.response(HTTPStatus.CREATED.value,HTTPStatus.CREATED.description,book_model)@oapi.doc.expect(book_model)defadd_book():passspec=schema.register(add_book).generate()Futher ExamplesThe best place to look is theend_to_endtest intests/end_to_end_test.py. This is always kept up to date as a strong example and test of what is possible. Note that you can see the expected output of a generated schema intests/assets/expected_full_schema_result.json. This can give you an idea of how the doc decorators work - both on their own and together - to produce the open api spec.Contributions & IssuesBoth are welcome and encouraged! For any problems your having add an issue in github. If your interested in contributing take a look at thecontributing doc. If your interested in contributing you will probably want to know how to run/test/modify the project locally so checkout thedeveloping doc
Package: oap-rq
oap-rqGetting startedSimple Asyncio Queue message Sender and Receiver using redisContains:SenderReceiverMonitorMinimum Requirementspython 3.8 or greaterinstallationpip install oap-rqUsagefrom oap_rq.q import QBus

q = QBus(redis, service="test", queue="customer-food") # pass redis objectSenderresp = await q.send({"test": "me"})
print(resp) #confirmation msg idReceiver@q.consumer(name="foo-consumer")
async def process(event):
    async for e in event:
        print(e.data) # incoming data
        await e.ack()  # send msg ack
Package: oarepo
CESNET, UCT Prague and NTK wrapper around invenio v3This meta-package contains a curated and tested set of dependencies on Invenio and OArepo libraries.
It should be considered as a base building block for creating any OA repository applications.The package contains the following dependency bundles:Bundle nameDescriptiondeployAll the dependencies needed for a basic repository deploymentdeploy-es7All the ElasticSearch 7 compatible dependencies needed for a basic repository deploymentopenidDependencies needed for openid authenticationmultisumSupport for multiple file checksums (deprecated)filesSupport for uploading filesaclsACLs supportlinksEnable linking to another recordsmodelsIncludes all the common data models (DCObject, multilingual fields, Invenio model,...)includesAdds support to compose ES mappings by including another mappingstaxonomiesAdds support for taxonomic treestestsIncludes test dependenciesdraftAdds support for draft recordsiiifAdds support for file (image) preview generationmicro-apiA WSGI app to serve API-only apps under the/apiprefixThey could be installed, depending on needs of each repository application, by running:pip install oarepo[bundle-name]
Package: oarepo-actions
OARepo-actionsInstalationpipinstalloarepo-actionsUsageThe library provides functionality for adding functions into your data models with supported REST methods, which are GET, POST, PUT and DELETE.
It will create URL rule for your method, and use default or defined serializers, permissions and url path.Decorate your method with@action()decorator and add optional parameters. You must have**kwargsas your function parameter.List of optional parametersurl_path:for specifing url_path, which will be added afterlist-routeoritem-routefrom your configurationpermissions:by defaultallow allaccepts permission factorymethod:for REST methodby defaultgetyou can useget,put,deleteorpostwritten with lowercase lettersserializers:by defaultapplication/jsonserializer.accepts dictionary where key is MIME type and value your own serializerserializers takes arguments from function as *args.Therefore if you want to return array, you must
wrap it with another array (return [["a", "b", "c"]])detail:by defaultTrue. Change toFalseif method is class methoddetermines which route will be used (list routeif detail is False)ExamplesclassSampleRecord(Record):@action()deftest_a(self,**kwargs):return{"title":self["title"]}@classmethod@action(detail=False,url_path="send_email")deftest_b(cls,**kwargs):return{"title":self["title"]}@classmethod@action(detail=False,permissions=permission_factory)deftest_c(cls,**kwargs):return{"title":self["title"]}@classmethod@action(detail=False,url_path="test/<int:param>",permissions=permission_factory)deftest_d(cls,param=None,**kwargs):print("jej")returnResponse(status=200)@classmethod@action(detail=False,permissions=permission_factory,serializers={'text/html':make_response})deftest_e(cls,**kwargs):return'<h1>xx</h1>'@classmethod@action(detail=False,url_path='test',permissions=allow_all,method='post')deftest_f(cls,param=None,**kwargs):return{param:"yy"}url_a =server/records/1/test_aurl_b =server/records/send_emailurl_c =server/records/test_curl_d =server/records/test/42url_e =server/records/test_eurl_f =server/records/testpost methodRecord classIf you putrecord_classparameter in your decorated function, it will be filled with record class obtained from config.pyExample@classmethod@action(detail=False,url_path="jej")deftest(cls,record_class,**kwargs):record_uuid=uuid.uuid4()data={"title":"The title of the record","contributors":[{"name":"something"}]}pid,data=record_minter(record_uuid,data)record=record_class.create(data=data,id_=record_uuid)indexer=RecordIndexer()res=indexer.index(record)db.session.commit()returnrecordChangesVersion 1.0.0 (released 2020-09-15)Initial public release.
Package: oarepo-cli
oarepo-cliWork in progress.Repository project initializationDownload the file fromhttps://raw.githubusercontent.com/oarepo/oarepo-cli/v11.0/nrp-installer.sh,
inspect it (always a good practice) and runbash nrp-installer.sh <project_dir>RoadmapNRP client is meant to simplify:Site:get script for automatic installationchecking invenio prerequisitesbootstraping new repository site in development modein 1 git contains all modein per-model, per-ui git submodule modeincluding UI (webpack) compilation and collection of static assetsrunning development serverinitialization when oarepo-initialize is used on existing sourcescreate virtualenvssetup db if not set upsetup indices if not set upMetadata model:adding metadata modeltesting metadata modelinstalling metadata model into the siteupdating alembic during the installation stephandling empty migrations when model has not changedinitializing index during the installation step and reindexing dataimporting (sample) dataproxied models (that is, model that is built on index alias)Requests:installing requestsadding request type & actionsusing approval process librariesExpanded fields:installing support for expanded fieldsadding expanded fieldsusing libraries of expanded fieldsFiles:installing support for filesCustom fields:installing support for custom fieldsRelations:installing support for relationsUser interface for a metadata model:adding UI modulegenerating initial UI layout from modelinstalling UI module to the sitescaffolding UI component (jinja and react)UI on proxied modelsAutomated testing:running unit tests for modelsper-model testsrunning tests for all modelsunit tests for UIper-ui testsrunning tests for all modelsrunning tests for siteoverall tests (can run server, https on index page works)per-ui tests (ui is accessible, returns meaningful pages)Build and Deployment scenarios:publishing packages to pypi/gitlab/...in monorepo mode (single pypi package from all components)in per-model, per-ui package modecreating docker/k8s image for the whole siteGithub/Gitlab integration:support github actionssupport gitlab CI/CD
Package: oarepo-communities
OARepo communitiesInstallationTo init custom fields, add them under COMMUNITIES_CUSTOM_FIELDS key to invenio.cfg,
for examplefromoarepo_communities.cf.permissionsimportPermissionsCFfromoarepo_communities.cf.aaiimportAAIMappingCFCOMMUNITIES_CUSTOM_FIELDS=[PermissionsCF("permissions"),AAIMappingCF("aai")]COMMUNITIES_CUSTOM_FIELDS_UI=[{"section":"settings","fields":[{"field":"permissions","ui_widget":"Input","props":{"label":"permissions dict",}}]}]and the init cli command:
invenio communities custom-fields init
Package: oarepo-dc
OARepo DC data modelDC Terms data model for oarepo.Instalationpipinstalloarepo-dcUsageThe library provides Dublin Core object for json schema with marshmallow validation and deserialization and elastic search mapping.JSON SchemaAdd this package to your dependencies and use it via $ref in json
schema as"[server]/schemas/dcterms-v2.0.0.json#/definitions/DCObject".
Elastic Search mapping is handled automatically via Eleastic Search templates.Usage example{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","properties":{"these":{"$ref":"https://localhost:5000/schemas/dcterms-v2.0.0.json#/definitions/DCObject"}}}{"type":"object","properties":{"these":{"abstract":{"cs":"neco","en":"something"},"contributor":"Alzbeta Pokorna","modified":"2012-04-23T18:25:43.511Z"}}}MarshmallowFor data validation and deserialization.If marshmallow validation is performed within application context, languages in multilingual string data fields are validated against SUPPORTED_LANGUAGES config.
If the validation is performed outside app context, the keys are not checked against a list of languages
but a generic validation is performed - keys must be in ISO 639-1 or language-region format from RFC 5646.Usage exampleclassMD(DCObjectSchemaV2Mixin,marshmallow.Schema):passdata={"title":{"cs":"neco"},"alternative":{"en-us":"something","cs":"neco"},"abstract":{},"creator":"Alzbeta Pokorna","contributor":"Miroslav Simek","dateSubmitted":"1970-10-12","available":"1970-03-18","created":"1970-09-29","modified":"1970-12-31","description":{"en-us":"something","cs":"neco"},"identifier":"id"}MD().load(data)Supported languages validationYou can specified supported languages in your application configuration inSUPPORTED_LANGUAGES. Then only these
languages are allowed as multilingual string.
You must specified your languages in format"en"or"en-us".Usage exampleapp.config.update(SUPPORTED_LANGUAGES=["cs","en"])ChangesVersion 2.0.0 (released 2020-08-25)Initial public release.
Package: oarepo-documents
OARepo documentsInstalationpipinstalloarepo-documentsUsageThis library contains data model for creating documents.
This data model is not usable by it self, you have to add it to your own data model as it is shown in "Using data model".
New document can by also created by provided DOI, as it is shown in "Document from DOI"Using data modelDocument json schema, es mapping and marshmallow is taken frominvenio-app-ils/documentswith some properties changed to data typemultilingual stringfrom oarepo-multilingual library.
All properties that are changed to multilingual are listed in "Changes"Changesabstractalternative_abstractsalternative_titlesconference_info (only property "title")license (only property "title")notepublication_info (only property "journal_title")titleurls (only property "description")Json SchemaAdd documents json schema to your schema with keywordallOfand"$ref": "/schemas/document-v1.0.0.json#/definitions/Document"Example{"type":"object","allOf":[{"properties":{"extra_property":{"type":"string"}}},{"$ref":"/schemas/document-v1.0.0.json#/definitions/Document"}],"additionalProperties":"false"}MappingAdd documents mapping to your elastic search mapping with"oarepo:extends": "document-v1.0.0.json#/Document"from library "oarepo-extends""Example{"mappings":{"dynamic":"strict","oarepo:extends":"document-v1.0.0.json#/Document","properties":{"extra_property":{"type":"text"}}}}MarshmallowInherit your class fromDocumentSchemaV1Examplefromoarepo_documents.marshmallow.documentimportDocumentSchemaV1classSampleSchemaV1(DocumentSchemaV1):extra_property=fields.String(validate=validate.Length(min=5),required=False)Document from DOIYou can create new document record from existing DOI with url in format 'server/record_class/document/doi'.
This request will return existing document record, if document with that DOI already exists in your database.
If there is no document with this DOI in database, it will be created a new one via CrossRef client and metadata from this new document will be returned.
This new document will have its DOI as metadata in property "alternative_identifiers" with scheme "DOI".Examplesurl="https://localhost:5000/records/document/10.5281/zenodo.3883620"ChangesVersion 1.0.0Initial public release.
Package: oarepo-doi-generator
OARepo DOI GeneratorInstalationpipinstalloarepo-doi-generatorUsageOARepo module for DataCite DOI registration.Functionsdoi_request(record)Creates a new identifier in record metadata with emptyvalue,schemeasdoiand withstatusset asrequested.doi_approved(record, pid_type)For DOI registration. A new DOI is registered on DataCite and attached to record metadata as a new identifier.
If test_mode sets on True, the registration is performed only on DataCite testing server.Configurationmust be present in config:DOI_DATACITE_USERNAMERepository account credentials for DataCite in the format "xxx.yyy"DOI_DATACITE_PASSWORDPassword for DataCiteDOI_DATACITE_PREFIXRegistered DOI prefixDOI_TEST_MODEIf true, dois will be generated only on test serveroptional:DOI_DATACITE_PUBLISHERFor metadata that are generated for record and associated with registered DOI.
If publisher is specified in record metadata, this variable is not used.
Default value: CESNETDOI_DATACITE_TEST_URLOnly for test purposes.
URL that is allowed in the domains settings of the test repository.ChangesVersion 1.0.0Initial public release.
Package: oarepo-doi-resolver
OARepo DOI resolverOArepo module that returns records metadata from its public DOI.Instalationpipinstalloarepo_doi_resolverUsageModule provides entrypoint for DOI resolving on url/resolve-doi/<doi>examplehttps://127.0.0.1:5000/resolve-doi/10.5281/zenodo.5347031Entrypoint is reachable only for authenticated users.ChangesVersion 2.0.0 (released 2020-08-25)Initial public release.
Package: oarepo-invenio-model
OARepo Invenio data modelInvenio base record model.Instalationpipinstalloarepo-invenio-modelUsageThe library provides extensible Invenio base record model.JSON SchemaAdd this package to your dependencies and use it via $ref in json
schema.Usage example{"type":"object","allOf":[{"properties":{"title":{"type":"string"}}},{"$ref":"/schemas/invenio-v3.0.0.json#/definitions/InvenioRecord"}],"additionalProperties":"false"}Elastic Search MappingUseoarepo-mapping-includeslibrary for extanding invenio base record model mapping.Usage example{"mappings":{"dynamic":"strict","oarepo:extends":"invenio-v3.0.0.json#/InvenioRecord","properties":{"title":{"type":"text"}}}}MarshmallowYou can extense your schema with Invenio base model schema by inheriting fromInvenioRecordMetadataSchemaV1Mixin.Usage exampleclassSampleSchemaV1(InvenioRecordMetadataSchemaV1Mixin):title=fields.String(validate=validate.Length(min=5),required=True)Schema inheritanceJSON Schema providesallOfconstruct to join multiple schemas. The current
implementation of python's schema validator can not handleallOfin top-level
element.To enable composition of schemas in the form of top-level "includes":{"$schema":"http://json-schema.org/draft-07/schema#","allOf":[{"$ref":"/schemas/dcterms-v2.0.0.json#/definitions/DCObject"},{"$ref":"/schemas/invenio-v3.0.0.json#/definitions/InvenioRecord"},{"properties":{"category":{"type":"string","enum":["kovy","sklo","keramika","textil"]}}}]}inherit your record class fromInheritedSchemaRecordMixin:fromoarepo_invenio_modelimportInheritedSchemaRecordMixinfrominvenio_records.apiimportRecordclassMyRecord(InheritedSchemaRecordMixin,Record):passChanges[Version 2.0.0]Update schemas, mappings and marshmallow to latest records rest
schemasSwitch record id type from string to PersistentIdentifier[Version 1.1.0]Export Invenio ES mappingsInvenio base record model.
Package: oarepo-micro-api
OARepo Micro APIOARepo REST API microservice moduleGetting StartedThis package will provide a simple UWSGI microservice that will serve
all of the registered OArepo API apps in your repository instance under the/apiendpoint. It also
provides some/.well-knownendpoints that are usable for running in k8s environments.PrerequisitesPython >=3.6DockerHow to useSpecify this package as a dependency in your OArepo repository project'ssetup.py.
If you're usingoarepoas a base package for your repository, you should use the following extras:# setup.py#...install_requires=['oarepo[micro-api,...another-oarepo-extras]']#...otherwise:# setup.py#...install_requires=['oarepo-micro-api']#...After that, reinstall your project by:pip install -e .Start your repository instance and verify, that everything worked out, by running:curl -k https://localhost:5000/.well-known/heartbeat/readinessLicenseThis project is licensed under the MIT License - see theLICENSEfile for details
Package: oarepo-model-builder
OARepo model builderA library and command-line tool to generate invenio model project from a single model file.Documentation for the model format and examples are athttps://narodni-repozitar.github.io/developer-docs/docs/technology/invenio/nrp-toolchain/edit-metadataTo compile your model into invenio sources, runoarepo-compile-model<model.yaml>--output-directory<output-dir>