-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from scrambldchannel/feat/add_chore
feat: add chore
- Loading branch information
Showing
12 changed files
with
173 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# How to package | ||
|
||
Pretty rough so far, can be improved/automated. | ||
|
||
## Bump Version | ||
|
||
Bump version in `src/tm1filetools/__init__.py` e.g.: | ||
|
||
```python | ||
"""A package for working with files created by a TM1 database.""" | ||
|
||
from .tools import TM1FileTool # noqa | ||
|
||
__version__ = "0.3.2" # noqa | ||
``` | ||
|
||
## Publish to PyPI | ||
|
||
```sh | ||
flit build | ||
``` | ||
|
||
## Publish to PyPI | ||
|
||
```sh | ||
flit publish | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
TM1 File Tools | ||
============== | ||
|
||
A Python package that simplifies working with files associated with a | ||
TM1 server. It’s primarily useful for linting or cleaning up a server | ||
directory without a dependency on a running TM1 Server. | ||
|
||
What it does | ||
------------ | ||
|
||
- Scans a TM1 database folder and finds most TM1 related files | ||
(e.g. ``.cub``, ``.rux`` etc) | ||
- Provides methods to rename and delete files and properties specific | ||
to a file type (e.g. the cube a ``.vue`` file refers to) | ||
- Return lists of “orphaned” files (e.g. a ``.rux`` without a | ||
corresponding ``.cub``) | ||
|
||
What it doesn’t do | ||
------------------ | ||
|
||
- Operations on binary files (e.g. it can’t read or edit a ``.cub`` | ||
file) | ||
- Genuine parsing of text files (e.g. it can’t verify whether a | ||
``.rux`` is valid) | ||
- Interact with the REST API (use | ||
`TM1py <https://github.com/cubewise-code/tm1py>`__ for that) | ||
|
||
Installation | ||
------------ | ||
|
||
.. code:: sh | ||
pip install tm1filetools | ||
Example Usage | ||
------------- | ||
|
||
.. code:: python | ||
from pathlib import Path | ||
from tm1filetools import TM1FileTool | ||
path = Path("./data") | ||
ft = TM1FileTool(path) | ||
orphans = ft.get_orphan_rules() | ||
... | ||
ft.delete_all_blbs() | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
from .tools import TM1FileTool # noqa | ||
|
||
__version__ = "0.3.1" # noqa | ||
__version__ = "0.3.2" # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from pathlib import Path | ||
|
||
from .text import TM1TextFile | ||
|
||
|
||
class TM1ChoreFile(TM1TextFile): | ||
""" | ||
A class representation of a tm1 TI process file | ||
""" | ||
|
||
suffix = "cho" | ||
|
||
def __init__(self, path: Path): | ||
|
||
super().__init__(path) | ||
|
||
# A chore is just a text file that holds a name, processes to run and params, and scheduling information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from pathlib import Path | ||
|
||
from tm1filetools.files import TM1ChoreFile | ||
|
||
|
||
def test_init(test_folder): | ||
|
||
p = TM1ChoreFile(Path.joinpath(test_folder, "copy data from my cube.cho")) | ||
|
||
assert p | ||
assert p.suffix == "cho" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters