Friday finking: IDE 'macro expansions'

dn PythonList at DancesWithMice.info
Sat Mar 18 19:11:07 EDT 2023


On 19/03/2023 01.27, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
> On 2023-03-18 at 11:49:24 +0000,
> "Weatherby,Gerard" <gweatherby at uchc.edu> wrote:
> 
>> For templating, I have two Python programs for starting new work. One
>> generates a standalone Python program with the Python shebang, a
>> __main__ which calls def main(), and logging and argparser
>> intialization. The other generates a pyproject.toml /setup.cfg
>> directory structure with a main.py referenced as a console
>> script. from setup.cfg
> 
> You don't describe the process for using those programs, but if you
> "have two Python programs," then it sounds like you're *not* using the
> IDE/editor for that.
> 
> (I'm not judging, I'm trying to relate your answer to dn's original
> question.)

It is a good example of a facility or 'power' of an IDE - even if 
there's room for more information...


The team I'm currently assisting has decided to use Poetry.

PyCharm will create a new project, populating basic files, more-or-less 
as @George described. In the same way, if one prefers a venv (etc) 
instead of a Poetry structure, PyCharm will set things up similarly.

Accordingly, it saves a lot of time, fiddling-about creating a bunch of 
(basically) empty files and sub-dirs.

(that said, there a plenty of operations which have a blank-project 
template which can be copied-in and renamed...)


Continuing the story, let's say the project calls for a PyPi-based* 
library, eg more_itertools, or there's a team 'standard', eg pytest; 
then these can be selected from a PyCharm-provided list (no need to go 
to PyPi to download) AND that operation will also be reflected in the 
pyproject.toml file.

* cf one from the PSL

In other words, the build file has been created and 
continually-maintained, by the IDE, ready for when the project is to be 
uploaded to a library or exported to target-machines; cf the 'tradition' 
of an extra, last, and not looked-forward-to, step in the process!


> For an opposing view, I'm much more likely to copy an old project (at
> the command line, often with sed) and then use my editor to morph it
> into a new project.  IME, unless there's an imposed process, those
> templates and programs tend to experience bitrot, whereas going back to
> an old program gives me the chance to keep it up to date w.r.t. what
> I've learned more recently, which helps reinforce said learning.

Yes...
(guilty as charged!)

Equally, may promulgate old habits and a lower-quality (related to the 
depth of learning, back-then cf 'now').

-- 
Regards,
=dn


More information about the Python-list mailing list