-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start working with ttrack integration #2
base: main
Are you sure you want to change the base?
Conversation
How to test these changes OBS: If the output is |
pyproject.toml
Outdated
@@ -26,6 +26,7 @@ black = "^22.3.0" | |||
flake8 = "^4.0.1" | |||
isort = "^5.10.1" | |||
pre-commit = "^2.18.1" | |||
humanfriendly = "^10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for including this new dep?
btw, adding a new dep to a project could be very impacting ..
be very careful adding a new dep to a project, normally you should have a very good reason for that.
.gitignore
Outdated
@@ -1,2 +1,4 @@ | |||
*.env* | |||
__pycache__ | |||
.vscode/ | |||
data_test/.timetrackdb* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you will have a sample for tests, (for python projects) you normally add it to/tests/data
4fc6257
to
3924192
Compare
@@ -24,7 +24,7 @@ Example: | |||
```bash | |||
python invoicex/main.py \ | |||
--year-month 2022-04 \ | |||
--gh-user xmnlab \ | |||
--gh-user $USER \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just an example, it is not a problem to have a fixed user here.
$USER is a system user, not a gh user, so it will be more confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
@@ -5,8 +5,9 @@ | |||
import os | |||
import time | |||
|
|||
import reader | |||
import invoicex.reader.github as github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import invoicex.reader.github as github | |
from invoicex.reader import ComposeReader |
the idea is to hide all the complexity and use ComposeReader as the main interface for the reading.
ComposeReader will receive the parameters about which datasets/data-sources will be used (for now, we just have github and ttrack)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
import report | ||
import invoicex.reader.ttrack as ttrack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import invoicex.reader.ttrack as ttrack |
in main.py we don't need to access ttrack nor github .. just ComposeReader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
invoicex/main.py
Outdated
|
||
return parser | ||
|
||
|
||
async def main(): | ||
args = cli_parser().parse_args() | ||
results = await reader.get_data(args) | ||
results = await github.get_data(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ComposeReader will return the data from ttrack and github combined
invoicex/reader/ttrack.py
Outdated
|
||
# e = TTrack(TTRACK_DB) | ||
# print(e()) | ||
def get_data(args) -> pd.DataFrame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep in mind that it would be just temporary because ComposeReader will instantiate TTrack inside (probably an attribute called ttrack inside the ComposeReader class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll handle all the comments in next commits, sending now what I got while trying to async TTrack to see if it is correct before externalizing it in ComposeReader
How to test these changes run OBS: If the output is TypeError: 'NoneType' object cannot be interpreted as an integer, you should stop the current task from TTrack and recopy the database. |
@@ -1,2 +1,4 @@ | |||
*.env* | |||
__pycache__ | |||
.vscode/ | |||
data_test/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want a test data folder change it to:
data_test/ | |
tests/data |
it is the most common way to do that
.ONESHELL: | ||
|
||
.PHONY:ttrack-db | ||
ttrack-db: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it used just for development right? if yes, better to have a name that forces this idea:
ttrack-db: | |
dev-dump-ttrack-db: |
@@ -24,7 +24,7 @@ Example: | |||
```bash | |||
python invoicex/main.py \ | |||
--year-month 2022-04 \ | |||
--gh-user xmnlab \ | |||
--gh-user $USER \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
@@ -5,8 +5,9 @@ | |||
import os | |||
import time | |||
|
|||
import reader | |||
import invoicex.reader.github as github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
import report | ||
import invoicex.reader.ttrack as ttrack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check this comment
|
||
return parser | ||
|
||
|
||
async def main(): | ||
args = cli_parser().parse_args() | ||
results = await reader.get_data(args) | ||
await report.generate(results, args) | ||
results = await ttrack.get_data(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you should instantiate the ComposeReader, not the ttrack class
return df_grouped | ||
|
||
|
||
async def get_data(args) -> pd.DataFrame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably will not need this function because all the construction should be done by the ComposeReader
Pull Request description
This is a initial branch meant to saving my work for today, but furthermore it will be the implementation of ttrack in the invoices
Working on #1
How to test these changes
$python invoicex/ttrack.py
from the root of the projectPull Request checklists
This PR is a:
About this PR:
Author's checklist:
Additional information
Reviewer's checklist
Copy and paste this template for your review's note: