Saravanan666/pypi-org huggingface dataset:
Package: schemadisplay-magic
ipython_magic_sqlalchemy_schemadisplayMagic forsqlalchemy_schemadisplayMagic originally created for the Open University moduleTM351 Data Management and Analysis. This magic complements theipython-sql, which provides magics for connecting to a SQL database, with a magic that usessqlalchemy_schemadisplayto generate ERDs over a SQL database.The code for generating the ER diagram can be found in the third partysqlalchemy_schemadisplaypackage.At the moment, the schema display andipython-sqlmagics and independent, but they really should be combined into a single package.UsageInstall from PyPi:pip install schemadisplay-magicInstall from this repo:pip install git+https://github.com/innovationOUtside/ipython_magic_sqlalchemy_schemadisplay.gitNote there are several other dependencies:Python: seerequirements.txtO/S: seeapt.txtInstall eitheripython-sqlorjupysqlto access the$%sqlmagic:eitheripython-sql, orpip install jupysqlSet up a database. For example, load the SQL magic:%load_extsqlCreate a database connection string — we can use a SQLite database for demo purposes — and connect the SQL magic to the database:# With ipython-sql:DB_CONNECTION='sqlite:///./test.db'%sql$DB_CONNECTION# With jupysql:fromsqlalchemyimportcreate_engineengine=create_engine(DB_CONNECTION)%sqlenginePopulate the database with a couple of foreign key related tables:%%sql

DROP TABLE IF EXISTS doctor;

CREATE TABLE doctor (
    
    doctor_id CHAR(4),
    doctor_name VARCHAR(20),
    
    PRIMARY KEY (doctor_id)
 );

DROP TABLE IF EXISTS patient;

CREATE TABLE patient (
    
    patient_id CHAR(4),
    patient_name VARCHAR(20),
    date_of_birth DATE,
    gender CHAR(6),
    height_cm DECIMAL(4,1),
    weight_kg DECIMAL(4,1),
    doctor_id CHAR(4),
    
    PRIMARY KEY (patient_id),
    
    FOREIGN KEY (doctor_id) REFERENCES doctor
 );Load the schema display magic, and render the schema from the connected database:%load_extschemadisplay_magic%schema--connection_string$DB_CONNECTIONAlternatively, use ajupysqlconnections file (~/.jupysql/connections.ini):%schema --connection_string $DB_CONNECTIONAt the moment, the database connection string needs to be provided to the schem magic for each diagram. [TO DO - fix this to use a single persistemt connection for the life of the notebook session, once connected.]Using the Magic in a Teaching and Learning ContextThe magic was developed to support teaching and learning around the topic ofrelational databases. Students were working with a PostgreSQL database, creating, editing and deleting tables, and creating foreign key relationships between tables. The magic provided an easy way to visualise the current state of the tables available in the database, and any foreign key relationships between them.In this way, students could run database and table modifying statements in a notebook. A single line magic invocation could then be used to generate a visual representation of the current state of the database to check that their intended changes had worked correctly.
Package: schemadisplay-sphinx
This extension creates the Entitiy Relationship Diagram(ERD) of the
project in an image file.  The idea is that Database information
documentation keeps syncronized with the source code.ConfigurationAddschemadisplay_sphinxmodule in sphinx entensions array.Define themodel_class_nameclass.Specify the image path for the output inmodel_schema_filename.List folders to be ignored for the schema creation usingmodel_skip_folders.Free software: Apache License, Version 2.0
Package: schemaflow
SchemaFlowThis is a a package to write data pipelines for data science systematically in Python.
Thanks for checking it out.Check out the very comprehensive documentationhere.The problem that this package solvesA major challenge in creating a robust data pipeline is guaranteeing interoperability between
pipes: how do we guarantee that the pipe that someone wrote is compatible
with others' pipewithoutrunning the whole pipeline multiple times until we get it right?The solution that this package adoptsThis package declares an API to define a stateful data transformation that gives
the developer the opportunity to declare what comes in, what comes out, and what states are modified
on each pipe and therefore the whole pipeline. Check outtests/test_pipeline.pyorexamples/end_to_end_kaggle.pyInstallpip install schemaflowor, install the latest (recommended for now):git clone https://github.com/jorgecarleitao/schemaflow
cd schemaflow && pip install -e .Run examplesWe provide one example that demonstrate the usage of SchemaFlow's API
on developing an end-to-end pipeline applied toone of Kaggle's exercises.To run it, download the data in that exercise toexamples/all/and runpip install -r examples/requirements.txt
python examples/end_to_end_kaggle.pyYou should see some prints to the console as well as the generation of 3 files atexamples/: two plots and onesubmission.txt.Run testspip install -r tests/requirements.txt
python -m unittest discoverBuild documentationpip install -r docs/requirements.txt
cd docs && make html && cd ..
open docs/build/html/index.html
Package: schemagen
SchemaGenSchema Gen is a simple CLI tool that generates Python GraphQL implementations(using Graphene) from a Graphql Schema file.InstallationpipinstallschemagenUsageHere's the content of a sample input file(we will call ittest.graphql)typeUser{id:ID!username:Stringfirst_name:Stringlast_name:Stringfull_name:Stringname:Stringname:String}Now let's use SchemaGen to generate python code from it.As a CLI tool:schemagenparsetest.graphql-otest.pyAs a Python Package:fromschemagenimportSchemaGengen=SchemaGen(input_file='test.graphql',output_file='test.py')# parse input filegen()Output(test.py):# This file was generated by CodegenToolfromgrapheneimport*classUser(ObjectType):id=Field(ID,required=True)username=Field(String)first_name=Field(String)last_name=Field(String)full_name=Field(String)name=Field(String)NotesHere are some things you should know about using SchemaGen:SchemaGen is not guaranteed to catch errors in your GraphQL schema file.SchemaGen will only catch a very small percentage of errors that might occur in defining a GraphQL schema.
It is the developer's responsibility to ensure the GraphQL schema file is error-free.SchemaGen will not install the graphene package on your local machine however it will import it in the generated python file.You can easily install the package by running:pipinstallgrapheneGraphQL type declarations in your schema filemust be ordered.Because of the way Python and SchemaGen works, you cannot use a GraphQL type
before declaring it. For example, the following graphql schema definition would be invalid because we are using theUrlscalar in ourUsertype before declaring it:typeUser{id:ID!username:Stringavatar_url:Url}scalarUrlThe correct version of the above code is:scalarUrltypeUser{id:ID!username:Stringavatar_url:Url}Using a GraphQL SDL keyword as an object field name in your schema will throw an error.For example, doing this:enumUserType{Example}typeUser{name:Stringtype:UserType}will throw an error.Do this instead:enumUserType{Example}typeUser{name:Stringuser_type:UserType}I plan to fix the last two issues stated above in the future. Pull requests are welcome!
Package: schemagpt
SchemaGPTNote:The generated RDF Schemas are not 100% accurate and may require manual correction.SchemaGPT is a Python library that utilizes the power of OpenAI's GPT-3 andschema.orgvocabulary to generate RDF Schemas from natural language.The library aims to simplify the process of creating RDF Schemas by automatically generating them from a user-defined description written in natural language.The generated Schemas are in the form of RDF, a popular data model for semantic web technologies, making it easier for developers to work with linked data.Who can benefit from using this library?Anyone who wants to simplify the process of creating RDF Schemas for linked data can benefit from using the SchemaGPT library. This includes software developers, data scientists, semantic web practitioners, and anyone else who needs to work with RDF data. The library is especially useful for those who are not familiar with the intricacies of RDF Schema creation, as it provides a way to generate Schemas from a natural language description, making the process much easier and faster.InstallationTo install SchemaGPT, simply run the following command usingpip:pipinstallschemagptor usingPoetry:poetryaddschemagptUsageUsing SchemaGPT is straightforward. Here's a simple example:fromschemagptimportSchemaGPTgenerator=SchemaGPT(<YOUR_OPENAI_API_KEY>)schema=generator.schema("Tesla Model X")print(schema)This will generate the following RDF Schema:{"@context":"https://schema.org","@type":"Car","name":"Tesla Model X","brand":{"@type":"Brand","name":"Tesla"},"model":"Model X"}FeaturesFeatureStatusSchemas generation/updates using natural language:white_check_mark:Schemas validation/fixes (according to schema.org) with Pydantic:construction:Supported formats for RDF SchemasFormatDescriptionStatusRDF/XMLThe standard XML format for RDF:x:TurtleA terse, human-readable RDF syntax:x:N-TriplesA line-based, plain-text format for RDF:x:N-QuadsA line-based, plain-text format for RDF with context information:x:JSON-LDA JSON-based format for RDF:white_check_mark:ContributionSchemaGPT is open-source. If you have an idea for a new feature, or you've found a bug, please feel free to open an issue or submit a pull request.
Package: schemahq-migra
migra: Like diff but for Postgres schemascompare schemasautogenerate migration scriptsautosync your development database from your application modelsmake your schema changes testable, robust, and (mostly) automaticmigrais a schema diff tool for PostgreSQL, written in Python. Use it in your python scripts, or from the command line like this:$ migra postgresql:///a postgresql:///b
alter table "public"."products" add column newcolumn text;

alter table "public"."products" add constraint "x" CHECK ((price > (0)::numeric));migramagically figures out all the statements required to get from A to B.Most features of PostgreSQL are supported.Migra supports PostgreSQL >= 10 only.Known issues exist with earlier versions. Development resources are limited, and feature support rather than backwards compatibility is prioritised.THE DOCSDocumentation is atdjrobstep.com/docs/migra.Folks, schemas are goodSchema migrations are without doubt the most cumbersome and annoying part of working with SQL databases. So much so that some people think that schemas themselves are bad!But schemas are actually good. Enforcing data consistency and structure is a good thing. It’s the migration tooling that is bad, because it’s harder to use than it should be.migrais an attempt to change that, and make migrations easy, safe, and reliable instead of something to dread.ContributingContributing is easy.Jump into the issues, find a feature or fix you'd like to work on, and get involved. Or create a new issue and suggest something completely different. If you're unsure about any aspect of the process, just ask.Creditshttps://github.com/djrobstep: initial development, maintenancehttps://github.com/alvarogzp: privileges supporthttps://github.com/seblucas: docker improvementshttps://github.com/MOZGIII: docker supporthttps://github.com/mshahbazi: misc fixes and enhancements
Package: schemahq-schemainspect
schemainspect: SQL Schema InspectionSchema inspection for PostgreSQL (and potentially others in the future).Inspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.Limitations:Function inspection only confirmed to work with SQL/PLPGSQL languages so far.Basic UsageGet an inspection object from an already opened SQLAlchemy session or connection as follows:from schemainspect import get_inspector
from sqlbag import S

with S('postgresql:///example') as s:
    i = get_inspector(s)The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (OrderedDict) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.For instance, the information about a tablebookswould be accessed as follows:>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']DocumentationDocumentation is a bit patchy at the moment. Watch this space!Author CreditsInitial development, maintenance:djrobstepContributions:BenSjobergjohtoInstallInstall withpip:$ pip install schemainspectTo install psycopg2 (the PostgreSQL driver) at the same time as well:$ pip install schemainspect[pg]
Package: schemainspect
schemainspect: SQL Schema InspectionSchema inspection for PostgreSQL (and potentially others in the future).Inspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.Limitations:Function inspection only confirmed to work with SQL/PLPGSQL languages so far.Basic UsageGet an inspection object from an already opened SQLAlchemy session or connection as follows:from schemainspect import get_inspector
from sqlbag import S

with S('postgresql:///example') as s:
    i = get_inspector(s)The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (OrderedDict) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.For instance, the information about a tablebookswould be accessed as follows:>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']DocumentationDocumentation is a bit patchy at the moment. Watch this space!Author CreditsInitial development, maintenance:djrobstepContributions:BenSjobergjohtoInstallInstall withpip:$ pip install schemainspectTo install psycopg2 (the PostgreSQL driver) at the same time as well:$ pip install schemainspect[pg]
Package: schemainspect2
schemainspect: SQL Schema InspectionSchema inspection for PostgreSQL (and potentially others in the future).Inspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.Limitations:Function inspection only confirmed to work with SQL/PLPGSQL languages so far.Basic UsageGet an inspection object from an already opened SQLAlchemy session or connection as follows:from schemainspect import get_inspector
from sqlbag import S

with S('postgresql:///example') as s:
    i = get_inspector(s)The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (OrderedDict) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.For instance, the information about a tablebookswould be accessed as follows:>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']DocumentationDocumentation is a bit patchy at the moment. Watch this space!Author CreditsInitial development, maintenance:djrobstepContributions:BenSjobergjohtoInstallInstall withpip:$ pip install schemainspectTo install psycopg2 (the PostgreSQL driver) at the same time as well:$ pip install schemainspect[pg]
Package: schemainspect-idempotent
schemainspect: SQL Schema InspectionSchema inspection for PostgreSQL (and potentially others in the future).Inspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.Limitations:Function inspection only confirmed to work with SQL/PLPGSQL languages so far.Basic UsageGet an inspection object from an already opened SQLAlchemy session or connection as follows:from schemainspect import get_inspector
from sqlbag import S

with S('postgresql:///example') as s:
    i = get_inspector(s)The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (OrderedDict) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.For instance, the information about a tablebookswould be accessed as follows:>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']DocumentationDocumentation is a bit patchy at the moment. Watch this space!Author CreditsInitial development, maintenance:djrobstepContributions:BenSjobergjohtoInstallInstall withpip:$ pip install schemainspectTo install psycopg2 (the PostgreSQL driver) at the same time as well:$ pip install schemainspect[pg]
Package: schemalib
# schemalibSchemalib is a library for simple handling and usage of JSON schemas in your code. Simply definea schema library with paths from which to load the schemas and then use the `check` decorator providedby the object instance to perform actual checking against that schema library. Relative or absolute pathscan be specified, there's also a support for loading schemas relative to a Python module (Python's module loadorder applies here).## Examples:```pythonfrom schemalib import SchemaLibraryschemas = SchemaLibrary('/my/schema/path', 'package://my.python.package')# check contents of keyword argument `data_obj`@schemas.check(data_obj='some-schema-file')def my_function(data_obj=None):...# check return value of the function@schemas.check('some-other-schema-file')def my_function():...# check both@schemas.check('some-other-schema-file', data_obj='some-schema-file')def my_function(data_obj=None):...```## LinceseGNU/GPLv-3
Package: schema-markdown
schema-markdown is a schema definition and validation library.LinksThe Schema Markdown LanguageAPI DocumentationSource codeDefine a SchemaSchemas are defined using theSchema Markdown language,
which is parsed by theparse_schema_markdownfunction. For example:>>> from schema_markdown import parse_schema_markdown
...
>>> model_types = parse_schema_markdown('''\
... # An aggregate numerical operation
... struct Aggregation
...
...     # The aggregation function - default is "Sum"
...     optional AggregationFunction aggregation
...
...     # The numbers to aggregate on
...     int[len > 0] numbers
...
... # An aggregation function
... enum AggregationFunction
...     Average
...     Sum
... ''')Validate using a SchemaTo validate an object using the schema, use thevalidate_typefunction. For example:>>> from schema_markdown import validate_type
...
>>> validate_type(model_types, 'Aggregation', {'numbers': [1, 2, '3', 4]})
{'numbers': [1, 2, 3, 4]}Notice that the numerical input ‘3’ above istype-massagedto the integer 3 by validation.Validation fails if the object does not match the schema:>>> from schema_markdown import ValidationError
...
>>> try:
...     validate_type(model_types, 'Aggregation', {'numbers': [1, 2, 'asdf', 4]})
... except ValidationError as exc:
...     str(exc)
"Invalid value 'asdf' (type 'str') for member 'numbers.2', expected type 'int'"Validation also fails if a member constraint is violated:>>> try:
...     validate_type(model_types, 'Aggregation', {'numbers': []})
... except ValidationError as exc:
...     str(exc)
"Invalid value [] (type 'list') for member 'numbers', expected type 'array' [len > 0]"Document a SchemaTo document the schema, download thedocumentation applicationstub and save the type model as JSON:curl-Ohttps://craigahobbs.github.io/schema-markdown-doc/extra/index.htmlpython3\-c'from model import model_types; import json; print(json.dumps(model_types))'\>model.jsonTo host locally, start a local static web server:python3-mhttp.serverDevelopmentThis package is developed usingpython-build.
It was started usingpython-templateas follows:template-specializepython-template/template/schema-markdown/-kpackageschema-markdown-kname'Craig A. Hobbs'-kemail'craigahobbs@gmail.com'-kgithub'craigahobbs'-knomain1
Package: schemamodels
Schema ModelsUse this library to turn a JSON Schema into a plain 'ol Python dataclass.InstallationInstall this package using the usual suspects.pip install schemamodelsUsageThis libraryonlysupports JSON schemas oftype: object:{"$id":"https://schema.dev/fake-schema.schema.json","$schema":"http://json-schema.org/draft-07/schema#","title":"fake-schema","description":"Blue Blah","type":"object","properties":{"property_a":{"default":5,"type":"integer"},"property_b":{"type":"string"}}}fromschemamodelsimportSchemaModelFactoryschema_string='..'my_json_schema=json.loads(schema_string)factory=SchemaModelFactory()factory.register(my_json_schema)Use your new dataclassfromschemamodelsimportexceptionsfromschemamodels.dynamicimportFakeSchemayour_data_instance=FakeSchema(property_a=2334)# OKwithpytest.raises(exceptions.ValueTypeViolation):your_data_instance=FakeSchema(property_a="hello")Why this library existsFaster than defining dataclasses manuallyThe class-like syntax of creating dataclasses is a useful way to model a valid JSON schema. This library essentially makes your existing JSON schemas usable as a Python dataclass.Useable everywhereTaking the time to construct a plain ol' Pythjon dataclass, ensures widespread utility across of multiple domains of study and applications.Just-enough validationThe dataclasses are not completely dumb. Every dataclassobjectthat originated from a valid JSON schema, will perform runtime checks on the input you provide it.These basic checks are performedevery timeyou create a new instance of a generated dataclass:Are the field names correct?Are the required fields present?Does the input match the datatype expectations set forth by the generated dataclass?LicenseThis codebase is licensed under the GPLv3+ and therefore the use, inclusion, modification, and distribution of this software is governed by the GPL.To opt-out of the obligations of the GPL, inquire about the commercial license by sending an email to:license@civichacker.com.
Package: schemander
SchemanderAs in Schema + Commander...... it took me a while to connect the name with the "Fantastic Beasts and Where to Find Them" (2016) film, main character.This module aims to simplify the way we handle JSON Schemas in Python, leveraging type annotations.Installpip install schemanderWhen working with JSON is common to have situations in which string values are "blest" with extra meaning or behaviour such as dates, datetimes, email, phone numbers, amoung others. This module solves this by defining a class that we can extend calledInternalObjectTypeString, which attempt to convert the value of the string in to an object while preserving the string version as a main display value, exposing the converted object via an attribute namedvalue.Moreover when converting a JSON in to a data structure, we usually have to pass through a dictionary, and then "cast" in to the desired representation we desire. For this we define aSchemafrom which we need to extend in order to define a schema where you will define attributes with a type-hint,int,float,str,bool,typing.Listwith a given type to have a homogeneous array (heterogeneous, are not supported) or aclassthat will take the field value as only argument for construction, such asUUID, or some of theInternalObjectTypeStringorRegexValidatedString.An example on how to write for ausercould be found at./example.py.