Saravanan666/pypi-org huggingface dataset:
Package: magical-sqlserver
Magical SQL ServerA tool that integrates Microsoft SQL Server into applications like magic.What is this?Do you have an application that needs to consume data stored on SQL Server Database, or needs to post data into this database? Magical SQL Server will handle that for you easily.RequirementsTo use this module, you have to install python3 and pymssql:pip3 install pymssqlBulk insert method uses BCP to copy multiple rows efficiently. SeeMicrosoft Documentationto install it on your machine.UsageLet's say that you have a table calledmy_database.dbo.users:idnameteam1exampleexample2new_userusersTo retrieve all the data from the table:from magical_sqlserver import SQLServer
sql = SQLServer (
    user,
    password,
    host,
    my_database,
    port=1433,
)

data = sql.select("users")This will return:[
  {
    "id": 1,
    "name": "example",
    "team": "example"
  },
  {
    "id": 2,
    "name": "new_user",
    "team": "users"
  }
]You can filter columns and get specific columns:data = sql.select("users", condition={"id":1}, columns=["name"])With result{"name":"example"}.With ContextYou may usewithstatement then Magical SQL Server will open and close a connection for you as your statement ends:with SQLServer(user, host, password, my_database) as sql:
    sql.select("users")You can close your connection manually withsql.close()method too.As a decoratorYou may want to decorate your funciton with this module. To to that, simply use theprovide_sessionmodule. It will try replace sql argument if it exists in your funcion, or add a kwarg argument calledsql. This decorator opens an close an SQL Server connection for you. Example:from magical_sqlserver import provide_session

@provide_session(user, host, password, my_database)
def awesome_function(sql=None):
  sql.select("users")Or with kwargs:@provide_session(user, host, password, my_database)
def awesome_function(**kwargs):
  sql = kwargs["sql"]
  sql.select("users")Writing dataSingle recordsTo create new record:data = {"id":3, "name":"bar"}

sql.insert("users", data)To update existing records:sql.update("users", data={"name":"new_name"}, contition={"id":1})You can delete records too:sql.delete("users", {"id":2, "name":"new_user"})It's important to say that all conditions are additive. For example, if your update has condition{"id": 1, "name": "new_user"}, this module will build an sql query that hasid = 1 and name = 'new_user'and will try this against the database. In the table above, no data will be updated.Bulk InsertSimply pass a list of dicts tobulk_insertmethod. It will transform it to csv temporary files and copy it to table with BCP method. See requirements for more details.data = [{"id":4, "name":"me"},{"id":5, "name":"you"}]

sql.bulk_insert("users", data)Other StuffYou can run generic queries with the method query:data = sql.query("select top(10) * from my_table join users on my_table.id = users.id")And retrieve all tables from Sql Server Schema:tables_list = sql.tables()
Package: magicaltools
magicaltools介绍一个申请的仓库 py=3.8,3.9软件架构软件架构说明安装教程xxxxxxxxxxxx使用说明xxxxxxxxxxxx参与贡献Fork 本仓库新建 Feat_xxx 分支提交代码新建 Pull Request特技使用 Readme_XXX.md 来支持不同的语言，例如 Readme_en.md, Readme_zh.mdGitee 官方博客blog.gitee.com你可以https://gitee.com/explore这个地址来了解 Gitee 上的优秀开源项目GVP全称是 Gitee 最有价值开源项目，是综合评定出的优秀开源项目Gitee 官方提供的使用手册https://gitee.com/helpGitee 封面人物是一档用来展示 Gitee 会员风采的栏目https://gitee.com/gitee-stars/
Package: magicapi
Magic APIThe Magic API!incr the toml versionpoetry publish --buildFor CLI:Magic CLI (magicapi has this built in)The best server maker.Steps:pip install magicapi (make sure the pip points to the correct python (3.6+))cd into the directory you want the server to be in// use the cli to create the appmagic create < app name >cd < app name >// now make the virtual env and pip install the requirements
5) python3 -m venv venvsource venv/bin/activatepip install -r requirements.txtpip install --upgrade magicdb magicapi// files needed to run
8) Create an .env file in the < app name > directory.a) Use the ".example_env" as a template. Fill in the env variables for the services you will need to use.b) The SERVICE and TASKS_TABLE_NAME are required for the app.// add firestoreadd the firestore service account json to the < app name > and name it "my-service-account.json"// to deploy to aws lambdaCreate a user on AWS and sign in via the CLI (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)npm imagic deployThat should be it for the setup!Time to run it!To start a local server: magic startTo test local server (while local server is running): magic testTo deploy for the first time or any time you change the serverless yaml: magic deployTo deploy when you just edited the app code: magic deploy_againTo update magicapi:
pip install --upgrade magicapi
Package: magic-api-proxy
Magic API ProxyThis is astatelessAPI proxy that allows creation and use ofaccess-limitedAPI tokens.Basically, it's identity and access management for API tokens.Why is this useful?GitHub's API tokens (or other APIs, like DigitalOcean's) do not allow fine-grained control over which actions a token can perform (see thisDear GitHub issue). For example, you basically have to create a token that has full control over a repository to allow a token to just apply labels to issues.This can be problematic. When you have many jobs, processes, and/or bots interacting with the GitHub API you increase the likelihood that a token could be compromised and tokens with broad permissions have very high consequences.This proxy allows you to create API tokens with fine-grained permissions (amagic token) and then talk to an API using those magic tokens through a proxy. The proxy validates the magic token is allows to perform the requested action and then forwards the request to the API using the real API token.What doesstatelessmean?This proxy requires no backing storage and stores all of its state in the magic token itself. Although the plugin system permits to add a stateful layer if you so wish. e.g. allowing a token to create a record on a DNS provider, and delete it afterwards, but not delete any other record.TODO: document plugin systemWhat? How?The proxy uses asymmetric cryptography (a public and private key pair) andJWTsto encode its state into the magic token.Each magic token is a simple JWT signed by the proxy'sprivate keywith these claims:{
  "iat": 1541616032,
  "exp": 1699296032,
  "token": "[long encrypted key]",
  "allowed": [
    "GET /user",
    "GET /repos/theacodes/nox/issues"
  ]
}Thetokenclaim is an encrypted version of the raw API token. It's encrypted using the proxy'spublic key, so that only the proxy itself can decrypt it (using itsprivatekey).The allowed claim determines what the magic token has access to. This proxy has a basic, rudimentary scope implementation described belowThe JWT is generated and signed by the proxy itself using itsprivate key. This means the contents can not be tampered with without invalidating the JWT.ScopingBy default, this proxy has a simple scope strategy using the format:METHOD /url/patternWhereMETHODcan beGET,POST,PUT, etc. and/url/patterncan be any regular expression that's used to check the URL.For instance, to create a token that has access to any repository's issues insomeorg, you could do:GET /repos/someorg/.+?/issuesUsageTODODisclaimerThis is was adaptaed from an unofficial inside-Google project, experimental. This is not a magic bullet for security. You assume all risks when using this project.
Package: magic-assistant
IntroMagic-Assistant is an open source AI agent framework. You can use it to develop multiple types of agent. Now support 4
types of agent:chatChat agent chats with you like a human. It is the most normal and simple type.execute_cmdExecute cmd agent uses built-in plugins to try to accomplish your task. This agent type applies to simple tasks which
can be accomplished by one plugin.planPlan agent makes a plan and use built-in plugins to execute plan items according to try to accomplish your task. Agent evaluate
the result of execution and adjust plan if necessary. This agent type applies to complicated tasks which can not be
accomplished by one plugin.role_playRole play agent usually does not work alone. Each agent has its own name, role and memory. They coordinate with each other in
your defined sandbox. This agent type is inspired by "Generative Agents: Interactive Simulacra of Human Behavior"
(https://arxiv.org/abs/2304.03442).InstallMagic-Assistant supports two installation types: metal and docker.llmMagic-Assistant has been developed and tested with the model 'vicuna'(https://github.com/lm-sys/FastChat.git). You need to
prepare the llm model in advance and configure the llm model path in the config/magic_assistant.yml. More llm modules will
be integrated. If you want to use a llm which has not been integrated yet, you can integrate it yourself in the magic_assistant/model/llm
directory.metal1, Setup your own python environment, require python3.10+. For example, execute "conda create -n mojing python=3.10" in shell;
2, Install python packages. In shell, cd to the directory of Magic-Assistant and execute " pip3 install -e .".dockerThe Magic-Assistant docker image has already installed the python dependencies and Magic-Assistant and starts up in restful_api mode.
If you want to use it in cli mode, you can execute "docker exec -ti $docker_name /bin/bash" and execute "python3 -m magic_assistant.main $ args".usageMagic-Assistant supports two usage types: cli and restful_api. If you want to use or test Magic-Assistant in shell, choose the
cli type. If you want to integrate Magic-Assistant into own products, choose the restful_api type.cliExecute "python3 -m magic_assistant.main --help" to show the supported args. Refer to the examples in the "Magic-Assistant/examples"
directory. For example, you can execute "python3 -m magic_assistant.main --gui_type cli --agent_type plan" to start a plan agentrestful apiWill support soon.
Package: magicattr
MagicattrA getattr and setattr that works on nested objects, lists,
dictionaries, and any combination thereof without resorting to eval.It differs from getattr and setattr in that it retains the failure cause
instead of always raising an AttributeError.ExampleSay we have a person class as follows:classPerson:settings={'autosave':True,'style':{'height':30,'width':200},'themes':['light','dark']}def__init__(self,name,age,friends):self.name=nameself.age=ageself.friends=friendsbob=Person(name="Bob",age=31,friends=[])jill=Person(name="Jill",age=29,friends=[bob])jack=Person(name="Jack",age=28,friends=[bob,jill])With magicattr we can do this# Nothing newassertmagicattr.get(bob,'age')==31# Listsassertmagicattr.get(jill,'friends[0].name')=='Bob'assertmagicattr.get(jack,'friends[-1].age')==29# Dict lookupsassertmagicattr.get(jack,'settings["style"]["width"]')==200# Combination of lookupsassertmagicattr.get(jack,'settings["themes"][-2]')=='light'assertmagicattr.get(jack,'friends[-1].settings["themes"][1]')=='dark'# Setattrmagicattr.set(bob,'settings["style"]["width"]',400)assertmagicattr.get(bob,'settings["style"]["width"]')==400# Nested objectsmagicattr.set(bob,'friends',[jack,jill])assertmagicattr.get(jack,'friends[0].friends[0]')==jackmagicattr.set(jill,'friends[0].age',32)assertbob.age==32You can also delete like this too.# Deletionmagicattr.delete(jill,'friends[0]')assertlen(jill.friends)==0magicattr.delete(jill,'age')assertnothasattr(jill,'age')magicattr.delete(bob,'friends[0].age')assertnothasattr(jack,'age')What if someone tries to mess with you?# Unsupportedwithpytest.raises(NotImplementedError)ase:magicattr.get(bob,'friends[0+1]')withpytest.raises(SyntaxError)ase:magicattr.get(bob,'friends[')withpytest.raises(ValueError)ase:magicattr.get(bob,'friends = [1,1]')# Nice try, function calls are not allowedwithpytest.raises(ValueError):magicattr.get(bob,'friends.pop(0)')Did I miss anything? Let me know!What it can't do?Slicing, expressions, function calls, append/pop from lists, eval stuff, etc...How does it work?Parses the attr string into an ast node and manually evaluates it.Installingpip install magicattrLicenseMITHope it helps, cheers!
Package: magicbell
MagicBell-Python SDKThis SDK provides convenient access to theMagicBell REST APIfrom applications written in Python. 
It includes helpers for creating notifications, managing users, managing projects, and executing GraphQL.This is an unofficial Python SDK forMagicBellopen sourced with ❤️ byNoteable, a collaborative notebook platform that enables teams to use and visualize data, together.Install|Getting Started|Examples|License|Code of Conduct|ContributingRequirementsPython 3.8+InstallationPoetrypoetryaddmagicbellThen import the package:importmagicbellPippipinstallmagicbellThen import the package:importmagicbellGetting Startedimportmagicbellfrommagicbell.configurationimportConfigurationconfig=Configuration(api_key="YOUR_API_KEY",api_secret="YOUR_API_SECRET",)asyncwithmagicbell.MagicBell(config)asmb:# Send a notificationawaitmb.realtime.create_notification(magicbell.WrappedNotification(notification=magicbell.Notification(title="My first notification from python!",recipients=[magicbell.Recipient(email="dan@example.com")],)))AuthenticationMost API calls require your MagicBell project API Key and API Secret.
Some API calls (i.e. projects) require your MagicBell user JWT (enterprise only).See theMagicBell API documentationfor more information.ConfigurationConfiguration can be done explicitly using themagicbell.Configurationclass,
or implicitly by setting environment variables with theMAGICBELL_prefix.Explicit Configurationfrommagicbell.configurationimportConfiguration# Create a configuration object with the required parametersconfig=Configuration(api_key="YOUR_API_KEY",api_secret="YOUR_API_SECRET",)Implicit ConfigurationexportMAGICBELL_API_KEY="YOUR_API_KEY"exportMAGICBELL_API_SECRET="YOUR_API_SECRET"frommagicbell.configurationimportConfigurationconfig=Configuration()ExamplesFor more examples see theexamplesdirectory.ContributingSeeCONTRIBUTING.md.Open sourced with ❤️ byNoteablefor the community.
Package: magic-calculator
Magic CalculatorMagic Calculator is a Python package that contains magic functions for random calculation along with normal functions for simple calculation.Installation and updatingUse the package managerpipto install Magic Calculator like below.
Rerun this command to check for and install updates .pip install magic_calculatorUsageFeatures:functions.addadd 2 numbersfunctions.subsubtract 2 numbersfunctions.multmultiply 2 numbersfunctions.divdivide 2 numbersdecorators.magicperform magic operation like random calculationDemo of some of the features:importmagic_calculator.functionsasmcfimportmagic_calculator.decoratorsasmcdsum_num=mcf.add(2,4)mag_cal=mcd.magic(5,7)ContributingFor major changes, please open an issue first to discuss what you would like to change.LicenseMIT
Package: magic-carpet
README for Magic-Carpet Python PackageOverviewMagic-Carpet is a versatile Python package that enables users to easily manage and deploy multiple model endpoints. It is designed to streamline the process of handling various machine learning models by providing a unified interface. With Magic-Carpet, users can create a customized router to dynamically choose which model to use based on the input, allowing for more efficient and targeted model inference.FeaturesMultiple Model Management: Easily spin up and manage multiple model endpoints using theNamedModelclass.Customized Routing: Design a customized router to decide per-input which model endpoint to hit.Dynamic Model Selection: Dynamically route requests to different models based on the input data.Ease of Integration: Simple integration with existing Python applications and machine learning workflows.Extensive Documentation: Includes detailed examples and use cases inexamples/.InstallationTo install Magic-Carpet, simply run:pipinstallmagic-carpetUsageSetting Up ModelsUse theNamedModelclass to define and spin up your model endpoints:frommagic_carpetimportNamedModel# Define modelsfoo=NamedModel(name="foo",function=lambdax:x+1)bar=NamedModel(name="bar",function=lambday:2*y)print(foo(1),bar(2))# 2, 4Customizing the RouterSubclass theNamedRouterclass to create a customized router for dynamic model selection:frommagic_carpetimportNamedRouterclassCustomRouter(NamedRouter):defroute(self,input,custom_arg):# Implement logic to choose model based on input_dataif(custom_argisnotNone)andinput>0:returnself.models["foo"]returnself.models["bar"]# Initialize the routerfoobar_router=CustomRouter([foo,bar])Running the RouterThe router itself is an instance ofNamedModeland thus can be called just like you would aNamedModel# Process an inputprint(foobar_router(5,custom_arg="hello"),foobar_router(-1))# 6, -2Running EvaluationsWe also provide util functions to test out multiple models over various evalaution functions. To learn more about this please refer toexamples/testing/example.ipynb.ExamplesFor a comprehensive guide and examples on how to use Magic-Carpet, please refer to the Jupyter notebooks inexamples/included in the package. These notebook provides more detailed instructions and use-cases for using this package.SupportFor issues, questions, or contributions, please refer to the GitHub repository:Magic-Carpet GitHub.LicenseMagic-Carpet is released under the MIT License. See the LICENSE file for more details.
Package: magic-class
magic-classmagic-classmakes GUI development as easy as daily coding by converting well-typed Python class directly into GUI. It is powered bymagicguiand has a smooth interface withnapari.magic-classis also implemented with useful widgets such asmatplotlibfigure canvas, logger widget and color edit.Target usersResearchers who already have their Python functions and classes and are planing to take a step forward to improve the interface using GUI, with minimum effort.Non-professional programmers who don't want to spend time on debugging and maintaining GUI.Users who are not satisfied with the low reproducibility of the most of the GUI.People who are familiar withmagicguiand interested in more sophisticated GUI using typing.How magic-class solves your problemsDecorate your class with@magicclassand you are ready to use the class both in GUI and from console.@magicclassimplements macro-recorder in the class. You can easily create executable Python codes from the history of manual operations.Your code looks almost "Pythonic". No need to be confused by messy class structure pecuilar to GUI development anymore.magic-classis work in progress. Feel free to report issues, make suggestions and contribute!DocumentationDocumentation is availablehere.Installationuse pippip install magic-class -U
pip install magic-class[pyqt5] -U  # with pyqt5 backendget the latest versionpip install git+https://github.com/hanjinliu/magic-class.gitExampleLet's make a simple GUI that can load 1-D data and plot it.frommagicclassimportmagicclassfrompathlibimportPath@magicclassclassPlotData:"""Load 1D data and plot it."""defload(self,path:Path):"""Load file.Parameters----------path : PathFile path"""self.data=np.loadtxt(str(path))defplot(self):"""Plot data."""plt.plot(self.data)plt.show()Classes decorated with@magicclassare converted tomagicgui'sContainerwidgets. GUI starts withshowmethod.ui=PlotData(title="Title")ui.show()You can continue analysis in console.ui.plot()For people doing image analysis, it can be added to anapariviewer as a dock widget.importnapariviewer=napari.Viewer()viewer.window.add_dock_widget(ui)Executable Python code (so called "macro" in many GUI tools) is available inmacroattribute.print(ui.macro)# print macroui.macro.widget.show()# open a text editor widget with macro written inTo make nicer GUI, you can also nestmagic-class:@magicclassclassPlotData:@magicclassclassMenu:...add a menubar with@magicmenudecorator:@magicclassclassPlotData:@magicmenuclassFile:...@magicmenuclassEdit:...add context menu with@magiccontextdecorator:@magicclassclassPlotData:@magiccontextclasscontextmenu:...defCopy(self):...defPaste(self):...directly integratemagicguiand its widgets:@magicclassclassPlotData:line=LineEdit()@magicguidefload(self,path:Path):...... and so on.Other examples are in the "examples" folder.
Package: magic-cli
Magic CLIThe best server maker.Steps:pip install magic-cli (make sure the pip points to the correct python (3.6+))cd into the directory you want the server to be in// use the cli to create the appmagic create < app name >cd < app name >// now make the virtual env and pip install the requirements
5) python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt// files needed to run
8) Create an .env file in the < app name > directory.a) Use the ".example_env" as a template. Fill in the env variables for the services you will need to use.b) The SERVICE and TASKS_TABLE_NAME are required for the app.// add firestoreadd the firestore service account json to the < app name > and name it "my-service-account.json"// to deploy to aws lambdaCreate a user on AWS and sign in via the CLI (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)npm imagic deployThat should be it for the setup!Time to run it!To start a local server: magic startTo test local server (while local server is running): magic testTo deploy for the first time or any time you change the serverless yaml: magic deployTo deploy when you just edited the app code: magic deploy_againTo update magic-cli:
pip install --upgrade magic-cli
Package: magiccluster
MAGICMulti-scAle heteroGeneity analysIs and ClusteringDocumentationMLNIMAGIC, Multi-scAle heteroGeneity analysIs and Clustering, is a multi-scale semi-supervised clustering method that aims to derive robust clustering solutions across different scales for brain diseases.:warning:The documentation of this software is currently under developmentCiting this workIf you use this software for clustering:Wen J., Varol E., Chand G., Sotiras A., Davatzikos C. (2020)MAGIC: Multi-scale Heterogeneity Analysis and Clustering for Brain Diseases. Medical Image Computing and Computer Assisted Intervention – MICCAI 2020. MICCAI 2020. Lecture Notes in Computer Science, vol 12267. Springer, Cham.https://doi.org/10.1007/978-3-030-59728-3_66Wen J., Varol E., Chand G., Sotiras A., Davatzikos C. (2022)Multi-scale semi-supervised clustering of brain images: Deriving disease subtypes. Medical Image Analysis, 2022.https://doi.org/10.1016/j.media.2021.102304-Link