Python file location
dn
PythonList at DancesWithMice.info
Wed Mar 29 23:59:59 EDT 2023
On 30/03/2023 09.47, windhorn wrote:
> I have an older laptop I use for programming, particularly Python and Octave, running a variety of Debian Linux, and I am curious if there is a "standard" place in the file system to store this type of program file. OK, I know they should go in a repository and be managed by an IDE but this seems like way overkill for the kind of programming that I do, normally a single file. Any suggestions welcome, thanks.
My home-directory has a sub-dir called Projects. Larger and identifiable
projects are put in their own sub-dir of that. There are also 'buckets'
which contain (usually single) files such as you describe, eg
PythonTraining, NotesInClass, and the one used when folk 'here' ask
code-questions: "experiments".
NB "Projects" may or may not be Python-based, eg may be the name of a
course, with sub-directories off that for each lecture or tutorial.
Python doesn't actually care where code is placed. The act of running a
script causes Python to add the script's directory to the PYTHONPATH.
That means that it will 'find' any files used by/from the script,
relative to that dir. Accordingly, use a dir-structure is probably more
about exerting some order over what would otherwise quickly become a
confusion!
As you say, I see little point in making "experiments" into a repo. The
life-time of any such code is that of the thread/conversation (Note to
self: should clean-up some of the old-stuff in there).
The others are set-up under git. That to enable the use of a GitLab
instance* as a form of off-site backup, or as a means of exchange with
others (at the project-level).
Again, agreeing with you: if PyCharm is not running, it might not be
worth (waiting while) firing it up just to check some 'experiment'. In
which case, either the task can be accomplished using the Python REPL,
or maybe a simple text-editor will be quite sufficient to copy-paste
code from an email-message and provide a basis for the-whatever (in a
file called "Allan.py", for example), and from which a
suggested-solution may be posted afterwards...
YMMV!
* New Zealand Open Source Society perq of membership
--
Regards,
=dn
More information about the Python-list
mailing list