-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add support for templates #13
Conversation
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.
Cool, I wasn't aware that you can also easily write RST templates (instead of HTML) using jinja2.
I started with a round of first comments. Maybe you start rebasing this branch and answering to the first comments.
In the mean time I will continue looking into more detail into some of the solutions, e.g. the additional properties and add further comments. But I think overall the templating looks like a good solution and we can integrate this pull request.
The templates under package_data = {'audbcards': ['core/templates/*']} What needs then to be added in addition to the code is how to handle user provided templates (that overwrite the default templates), but I think we should tackle this in a different pull request and just focus to provide fixed default templates in this pull request. |
This package currently has no import audb
import audbcards
import audeer
# Configuration -----------------------------------------------------------
REPOSITORIES = [
audb.Repository(
name='data-public',
host='https://audeering.jfrog.io/artifactory',
backend='artifactory',
),
]
# Functions to create data cards -------------------------------------------
def run():
# Set internal repositories
audb.config.REPOSITORIES = REPOSITORIES
print('Get list of available datasets... ', end='', flush=True)
df = audb.available(only_latest=True)
df = df.sort_index()
print('done')
# Clear existing data cards
audeer.rmdir('datasets')
audeer.mkdir('datasets')
# Iterate datasets and create data card pages
names = list(df.index)
versions = list(df['version'])
datasets = []
for (name, version) in zip(names, versions):
print(f'Parse {name}-{version}... ', end='', flush=True)
dataset = audbcards.Dataset(name, version)
audbcards.core.dataset.create_datacard_page_from_template(dataset)
datasets.append(dataset)
print('done')
# Create datasets overview page
audbcards.core.dataset.create_datasets_page_from_template(datasets) This runs through, but it does not produce the required |
I pulled, but there were no upstream changes that I needed to rebase. |
But why is it then showing this: |
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Merged. Probably allows to close some of the open comments. |
This should be solved. |
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.
Cool, I think we are nearly there. I added a few more comments and created #22 to see at a later stage what should be part of audcards.Dataset
and what could go directly to audbcards.Datacard
having in mind the first gathers information and the second presents them.
Co-authored-by: Hagen Wierstorf <[email protected]>
|
This should be resolved already. |
The changes in the |
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
The tests are failing here and passing locally for me. But looking at languages=['eng', 'de'], This most likely means we are still using some cache folder outside of the test tmp folders. I will have a look into it. |
I was able to fix the problem: >>> pd.to_timedelta(302, unit='s')
Timedelta('0 days 00:05:02') |
Great, I updated the description and we are ready to merge here. |
Closes #5
Introduces
audbcard.Datacard
that handles the creation of the single datacards with:It further uses Jinja2 to provide RST templates for the single datacard pages and the overview page listing all datasets.