Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] adding IDE & static related stuff #3317

Merged
merged 5 commits into from
Mar 13, 2020
Merged

Conversation

meysam81
Copy link
Contributor

Reasons for making this change:

VSC should not track IDE generated files, nor should it track statics; so that's why this PR is created.

Links to documentation supporting these rule changes:

I couldn't find any official doc, but it was annoying to me so I thought it may be useful for others as well.

If this is a new template:

  • I don't know if it's gonna be of any use but I started the work from here

@shiftkey
Copy link
Member

shiftkey commented Feb 21, 2020

VSC should not track IDE generated files

We maintain a Global/VisualStudioCode.gitignore template here that covers everything you should need.

nor should it track statics;

I'm not familiar with this - can you elaborate?

@meysam81
Copy link
Contributor Author

When python manage.py collectstatic is invoked, a static directory is created. So that's that.

@shiftkey shiftkey changed the title Python: adding IDE & static related stuff [Python] adding IDE & static related stuff Mar 11, 2020
Python.gitignore Outdated Show resolved Hide resolved
Python.gitignore Outdated Show resolved Hide resolved
Python.gitignore Outdated Show resolved Hide resolved
Copy link
Member

@shiftkey shiftkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @meysam81!

@shiftkey shiftkey merged commit e931ef7 into github:master Mar 13, 2020
r2pgl pushed a commit to r2pgl/gitignore that referenced this pull request Mar 15, 2020
@metp
Copy link

metp commented Mar 29, 2020

nor should it track statics

Static also includes css and js files. Why shouldn't a VCS track them? By adding static to gitignore, app specific static folders are ignored which shouldn't happen. collectstatic will collect from these specific folders:

Files are searched by using the enabled finders. The default is to look in all locations defined in STATICFILES_DIRS and in the 'static' directory of apps specified by the INSTALLED_APPS setting.

@meysam81
Copy link
Contributor Author

nor should it track statics

Static also includes css and js files. Why shouldn't a VCS track them? By adding static to gitignore, app specific static folders are ignored which shouldn't happen. collectstatic will collect from these specific folders:

Files are searched by using the enabled finders. The default is to look in all locations defined in STATICFILES_DIRS and in the 'static' directory of apps specified by the INSTALLED_APPS setting.

You're right; we should consider css and js files. But I'd say that those static source code files are not (or better should not) be in the root of the project and therefore, probably a better solution is to ignore the root static and track the app related statics like the following:

static
!*/static

@meysam81
Copy link
Contributor Author

And if for any reason someone liked the idea of having the static in the root directory, there is always the option for that too: git add --force

@metp
Copy link

metp commented Mar 29, 2020

Not sure about this either. As Django states in its guide:

Your project will probably also have static assets that aren’t tied to a particular app. In addition to using a static/ directory inside your apps, you can define a list of directories (STATICFILES_DIRS) in your settings file where Django will also look for static files. For example:
STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), '/var/www/static/', ]

where BASE_DIR is normally the root directory. I think we should better not include static and media into the gitignore as both are really dependent on the project structure and configuration. I would rather define one rule more on my own in my gitignore instead of finding out that my changes haven't been tracked (as it happened to me 😉 ).

@meysam81
Copy link
Contributor Author

Fair enough.
But are you sure about media? Is it a good idea to track production site's binaries?

@metp
Copy link

metp commented Mar 29, 2020

As MEDIA_ROOT doesn't have a default value set, I am not sure whether to assume media as a name. uploads would be rational as well. Additionally we don't work with VCS and commit in production environments (rather deploy to them) so we don't track production site binaries. The only reason I could think of why this rule could be useful is for testing the file upload feature locally right?

@meysam81
Copy link
Contributor Author

or maybe for something like favicon; hence 'production site binaries'

@metp
Copy link

metp commented Mar 29, 2020

Don't these just count as static files too and thus be placed in static?

@meysam81
Copy link
Contributor Author

Yes you're right.
I think the media (or even uploads) would better be there then, or wouldn't you agree? I can't think of anything that will need the tracking of VCS in there; cause everything that'll end up there, is probably auto generated or even data that should be backed up using other means.

@metp
Copy link

metp commented Mar 31, 2020

Yes that's right, auto generated stuff doesn't have to be tracked. But in case someone only has access to the result of generated stuff (e.g when using third party assets), they again would like to track them. Also I still would use media and static for their actual use cases, user uploaded files and static files. In case people want parts of static not be tracked, they can just add project specific gitignore rules :)

@meysam81
Copy link
Contributor Author

@shiftkey, maybe revert this commit then?

shiftkey added a commit that referenced this pull request Apr 4, 2020
@shiftkey
Copy link
Member

shiftkey commented Apr 4, 2020

@meysam81 done: #3363

ANRCorleone pushed a commit to ANRCorleone/gitignore that referenced this pull request Jul 24, 2020
* Update Node.gitignore (github#3264)

* Added gitignore for GNOME Extension (github#3268)

* [Unity] Fix ignore Jetbrains plugin folder (github#3266)

Add missing slash to make pattern accurate, since the JetBrains folder is always relative to root assets folder.

* added Coverlet result files as a Code Coverage Tool (github#3252)

* Ignore files inside `.vscode-test` (github#3256)

* Ignore files inside `.vscode-test` 

[vscode-test](https://github.com/microsoft/vscode-test) is a testing framework for vscode extensions. Inside the `vscode-test` folder are stored one or more versions of vscode, which are used for testing a vscode extension.

* Update Node.gitignore

* Added a comment why MemoryCaptures get excluded (github#3276)

* Update Autotools.gitignore (github#3271)

* TeX: Ignore REVTeX generated Notes.bib files (github#3286)

* [Godot] Ignore imported translations (github#3269)

The Godot editor automatically creates those binary files from
translations in CSV format. There's no need to add them to
version control.

* Update PureScript adding .spago (github#3278)

* [Global/Eclipse] Make .project opt-in (github#3305)

The project description file.

* Ignore .pytype/ directory (github#3301)

pytype is a static type analyzer for Python code;
it generates files of inferred type information,
located by default in .pytype/pyi.

* Update Unity.gitignore (github#3297)

Unity 2020 introduces a new "UserSettings" top-level project folder.
See https://forum.unity.com/threads/whats-the-usersettings-directory.754436/ for more information.

* Update concrete5 gitignore (github#3176)

* [Python] .python-version should NOT be ignored (github#3274)

* Add Umbraco V8 packages folder location (github#3302)

In Umbraco v8 we have a new packages folder located under Umbraco/views/packages/...

This gets ignored by the current version. Adding this new line prevents this and includes all files and subfolders under this new location.

* add alternative sftp settings file (github#3006)

* add alternative sftp settings file

* update for possible multiple alt* numbered files

* add in global metals (github#3296)

* Add snowpack dependency directory (github#3315)

* Add `cover/` to Python.gitignore. (github#3310)

* Changes the name of Perl 6 to Raku (github#3312)

Since October 2019, Raku is the name of the language formerly known as
Perl 6. This reflects the change. It's the same language, so changes
are mostly cosmetic.

* Add ignore to umbraco folder (github#3307)

Add ignore to umbraco folder as it will be added by Install-Package UmbracoCms or updated by Update-Package UmbracoCms

* Remote typings ignore from node gitignore (github#3319)

Similar to github#2608, it's the defacto tsc way now for adding typings locally.

* Changed TeX to not ignore tikz files by default. (github#3320)

* Include Rider as a supported IDE (github#3323)

AS far as I can tell this .gitignore also applies to Rider. Looking at the somewhat official .gitignore for Rider [here](https://github.com/JetBrains/resharper-rider-samples/blob/master/.gitignore), it seems compatible.

* Add period. (github#3336)

* Update for Prestashop 1.7 (github#3261)

* Jigsaw (github#3334)

* update parcel cache (github#3331)

* Update Drupal.gitignore (github#3329)

* Add /public/uploads for file upload gem Shrine (github#3333)

When using a file upload gem called Shrine, its file system mode put images under `public/uploads`.

https://github.com/shrinerb/shrine/blob/053bcf297e092e9695731fb9b67a86780e898203/doc/storage/file_system.md

* Ignore Cython debug symbols (github#3330)

Cython extension modules built with `gdb_debug=True` spit out debug symbols in the `cython_debug` directory at the top level of the project. The files in this directory contain hardcoded paths and are not shareable/meaningful across environments, so I think it makes sense to include them in a default Python .gitignore.

* Improved JENKINS_HOME example (github#3332)

After years of use I've come up with some improvements to the
`JENKINS_HOME.gitignore` example.

- Major performance improvement: On very large Jenkins installations that
  have been running for more than one year, there tends to be many builds
  (hundreds of thousands of builds).  The `builds` directory of these
  jobs contain millions of files which would cause Git to hang for
  several minutes on simple commands like `git status` and longer for
  committing changes.  `strace` was used on Git to figure out the
  performance impact and this proposed change includes the optimization.
  I also added a clear comment explaining the line's purpose.
- There's an example for how to include Jenkins encryption keys, and
  there's a disclaimer informing the user why they shouldn't but still
  giving an example.
- Comments have been reworded and slightly reformatted to be a little
  more clear.

* Add Unity's Addressables and Android's temp files. (github#3311)

* Added Addressables.

Prevent automatically generated addressable files to end up in Git.

* Update .gitignore to exclude packed Addressables and Android auto-generated files.

* [Node] Add yarn v2 excludes (github#3327)

* [VisualStudio] Add rule for ScaffoldingReadMe.txt (github#3328)

* Update Autotools.gitignore. (github#3337)

Ignore .dirstamp files from automake used for non-existing directory dependencies.

* Add Win32/ to gitginore list (github#3308)

Visual Studio .Net used Win32/ as one of the default output directories for C and C++ projects. Later, when 64-bit support was added to the toolchain (circa 2005), x64/ was used. The Gitignore files include x64/, but not Win32/. The commit adds support for both Win32/ and x64/.

* update README (github#3248)

* Extend Qt.gitignore with qmlcache qrc files (github#3322)

Projects using QML files generating a temporary qrc file if a qrc file present in the project.

* Changes to PyBuilder 0.12+ (github#3338)

PyB 0.12 uses `$project_root/.pybuilder/` for internal venvs.

* [Python] adding IDE & static related stuff (github#3317)

* Update R.gitignore (github#3354)

* Ignore Local History folder (github#3008)

This will add support for the default location the Local History extension for Visual Studio Code uses.
See https://marketplace.visualstudio.com/items?itemName=xyz.local-history

* Revert "[Python] adding IDE & static related stuff (github#3317)" (github#3363)

This reverts commit e931ef7.

* Ignore Terraform CLI configuration files (github#3359)

* Ignore AWS Serverless Application Model build folder (github#3357)

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html

* Add generated timing files to Coq.gitignore (github#3367)

These generated files were added in coq/coq#745

* Remove pip-wheel-metadata/ from Python.gitignore (github#3364)

pip generated this folder for a few versions, as part of it's initial
implementation of PEP 517.

pip has not generated this folder for a few versions now, so it should
be OK to remove this from the standard gitignore file.

* Ignore Gradle subproject build dir (github#3370)

* Add FodyWeavers.xsd to VisualStudio.gitignore (github#3380)

* Ignore Next.js `next export` result directory (github#3387)

* Dart: Ignore .flutter-plugins (github#3398)

Generated files that appear when using 'google_fonts' or other Dart
packages designed as Flutter plugins.

* Add .yarn/install-state.gz to Node.gitignore (github#3407)

After running `yarn set version berry` and `yarn install`, the file `.yarn/install-state.gz` is created.

The documentation at https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored mentions that this file should be ignored:

> .yarn/install-state.tgz is an optimization file that you shouldn't have to ever commit. It simply stores the exact state of your project so that the next commands can boot without having to resolve your workspaces again.

The documentation has a minor error; the generated file is `.gz` instead of `.tgz` (source: https://github.com/yarnpkg/berry/pull/998/files#diff-23dd4c2e823c25186f1107e88e962032R201)

* ignore .xwm generated by xwatermark package in TeX (github#3412)

* Add *.aab (github#3414)

* Fixing target and adding debug to Rust gitignore (github#3436)

The problem here was two fold:
1. the folder "/target/" would be top-level of the repo only, it should be "target/" to properly exclude target folders anywhere in the repo
2. the default Rust/Cargo folder when compiling code is "debug/", which gets used perhaps more often that "target/", added that

* Fix false positives on Coverage*.cs files (github#3454)

I added this .gitignore to a project that included a file named CoverageSearchModel.cs, and the file was wrongly ignored.  This change fixes the incorrect use of the range operator on the Coverlet rules.

* Update stale heading anchor (github#3445)

Co-authored-by: ZhengYuan Loo <[email protected]>

* ignore *~ files in the po directory (github#3453)

Common IME for `gettext` utilities like `tools::update_pkg_po('.')` to create these temp files (at least on Mac)

* ignore HPROF files (github#3456)

* Exclude *.tfvars files (github#3452)

Co-authored-by: Kevin Cochran <[email protected]>

* Remove pointless blank line from the beginning of the Godot file (github#3466)

* KiCad: add *.kicad_sch-bak and *.kicad_prl (github#3427)

* KiCad: add *.kicad_sch-bak

As used by the new file formats for KiCad 6.0
See https://kicad-pcb.org/blog/2020/05/Development-Highlight-New-schematic-and-symbol-library-file-formats-are-now-the-default/

* Add *.kicad_prl to KiCad.gitignore

More info: https://forum.kicad.info/t/new-project-file-format/23705

Co-authored-by: anishagg17 <[email protected]>
Co-authored-by: Pellegrino Prevete <[email protected]>
Co-authored-by: 狂飙 <[email protected]>
Co-authored-by: Łukasz Kurzyniec <[email protected]>
Co-authored-by: Simon Siefke <[email protected]>
Co-authored-by: FritzsHero <[email protected]>
Co-authored-by: Leonardo Romor <[email protected]>
Co-authored-by: Henri Menke <[email protected]>
Co-authored-by: Hugo Locurcio <[email protected]>
Co-authored-by: Hideaki KAWAI <[email protected]>
Co-authored-by: Douglas Larson <[email protected]>
Co-authored-by: Brad Solomon <[email protected]>
Co-authored-by: Daniel Heim <[email protected]>
Co-authored-by: shahroq <[email protected]>
Co-authored-by: Santiago Basulto <[email protected]>
Co-authored-by: Michaël Vanbrabandt <[email protected]>
Co-authored-by: Gruber <[email protected]>
Co-authored-by: Chris Kipp <[email protected]>
Co-authored-by: Igor Strebezhev <[email protected]>
Co-authored-by: Xuan (Sean) Hu <[email protected]>
Co-authored-by: Juan Julián Merelo Guervós <[email protected]>
Co-authored-by: bakkiung <[email protected]>
Co-authored-by: Jeffrey Priebe <[email protected]>
Co-authored-by: Bart Verhagen <[email protected]>
Co-authored-by: bitbonk <[email protected]>
Co-authored-by: mr <[email protected]>
Co-authored-by: Marouane Hassine <[email protected]>
Co-authored-by: Rohan Sakhale <[email protected]>
Co-authored-by: A. Said Aslan <[email protected]>
Co-authored-by: MetaJuanito Fatas <[email protected]>
Co-authored-by: Elijah Shaw-Rutschman <[email protected]>
Co-authored-by: Sam Gleske <[email protected]>
Co-authored-by: JasperCiti <[email protected]>
Co-authored-by: ChiefORZ <[email protected]>
Co-authored-by: Patrick Roche <[email protected]>
Co-authored-by: Christoph Niethammer <[email protected]>
Co-authored-by: Jeffrey Walton <[email protected]>
Co-authored-by: jymok12 <[email protected]>
Co-authored-by: Miklós Márton <[email protected]>
Co-authored-by: Arcadiy Ivanov <[email protected]>
Co-authored-by: Meysam <[email protected]>
Co-authored-by: Patrick Schratz <[email protected]>
Co-authored-by: ofthelit <[email protected]>
Co-authored-by: Brendan Forster <[email protected]>
Co-authored-by: Loo Zheng Yuan <[email protected]>
Co-authored-by: Igor Stepanov <[email protected]>
Co-authored-by: Jason Gross <[email protected]>
Co-authored-by: Pradyun Gedam <[email protected]>
Co-authored-by: Mitchell Skaggs <[email protected]>
Co-authored-by: Daniel Chalmers <[email protected]>
Co-authored-by: Ted Kesgar <[email protected]>
Co-authored-by: Sascha Peilicke <[email protected]>
Co-authored-by: Jon Layton <[email protected]>
Co-authored-by: Benjamin Buch <[email protected]>
Co-authored-by: Hiroto Kobayashi <[email protected]>
Co-authored-by: John Stilley <[email protected]>
Co-authored-by: Justin Gregory <[email protected]>
Co-authored-by: ZhengYuan Loo <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
Co-authored-by: Maher Zaidoune <[email protected]>
Co-authored-by: Kevin Cochran <[email protected]>
Co-authored-by: Kevin Cochran <[email protected]>
Co-authored-by: Michael Alexsander <[email protected]>
Co-authored-by: Diego Herranz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants