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 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) 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 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: 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" }, ] 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()}") 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/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() diff --git a/test/test_3tabular.py b/test/test_3tabular.py index af1b6dc..1705d09 100644 --- a/test/test_3tabular.py +++ b/test/test_3tabular.py @@ -56,11 +56,17 @@ 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."""