Skip to content

Conversation

@EricDeveaud
Copy link

we had the need to provide a standalone CLI utility scripts for template download.
this basic script wraps the python module and provide a CLI interface

maybee it will be usefull for templateflow users

regards

Eric

Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this contribution, and apologies for having failed to spot it until now.

I have added some comments. Please run black to style the code with templateflow's standards.


[options.entry_points]
console_scripts =
templateflow_get=templateflow.templateflow_get:main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
templateflow_get=templateflow.templateflow_get:main
templateflow=templateflow.templateflow_get:main

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum I'm affraid it will collapse will templateflow name space....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried? because it won't...

@@ -0,0 +1,197 @@
#!/opt/gensoft/exe/TemplateFlow_pyclient/0.8.0/venv/bin/python3.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have the standard apache header (which implicitly means you accept your contribution is covered by the license).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, I should have cleaned this sehbang.
I will


import pprint

TOOL_VERSION = '0.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why having a different version for this module?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first itération of the "getter" tool, I will comply with the module version instead

Comment on lines +92 to +95
m_group.add_argument('-o', '--tf-cache',
action='store',
default='unset',
help='Directory to save templates in. default `${HOME}/.cache/templateflow`')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works around the TEMPLATEFLOW_HOME environment variable definition. please remove the option to do that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure to understand
this will allow users to grab the templates where they want.
maybee I did not cactch the templateflow philosophy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should only give access to the templateflow API. There is no function to change TEMPLATEFLOW_HOME within the API, and the CLI shouldn't either.

If a user wants to change where templates are cached, they should set the environment variable themselves.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK got the point. I will adapt regarding this point.
thanks for the feedback

Eric

Comment on lines +170 to +174
if opts.tf_cache != 'unset':
#---- TemplatFlow cache dir was specified, export it
print("saving to ---------->", opts.tf_cache)
print("saving to ---------->", os.path.abspath(opts.tf_cache))
os.environ['TEMPLATEFLOW_HOME'] = os.path.abspath(opts.tf_cache)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be managed by templateflow

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to me I was lazy and copied this spnippet from the docs or examples .

@oesteban oesteban linked an issue May 7, 2022 that may be closed by this pull request
@oesteban
Copy link
Member

Hi @EricDeveaud, do you have the bandwidth to take this over the finish line?

@EricDeveaud
Copy link
Author

hello,

unfortunatly currently not.

sorry for the delay

Eric

@oesteban
Copy link
Member

Closing in favor of #123.

@oesteban oesteban closed this Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose a command line interface

2 participants