Skip to content

Commit eac4a07

Browse files
authored
0.5.3 pythonnet upgrade (#97)
* update pythonnet and clr-loader * drop python version 3.7 support * added python version 3.11 and 3.12 support * update pbix testing file
1 parent 3b72d93 commit eac4a07

33 files changed

+70
-19
lines changed

pyproject.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "python_tabular"
7-
version = "0.5.2"
7+
version = "0.5.3"
88
authors = [
99
{ name="Curtis Stallings", email="curtisrstallings@gmail.com" },
1010
]
1111
dependencies = [
12-
"pythonnet==3.0.0a2",
13-
"clr-loader==0.1.7",
12+
"pythonnet==3.0.3",
13+
"clr-loader==0.2.6",
1414
"xmltodict==0.13.0",
1515
"pandas>=1.4.3",
1616
"requests>=2.28.1",
1717
"rich>=12.5.1"
1818
]
1919
description = "Connect to your tabular model and perform operations programmatically"
2020
readme = "README.md"
21-
requires-python = ">=3.7"
21+
requires-python = ">=3.8"
2222
classifiers = [
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
2325
"Programming Language :: Python :: 3.10",
24-
"Development Status :: 3 - Alpha",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Development Status :: 5 - Production/Stable",
2529
"Operating System :: Microsoft",
2630
"License :: OSI Approved :: MIT License"
2731
]

pytabular/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
It will setup logging and make sure Pythonnet is good to go.
55
Then it will begin to import specifics of the module.
66
"""
7+
78
# flake8: noqa
89
import logging
910
import os

pytabular/best_practice_analyzer.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
It is used with tabular_editor.py to run BPA.
55
I did not want to re-invent the wheel, so just letting TE2 work it's magic.
66
"""
7+
78
import logging
89
import requests as r
910
import atexit
@@ -20,7 +21,8 @@ def download_bpa_file(
2021
"https://raw.githubusercontent.com/microsoft/Analysis-Services/master/BestPracticeRules/BPARules.json" # noqa: E501
2122
),
2223
folder: str = "Best_Practice_Analyzer",
23-
auto_remove=True,
24+
auto_remove: bool = True,
25+
verify: bool = False,
2426
) -> str:
2527
"""Download a BPA file from local or web.
2628
@@ -34,6 +36,7 @@ def download_bpa_file(
3436
folder (str, optional): New folder string.
3537
Defaults to 'Best_Practice_Analyzer'.
3638
auto_remove (bool, optional): Auto Remove when script exits. Defaults to True.
39+
verify (bool, optional): Passthrough argument for `r.get`. Need to update later.
3740
3841
Returns:
3942
str: File path for the newly downloaded BPA.
@@ -42,7 +45,7 @@ def download_bpa_file(
4245
folder_location = os.path.join(os.getcwd(), folder)
4346
if os.path.exists(folder_location) is False:
4447
os.makedirs(folder_location)
45-
response = r.get(download_location)
48+
response = r.get(download_location, verify=verify)
4649
file_location = os.path.join(folder_location, download_location.split("/")[-1])
4750
with open(file_location, "w", encoding="utf-8") as bpa:
4851
json.dump(response.json(), bpa, ensure_ascii=False, indent=4)
@@ -55,7 +58,9 @@ def download_bpa_file(
5558
class BPA:
5659
"""Setting BPA Class for future work..."""
5760

58-
def __init__(self, file_path: str = "Default") -> None:
61+
def __init__(
62+
self, file_path: str = "Default", verify_download: bool = True
63+
) -> None:
5964
"""BPA class to be used with the TE2 class.
6065
6166
You can create the BPA class without any arguments.
@@ -64,10 +69,12 @@ def __init__(self, file_path: str = "Default") -> None:
6469
6570
Args:
6671
file_path (str, optional): See `Download_BPA_File()`. Defaults to "Default".
72+
verify_download (bool, optional): Passthrough argument for `r.get`.
73+
Need to update later.
6774
"""
6875
logger.debug(f"Initializing BPA Class:: {file_path}")
6976
if file_path == "Default":
70-
self.location: str = download_bpa_file()
77+
self.location: str = download_bpa_file(verify=verify_download)
7178
else:
7279
self.location: str = file_path
7380
pass

pytabular/column.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Once connected to your model, interacting with column(s) will be done through these classes.
44
"""
5+
56
import logging
67
import pandas as pd
78
from pytabular.object import PyObject, PyObjects

pytabular/culture.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""`culture.py` is used to house the `PyCulture`, and `PyCultures` classes."""
2+
23
import logging
34
from pytabular.object import PyObject, PyObjects
45
from typing import List
@@ -29,9 +30,9 @@ def set_translation(self) -> List[dict]:
2930
{
3031
"object_translation": translation.Value,
3132
"object_name": translation.Object.Name,
32-
"object_parent_name": translation.Object.Parent.Name
33-
if translation.Object.Parent
34-
else "",
33+
"object_parent_name": (
34+
translation.Object.Parent.Name if translation.Object.Parent else ""
35+
),
3536
"object_type": str(translation.Property),
3637
}
3738
for translation in self._object.ObjectTranslations

pytabular/document.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
This module can generate pages in markdown for use in Docusaurus.
44
"""
5+
56
import logging
67

78
from pathlib import Path

pytabular/logic_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""`logic_utils` used to store multiple functions that are used in many different files."""
2+
23
import logging
34
import datetime
45
import os

pytabular/measure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Once connected to your model, interacting with measure(s)
44
will be done through these classes.
55
"""
6+
67
import logging
78
import pandas as pd
89
from pytabular.object import PyObject, PyObjects

pytabular/object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
These classes are used with the others (Tables, Columns, Measures, Partitions, etc.).
44
"""
5+
56
from __future__ import annotations
67
from abc import ABC
78
from rich.console import Console

pytabular/partition.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Once connected to your model, interacting with partition(s) will be done through these classes.
44
"""
5+
56
import logging
67

78
from pytabular.object import PyObject, PyObjects

0 commit comments

Comments
 (0)