• Python file location

    From windhorn@21:1/5 to All on Wed Mar 29 13:47:25 2023
    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.

    Regards, Allen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Cameron Simpson@21:1/5 to windhorn on Thu Mar 30 12:24:11 2023
    On 29Mar2023 13:47, windhorn <[email protected]> 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.

    Are you writing personal scripts? ~/bin then.

    Person modules you import in your personal scripts? I put these in ~/lib/python/cs/ for my modules, which are all named "cs.*" (avoids
    conflict). But that's just me.

    Cheers,
    Cameron Simpson <[email protected]>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to windhorn on Thu Mar 30 12:56:34 2023
    On Thu, 30 Mar 2023 at 11:08, windhorn <[email protected]> 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.


    Standard? No. Do whatever you like :) But there are a few useful
    conventions. Personally, I keep all my random tools in a shed -
    specifically, ~/shed, which is a single git repository in which I
    throw all sorts of random junk, mostly those single-file scripts that
    don't have any other real identity.

    (Some of them do end up growing more files. It's rather ill-defined as
    a concept.)

    You could also just leave them in your home directory. That's pretty decent too.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dn@21:1/5 to windhorn on Thu Mar 30 16:59:59 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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Loris Bennett@21:1/5 to windhorn on Thu Mar 30 08:19:03 2023
    windhorn <[email protected]> writes:

    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.

    How about /usr/local/bin? That should already be included in $PATH.

    Cheers,

    Loris

    --
    This signature is currently under constuction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to windhorn on Thu Mar 30 10:53:19 2023
    Supersedes: <[email protected]>
    [added "start" in the last line]

    windhorn <[email protected]> writes:
    place in the file system to store this type of program file.

    I'm not sure which type of program file you refer to.

    But, I use two different places for my scripts:

    For a quick script I write to try something out and may
    not need later I just save it into a "tmp" directory.

    (I am very impatient sometimes. When I want to start a new
    script, IDLE first wants me to save it and, thus, think of
    a filename for it. Sometimes I think that I do not have time
    for this at that moment. So I have modified my IDLE to create
    a filename itself, save and immediately execute the file.)

    When I am developing a script I work on for a longer time,
    I place it into its own project directory, which is in my
    directory for projects, which is in my home directory.

    After the development is "finished", I usually let the
    script stay in it's development directory.

    When I start a script often, I might write some aliases
    (under a text shell) or add a shortcut to a start menu
    (under a GUI) to start the script quickly and easily.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From windhorn@21:1/5 to All on Sun Apr 2 12:05:04 2023
    Thanks to all for suggestions. Linux has "too much freedom" :-)

    Regards,
    Allen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)