From a9f2ac225103f4b0c0457bc78d7be4cee729a96a Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:34:01 -0600 Subject: [PATCH 1/9] contributing.md reference fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5c678d..8be7529 100644 --- a/README.md +++ b/README.md @@ -335,4 +335,4 @@ docs.save_documentation() ``` ### Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md) +See [contributing.md](contributing.md) From 2a37da4417ba86d777d7e50e73f55a61a64d2e97 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:34:24 -0600 Subject: [PATCH 2/9] 0.3.7 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ac988eb..8ca63de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "python_tabular" -version = "0.3.6" +version = "0.3.7" authors = [ { name="Curtis Stallings", email="curtisrstallings@gmail.com" }, ] From b42e43762a22097e3bdcde1cc9145fe30965df29 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:34:49 -0600 Subject: [PATCH 3/9] Partitions.refresh() with added pytest --- pytabular/partition.py | 5 +++++ test/test_3tabular.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pytabular/partition.py b/pytabular/partition.py index e1cc395..d413f31 100644 --- a/pytabular/partition.py +++ b/pytabular/partition.py @@ -74,3 +74,8 @@ class PyPartitions(PyObjects): def __init__(self, objects) -> None: """Extends through to `PyObjects`.""" super().__init__(objects) + + def refresh(self, *args, **kwargs): + """Refreshes all `PyPartition`(s) in class.""" + model = self[0].Table.Model + return model.refresh(self, *args, **kwargs) diff --git a/test/test_3tabular.py b/test/test_3tabular.py index af1b6dc..9d3ea3c 100644 --- a/test/test_3tabular.py +++ b/test/test_3tabular.py @@ -56,11 +56,16 @@ def test_pytables_refresh(model): @pytest.mark.parametrize("model", testing_parameters) -def test_pypartitions_refresh(model): +def test_pypartition_refresh(model): """Tests refreshing partition of testingtable.""" assert len(model.Tables[testingtablename].Partitions[0].refresh()) > 0 +@pytest.mark.parametrize("model", testing_parameters) +def test_pypartitions_refresh(model): + """Tests refreshing partitions of testingtable.""" + assert len(model.Tables[testingtablename].Partitions.refresh()) > 0 + @pytest.mark.parametrize("model", testing_parameters) def test_pyobjects_adding(model): """Tests adding a PyObject.""" From ef5733bc5ec7713e5435ae2096017847e615d34b Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:35:10 -0600 Subject: [PATCH 4/9] removing find version --- pytabular/__init__.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/pytabular/__init__.py b/pytabular/__init__.py index 9843042..a379ba3 100644 --- a/pytabular/__init__.py +++ b/pytabular/__init__.py @@ -33,26 +33,6 @@ logger.info(f"Python Version::{sys.version}") logger.info(f"Python Location::{sys.exec_prefix}") - - -def find_version() -> str: - """Finds PyTabular version. - - Returns: - str: Version as string. - """ - version_str = "\nversion = " - with open("pyproject.toml", "r") as f: - pyproject_text = f.read() - start = pyproject_text.find(version_str) + len(version_str) - end = pyproject_text.find("\n", start) - return pyproject_text[start:end].replace('"', "") - - -try: - logger.info(f"PyTabular Version:: {find_version()}") -except Exception: - logger.warning("Unable to find PyTabular Version") logger.info(f"Package Location:: {__file__}") logger.info(f"Working Directory:: {os.getcwd()}") logger.info(f"Platform:: {sys.platform}-{platform.release()}") From aaad3dfb288ca10ccd6305665d9c94bd30fafbe4 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:35:28 -0600 Subject: [PATCH 5/9] reconnect typo --- pytabular/refresh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytabular/refresh.py b/pytabular/refresh.py index 68caf6a..f88f9e7 100644 --- a/pytabular/refresh.py +++ b/pytabular/refresh.py @@ -413,7 +413,7 @@ def run(self) -> pd.DataFrame: """ if self.model.Server.Connected is False: logger.info(f"{self.Server.Name} - Reconnecting...") - self.model.recconect() + self.model.reconnect() if self.trace is not None: self.trace.start() From 522d8a4409e7e403ccd20cde3283e8aae0aa1c7a Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:35:44 -0600 Subject: [PATCH 6/9] Contributing update --- CONTRIBUTING.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1f3f6a..d8b779d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,26 @@ # Contributing Guidelines -- Work will be distributed under MIT license. -- See github actions for checks run on pull request. -- Updates of any kind are welcome! Even just letting me know of the issues. Or updating doc strings... -- Limit any external modules, see pyproject.toml for dependencies -- Goal of project is to help connect the python world and the tabular model world for some easier programmatic execution on models. +## Goal +- Make **Python** a first class citizen for interacting with **Tabular models**. + +## Some rules +- See [github actions](https://github.com/Curts0/PyTabular/actions) for checks run on pull request. +- We `docstring-coverage` to check for 100% docstring coverage. +- `flake8` also runs, but with a few extra packages. (pep8-naming, flake8-docstrings). +- Updates of any kind are welcome! Even just letting me know of the issues. Or updating docstrings... +- Limit any extra packages, see `pyproject.toml` for dependencies - Install pre-commit. Pre-commit will run pytest, flake8, and docstr-coverage before push. ```powershell pip install pre-commit pre-commit install --hook-type pre-push ``` -- This will take a while... pytest will open a PBIX file in repository and run tests on it. \ No newline at end of file +- **This will take a while...** pytest will open a PBIX file in repository and run tests on it... Eventually these tests will be run on a model that is not local. + +## Documentation help +- Docstrings follow the google docstring convention. See [Example](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html). +- The `flake8-docstrings` will check that google docstring format is followed. +- Docstrings get converted to markdown with the `mkgendocs` package. +- Then gets converted to `readthedocs` site with the `mkdocs` package. + +## Misc +- Work will be distributed under a MIT license. \ No newline at end of file From 3f4d15bd0b45dcbaffb47f9104c7c1153c455123 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:36:19 -0600 Subject: [PATCH 7/9] add partition refresh to doc generation --- mkgendocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkgendocs.yml b/mkgendocs.yml index e61be7d..b47a82b 100644 --- a/mkgendocs.yml +++ b/mkgendocs.yml @@ -60,6 +60,7 @@ pages: - refresh - PyPartitions: - __init__ + - refresh - page: "Column.md" source: 'pytabular/column.py' classes: From f1a61aee76f45faecaf3a55d8d5adaa04be7eede Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:36:36 -0600 Subject: [PATCH 8/9] Rename and rework layout --- mkdocs.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index da18c92..dcce817 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,15 +2,17 @@ site_name: PyTabular site_url: https://curts0.github.io/PyTabular/ nav: - Home: index.md - - Tabular: Tabular.md - - Table: Table.md - - Partition: Partition.md - - Column: Column.md - - Measure: Measure.md - - Trace: Traces.md - - Queries: Queries.md + - Main Tabular Class: Tabular.md + - Refreshing: Refreshes.md + - Querying: Queries.md + - Tables: Table.md + - Partitions: Partition.md + - Columns: Column.md + - Measures: Measure.md + - Traces: Traces.md - Best Practice Analyzer: Best Practice Analyzer.md - Tabular Editor: Tabular Editor 2.md - PBI Helper: PBI Helper.md - Logic Utils: Logic Utils.md + - Contributing: contributing.md theme: readthedocs From 0f0f6adb36095789408588e4417d93f5d854aace Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Sun, 12 Feb 2023 10:38:32 -0600 Subject: [PATCH 9/9] flake8 extra line fix --- test/test_3tabular.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_3tabular.py b/test/test_3tabular.py index 9d3ea3c..1705d09 100644 --- a/test/test_3tabular.py +++ b/test/test_3tabular.py @@ -66,6 +66,7 @@ def test_pypartitions_refresh(model): """Tests refreshing partitions of testingtable.""" assert len(model.Tables[testingtablename].Partitions.refresh()) > 0 + @pytest.mark.parametrize("model", testing_parameters) def test_pyobjects_adding(model): """Tests adding a PyObject."""