microsoft / qsharp-compiler

Q# compiler, command line tool, and Q# language server
https://docs.microsoft.com/quantum
MIT License
682 stars 171 forks source link

Ability to run a Q# script #660

Open jamessdixon opened 4 years ago

jamessdixon commented 4 years ago

I just created my 1st Q# project in Codepsaces (beta) on GitHub following the "Develop With Q#" section found here. I noticed that I had to create a console application. Is there any way to create a Q# script (.qsx file) like I can do with F# and a .fsx file and use a REPL to work in the quantum language. Poor alternatives are to use jupyter notebooks (not really a REPL) or use the FSI to call Q# (want to stay only in Q#)

crazy4pi314 commented 4 years ago

Some folks in Q# Community have also have submitted to repl.it to add Q# support for no install experiences like what you are describing: https://repl.it/language-requests/p/q

jamessdixon commented 4 years ago

I upvoted the thread

On Sep 18, 2020, at 10:15 AM, Sarah Kaiser notifications@github.com wrote:

Some folks in Q# Community have also have submitted to repl.it to add Q# support for no install experiences like what you are describing: https://repl.it/language-requests/p/q https://repl.it/language-requests/p/q — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/Quantum/issues/429#issuecomment-694957708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKUPVFBYU77ZRCYGPWMGE3SGOBQNANCNFSM4RRZ5YTA.

cgranade commented 4 years ago

Thanks for filing this suggestion, @jamessdixon. If it's alright, I'll go on and transfer this feature request to the compiler repository. In the meantime, as a workaround, you can use the Python interoperability feature of the Quantum Development Kit to run files as though they were Q# scripts. In particular, the qsharp.compile function can be used to dynamically compiler Q# code from within Python.

jamessdixon commented 4 years ago

Sure, go ahead and move it

On Fri, Oct 2, 2020 at 11:27 AM Chris Granade notifications@github.com wrote:

Thanks for filing this suggestion, @jamessdixon https://github.com/jamessdixon. If it's alright, I'll go on and transfer this feature request to the compiler repository. In the meantime, as a workaround, you can use the Python interoperability feature of the Quantum Development Kit to run files as though they were Q# scripts. In particular, the qsharp.compile function https://docs.microsoft.com/en-us/python/qsharp-core/qsharp#compile-code--str-----typing-union-qsharp-loader-qsharpcallable--typing-list-qsharp-loader-qsharpcallable-- can be used to dynamically compiler Q# code from within Python.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/qsharp-compiler/issues/660#issuecomment-702860251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKUPVDLGRMBIP3YGAWCIODSIYEP5ANCNFSM4SB6QNSA .