Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
- **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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,4 @@ docs.save_documentation()
```

### Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
See [contributing.md](contributing.md)
16 changes: 9 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions mkgendocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pages:
- refresh
- PyPartitions:
- __init__
- refresh
- page: "Column.md"
source: 'pytabular/column.py'
classes:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
20 changes: 0 additions & 20 deletions pytabular/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")
Expand Down
5 changes: 5 additions & 0 deletions pytabular/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pytabular/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 7 additions & 1 deletion test/test_3tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down