pyscaffold/pyscaffoldext-dsproject

Small improvements

abravalheri opened this issue · 5 comments

When generating a project with the latest version of dsproject, a dev can be surprised by 2 things:

  • The docs refer to AUTHORS.rst and CHANGELOG.rst, but now pyscaffoldext-markdown produces markdown files instead
  • On the first commit, without making any changes to the templates, pre-commit strikes back with:
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /home/abravalheri/projects/samsung-mec-rl/scripts/train_model.py

--- i/scripts/train_model.py
+++ w/scripts/train_model.py
@@ -4,9 +4,8 @@ import sys
 from pathlib import Path

 import click
-from IPython.core import ultratb
-
 import drl
+from IPython.core import ultratb

I suppose it would be a nicer experience if the templates work with pre-commit out-of-the-box (probably adding a test for that in the suite would be nice, we have something like that in PyScaffold v4).

Thanks, @abravalheri for pointing those errors. It's strange though that isort suggests removing an empty line and putting the package drl before an external package.

Thanks @FlorianWilhelm for having a look at this, that was very quick!

I will double check here, maybe it is my pre-commit and isort versions that are outdated (usually those problems happen when new versions of isort or black are released and conflict with each other)

On second thought...

That is likely happening because the package has a namespace... drl is the package I am developing but it is being generated inside a namespace. I suppose the train_model.py should use the fully qualified package name? (In the core PyScaffold repo we have that working for the test files, right? Maybe replacing ${package} with ${qual_pkg} would solve it?

(I confess sometimes I abuse namespaces... I just find it handy to have a single namespace for every project at work and then separate the different parts of the project in independent packages)

On a more general note @abravalheri, does that mean one should just always use ${qual_pkg} everywhere? Should this be more stressed in the docs?

Yeah, I think it is worthy to mention this in the extensions section of PyScaffold docs... Let's open an issue there so when someone have the time we can add it.

Thank you very much for the fixes!