Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 2c74ec8

Browse files
committed
Preserve the cell magic context's import path
The context still needs to be importable from the old path
1 parent 83218a2 commit 2c74ec8

13 files changed

Lines changed: 93 additions & 94 deletions

File tree

docs/magics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IPython Magics for BigQuery
22
===========================
33

4-
.. automodule:: google.cloud.bigquery.ipython_magics.magics
4+
.. automodule:: google.cloud.bigquery.magics.magics
55
:members:

google/cloud/bigquery/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
def load_ipython_extension(ipython):
152152
"""Called by IPython when this module is loaded as an IPython extension."""
153-
from google.cloud.bigquery.ipython_magics.magics import _cell_magic
153+
from google.cloud.bigquery.magics.magics import _cell_magic
154154

155155
ipython.register_magic_function(
156156
_cell_magic, magic_kind="cell", magic_name="bigquery"

google/cloud/bigquery/ipython_magics/__init__.py renamed to google/cloud/bigquery/magics/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
from google.cloud.bigquery.magics.magics import context
16+
17+
18+
# For backwards compatibility we need to make the context available in the path
19+
# google.cloud.bigquery.magics.context
20+
__all__ = ("context",)

google/cloud/bigquery/ipython_magics/line_arg_parser/__init__.py renamed to google/cloud/bigquery/magics/line_arg_parser/__init__.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from google.cloud.bigquery.ipython_magics.line_arg_parser.exceptions import ParseError
16-
from google.cloud.bigquery.ipython_magics.line_arg_parser.exceptions import (
15+
from google.cloud.bigquery.magics.line_arg_parser.exceptions import ParseError
16+
from google.cloud.bigquery.magics.line_arg_parser.exceptions import (
1717
DuplicateQueryParamsError,
1818
QueryParamsParseError,
1919
)
20-
from google.cloud.bigquery.ipython_magics.line_arg_parser.lexer import Lexer
21-
from google.cloud.bigquery.ipython_magics.line_arg_parser.lexer import TokenType
22-
from google.cloud.bigquery.ipython_magics.line_arg_parser.parser import Parser
23-
from google.cloud.bigquery.ipython_magics.line_arg_parser.visitors import (
24-
QueryParamsExtractor,
25-
)
20+
from google.cloud.bigquery.magics.line_arg_parser.lexer import Lexer
21+
from google.cloud.bigquery.magics.line_arg_parser.lexer import TokenType
22+
from google.cloud.bigquery.magics.line_arg_parser.parser import Parser
23+
from google.cloud.bigquery.magics.line_arg_parser.visitors import QueryParamsExtractor
2624

2725

2826
__all__ = (

google/cloud/bigquery/ipython_magics/line_arg_parser/exceptions.py renamed to google/cloud/bigquery/magics/line_arg_parser/exceptions.py

File renamed without changes.

google/cloud/bigquery/ipython_magics/line_arg_parser/lexer.py renamed to google/cloud/bigquery/magics/line_arg_parser/lexer.py

File renamed without changes.

google/cloud/bigquery/ipython_magics/line_arg_parser/parser.py renamed to google/cloud/bigquery/magics/line_arg_parser/parser.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from google.cloud.bigquery.ipython_magics.line_arg_parser import (
16-
DuplicateQueryParamsError,
17-
)
18-
from google.cloud.bigquery.ipython_magics.line_arg_parser import ParseError
19-
from google.cloud.bigquery.ipython_magics.line_arg_parser import QueryParamsParseError
20-
from google.cloud.bigquery.ipython_magics.line_arg_parser import TokenType
15+
from google.cloud.bigquery.magics.line_arg_parser import DuplicateQueryParamsError
16+
from google.cloud.bigquery.magics.line_arg_parser import ParseError
17+
from google.cloud.bigquery.magics.line_arg_parser import QueryParamsParseError
18+
from google.cloud.bigquery.magics.line_arg_parser import TokenType
2119

2220

2321
class ParseNode(object):

google/cloud/bigquery/ipython_magics/line_arg_parser/visitors.py renamed to google/cloud/bigquery/magics/line_arg_parser/visitors.py

File renamed without changes.

google/cloud/bigquery/ipython_magics/magics.py renamed to google/cloud/bigquery/magics/magics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
from google.cloud import bigquery
161161
import google.cloud.bigquery.dataset
162162
from google.cloud.bigquery.dbapi import _helpers
163-
from google.cloud.bigquery.ipython_magics import line_arg_parser as lap
163+
from google.cloud.bigquery.magics import line_arg_parser as lap
164164

165165

166166
IPYTHON_USER_AGENT = "ipython-{}".format(IPython.__version__)

tests/unit/line_arg_parser/test_lexer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
@pytest.fixture(scope="session")
1919
def lexer_class():
20-
from google.cloud.bigquery.ipython_magics.line_arg_parser.lexer import Lexer
20+
from google.cloud.bigquery.magics.line_arg_parser.lexer import Lexer
2121

2222
return Lexer
2323

2424

2525
def test_empy_input(lexer_class):
26-
from google.cloud.bigquery.ipython_magics.line_arg_parser import TokenType
27-
from google.cloud.bigquery.ipython_magics.line_arg_parser.lexer import Token
26+
from google.cloud.bigquery.magics.line_arg_parser import TokenType
27+
from google.cloud.bigquery.magics.line_arg_parser.lexer import Token
2828

2929
lexer = lexer_class("")
3030
tokens = list(lexer)

0 commit comments

Comments
 (0)