gitignore: Add venv directory to gitignore
diff mbox series

Message ID 20241009071608.468018-1-stefan.klug@ideasonboard.com
State Accepted
Headers show
Series
  • gitignore: Add venv directory to gitignore
Related show

Commit Message

Stefan Klug Oct. 9, 2024, 7:16 a.m. UTC
The python venv module is the standard way of creating virtual python
environments. 'venv' is a commonly used name for the corresponding
directory. For example in the tuning docs we propose to execute 'python
-m venv venv' to setup a local virtual environment.  During development
I often have these scattered around in the source tree and they show up
as untracked files in git. Add venv to .gitignore to prevent that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

Comments

Dan Scally Oct. 9, 2024, 7:33 a.m. UTC | #1
Hi Stefan

On 09/10/2024 08:16, Stefan Klug wrote:
> The python venv module is the standard way of creating virtual python
> environments. 'venv' is a commonly used name for the corresponding
> directory. For example in the tuning docs we propose to execute 'python
> -m venv venv' to setup a local virtual environment.  During development
> I often have these scattered around in the source tree and they show up
> as untracked files in git. Add venv to .gitignore to prevent that.
>
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>   .gitignore | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/.gitignore b/.gitignore
> index f6d1d68e4a7c..51d3144085ce 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -6,3 +6,4 @@
>   *.patch
>   *.pyc
>   __pycache__/
> +venv/
Kieran Bingham Oct. 9, 2024, 8:35 a.m. UTC | #2
Quoting Dan Scally (2024-10-09 08:33:05)
> Hi Stefan
> 
> On 09/10/2024 08:16, Stefan Klug wrote:
> > The python venv module is the standard way of creating virtual python
> > environments. 'venv' is a commonly used name for the corresponding
> > directory. For example in the tuning docs we propose to execute 'python
> > -m venv venv' to setup a local virtual environment.  During development
> > I often have these scattered around in the source tree and they show up
> > as untracked files in git. Add venv to .gitignore to prevent that.
> >
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > ---

I would wonder if venv isn't just a global thing to ignore, but as we
have python bindings in libcamera it might be slightly more relevant, so
I don't specifically object.

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> >   .gitignore | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/.gitignore b/.gitignore
> > index f6d1d68e4a7c..51d3144085ce 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -6,3 +6,4 @@
> >   *.patch
> >   *.pyc
> >   __pycache__/
> > +venv/
Laurent Pinchart Oct. 9, 2024, 3:43 p.m. UTC | #3
On Wed, Oct 09, 2024 at 09:35:53AM +0100, Kieran Bingham wrote:
> Quoting Dan Scally (2024-10-09 08:33:05)
> > On 09/10/2024 08:16, Stefan Klug wrote:
> > > The python venv module is the standard way of creating virtual python
> > > environments. 'venv' is a commonly used name for the corresponding
> > > directory. For example in the tuning docs we propose to execute 'python
> > > -m venv venv' to setup a local virtual environment.  During development
> > > I often have these scattered around in the source tree and they show up
> > > as untracked files in git. Add venv to .gitignore to prevent that.
> > >
> > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > > ---
> 
> I would wonder if venv isn't just a global thing to ignore, but as we
> have python bindings in libcamera it might be slightly more relevant, so
> I don't specifically object.

I think venv is a better candidate for ~/.config/git/ignore, given that
the directory name is selected by users.

> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> > >   .gitignore | 1 +
> > >   1 file changed, 1 insertion(+)
> > >
> > > diff --git a/.gitignore b/.gitignore
> > > index f6d1d68e4a7c..51d3144085ce 100644
> > > --- a/.gitignore
> > > +++ b/.gitignore
> > > @@ -6,3 +6,4 @@
> > >   *.patch
> > >   *.pyc
> > >   __pycache__/
> > > +venv/
Laurent Pinchart Oct. 9, 2024, 4:29 p.m. UTC | #4
On Wed, Oct 09, 2024 at 06:43:53PM +0300, Laurent Pinchart wrote:
> On Wed, Oct 09, 2024 at 09:35:53AM +0100, Kieran Bingham wrote:
> > Quoting Dan Scally (2024-10-09 08:33:05)
> > > On 09/10/2024 08:16, Stefan Klug wrote:
> > > > The python venv module is the standard way of creating virtual python
> > > > environments. 'venv' is a commonly used name for the corresponding
> > > > directory. For example in the tuning docs we propose to execute 'python
> > > > -m venv venv' to setup a local virtual environment.  During development
> > > > I often have these scattered around in the source tree and they show up
> > > > as untracked files in git. Add venv to .gitignore to prevent that.
> > > >
> > > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > > > ---
> > 
> > I would wonder if venv isn't just a global thing to ignore, but as we
> > have python bindings in libcamera it might be slightly more relevant, so
> > I don't specifically object.
> 
> I think venv is a better candidate for ~/.config/git/ignore, given that
> the directory name is selected by users.

Or $GIT_DIR/info/exclude. Quoting "man gitignore",

    Which file to place a pattern in depends on how the pattern is meant to be used.

    •   Patterns which should be version-controlled and distributed to other
        repositories via clone (i.e., files that all developers will want to ignore)
        should go into a .gitignore file.

    •   Patterns which are specific to a particular repository but which do not need to
        be shared with other related repositories (e.g., auxiliary files that live
        inside the repository but are specific to one user’s workflow) should go into
        the $GIT_DIR/info/exclude file.

    •   Patterns which a user wants Git to ignore in all situations (e.g., backup or
        temporary files generated by the user’s editor of choice) generally go into a
        file specified by core.excludesFile in the user’s ˜/.gitconfig. Its default
        value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or
        empty, $HOME/.config/git/ignore is used instead.

Which category does venv belong to ?

> > Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > 
> > > Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> > > >   .gitignore | 1 +
> > > >   1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/.gitignore b/.gitignore
> > > > index f6d1d68e4a7c..51d3144085ce 100644
> > > > --- a/.gitignore
> > > > +++ b/.gitignore
> > > > @@ -6,3 +6,4 @@
> > > >   *.patch
> > > >   *.pyc
> > > >   __pycache__/
> > > > +venv/

Patch
diff mbox series

diff --git a/.gitignore b/.gitignore
index f6d1d68e4a7c..51d3144085ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ 
 *.patch
 *.pyc
 __pycache__/
+venv/