PageRenderTime 63ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/CONTRIBUTING.md

https://github.com/phw/picard
Markdown | 123 lines | 85 code | 38 blank | 0 comment | 0 complexity | 6aa9c7c335f7070491db6d68689aee0c MD5 | raw file
  1. # Contributing to Picard
  2. ## Coding Style
  3. As most of the other projects written in Python, we use the [PEP 8](https://www.python.org/dev/peps/pep-0008/). Though, we ignore some of the recommendations:
  4. * E501 - Maximum line length (79 characters). The general limit we have is somewhere around 120-130.
  5. *Recommended video: "[Beyond PEP 8 -- Best practices for beautiful intelligible code](https://www.youtube.com/watch?v=wf-BqAjZb8M)" by Raymond Hettinger at PyCon 2015, which talks about the famous P versus NP problem.*
  6. The general idea is to make the code within a project consistent and easy to interpret (for humans).
  7. Developers may install few extra tools using:
  8. ```bash
  9. pip install -r requirements-dev.txt
  10. ```
  11. To fix or preserve imports style, one can use `isort -rc .` command (requires the [isort](https://github.com/timothycrosley/isort) tool, see `.isort.cfg`).
  12. It is recommended to add a pre-commit hook to check whether imports in changed code
  13. follow the conventions. Add a file `.git/hooks/pre-commit` with the following content
  14. and make it executable:
  15. ```bash
  16. #!/usr/bin/env bash
  17. PYFILES=$(git diff --cached --name-only | grep "\\.py$" | grep --invert-match \
  18. -e "^tagger\\.py$" \
  19. -e "^picard/resources\\.py$" \
  20. -e "^picard/\(coverart/providers\|formats\)/__init__\\.py$" \
  21. -e "^picard/const/\(__init__\|attributes\|countries\)\\.py$" \
  22. -e "^picard/ui/ui_.*\\.py$" \
  23. -e "^scripts/picard\\.in$")
  24. if [ ! -z "$PYFILES" ]; then
  25. set -e
  26. isort --check-only --diff --quiet $PYFILES
  27. flake8 $PYFILES
  28. fi
  29. ```
  30. ### Docstrings
  31. Unless the function is easy to understand quickly, it should probably have a docstring describing what it does, how it does it, what the arguments are, and what the expected output is.
  32. We recommend using ["Google-style" docstrings](https://google.github.io/styleguide/pyguide.html?showone=Comments#38-comments-and-docstrings) for writing docstrings.
  33. ### Picard specific code
  34. Picard has some auto-generated `picard/ui/ui_*.py` PyQt UI related files. Please do not change them directly. To modify them, use Qt-Designer to edit the `ui/*.ui` and use the command `python setup.py build_ui` to generate the corresponding `ui_*.py` files.
  35. We use snake-case to name all functions and variables except for the pre-generated PyQt functions/variables.
  36. `gettext` and `gettext-noop` have been built-in the Picard code as `_` and `N_` respectively to provide support for internationalization/localization. You can use them without imports across all of Picard code. Make sure to mark all displayable strings for translation using `_` or `N_` as applicable. You can read more about python-gettext [here](https://docs.python.org/2/library/gettext.html).
  37. ## Git Work-flow
  38. We follow the "typical" GitHub workflow when contributing changes:
  39. 1. [Fork](https://help.github.com/articles/fork-a-repo/) a repository into your account.
  40. 2. Create a new branch and give it a meaningful name. For example, if you are going to fix issue PICARD-257, branch can be called `picard-257` or `preserve-artwork`.
  41. 3. Make your changes and commit them with a [good description](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). Your commit subject should be written in **imperative voice** and **sentence case**. With regards to the contents of the message itself, you don't need to provide a lot of details, but make sure that people who look at the commit history afterwards can understand what you were changing and why.
  42. 4. [Create](https://help.github.com/articles/creating-a-pull-request/) a new pull request on GitHub. Make sure that the title of your pull request is descriptive and consistent with the rest. If you are fixing issue that exists in our bug tracker reference it like this: `PICARD-257: Allow preserving existing cover-art tags`. **Not** `[PICARD-257] - Allow preserving existing cover-art tags` or `Allow preserving existing cover-art tags (PICARD-257)` or simply `PICARD-257`.
  43. 5. Make sure to provide a bug tracker link to the issue that your pull request solves in the description.
  44. 6. Do not make one big pull request with a lot of unrelated changes. If you are solving more than one issue, unless they are closely related, split them into multiple pull requests. It makes it easier to review and merge the patches this way.
  45. 7. Try to avoid un-necessary commits after code reviews by making use of [git rebase](https://help.github.com/articles/about-git-rebase/) to fix merge conflicts, remove unwanted commits, rewording and editing previous commits or squashing multiple small related changes into one commit.
  46. ## Translations
  47. See po/README.md for information about translations.
  48. ## Audio Metadata Specifications
  49. The core functionality of Picard is the ability to read and write tags from / to files
  50. with different tagging formats. When implementing support for new tags the goal is to
  51. be compatible with existing software as good as possible. Below are links to relevant
  52. metadata specifications and to the tag mapping tables used by various audio software.
  53. ### Format specs
  54. - [ID3](http://id3.org/Developer%20Information)
  55. - [VorbisComment](https://wiki.xiph.org/VorbisComment)
  56. - [OggOpus](https://wiki.xiph.org/OggOpus#Comment_Header) (in addition to Vorbis Comment spec)
  57. - [RFC 7845 - Ogg Encapsulation for the Opus Audio Codec](https://tools.ietf.org/html/rfc7845#section-5.2.1)
  58. - [APE-Tags](http://wiki.hydrogenaud.io/index.php?title=APE_key)
  59. - [Matroska \| Tag Specifications](https://www.matroska.org/technical/specs/tagging/index.html)
  60. - [ASF / WMA](http://msdn.microsoft.com/en-us/library/ms867702.aspx)
  61. - MP4: See iTunes Metadata Format Specification (was available at https://developer.apple.com/, but does not seem to be available anymore)
  62. - [RIFF Tags](https://exiftool.org/TagNames/RIFF.html) / [Resource Interchange File Format: INFO List Chunk](https://www.tactilemedia.com/info/MCI_Control_Info.html) / [Multimedia Programming Interface and Data Specifications 1.0](http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf)
  63. ### Tag mapping tables
  64. - [Picard](https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html)
  65. - [JAudiotagger](http://www.jthink.net/jaudiotagger/tagmapping.html)
  66. - [MP3Tag](https://help.mp3tag.de/main_tags.html)
  67. - [Kid3](https://kid3.sourceforge.io/kid3_en.html#frame-list)
  68. - [Yate Tag Mapping Table](https://2manyrobots.com/YateResources/InAppHelp/TagMappingTable.html)
  69. - [MediaMonkey](https://www.mediamonkey.com/sw/webhelp/frame/index.html?abouttrackproperties.htm)
  70. - [MusicBee](http://musicbee.wikia.com/wiki/Tag)
  71. - [Kodi - Music Files & Tagging](https://kodi.wiki/view/Music_tagging#Tags_Kodi_reads)
  72. - [Kodi - Video file tagging](https://kodi.wiki/view/Video_file_tagging#MP4_tag_options)
  73. - [Quod Libet - Tag Formats & Spec Deviations](https://quodlibet.readthedocs.io/en/latest/development/formats.html)
  74. - [Foobar2000:ID3 Tag Mapping - Hydrogenaudio Knowledgebase](https://wiki.hydrogenaud.io/index.php?title=Foobar2000:ID3_Tag_Mapping)
  75. - [Tag Mapping - Hydrogenaudio Knowledgebase](https://wiki.hydrogenaud.io/index.php?title=Tag_Mapping)
  76. - [Windows](https://docs.microsoft.com/en-US/windows/win32/wmformat/id3-tag-support)
  77. - [SlimServerSupportedTags - SqueezeboxWiki](http://wiki.slimdevices.com/index.php/SlimServerSupportedTags)
  78. - [Music Player Daemon 0.21.2 documentation](https://mpd.readthedocs.io/en/stable/protocol.html#tags)
  79. - [Metadata Matrix Pioneer DJ](https://forums.pioneerdj.com/hc/en-us/articles/360024701851-Metadata-Matrix)
  80. Also relevant:
  81. - [Comparisson Picard / JAudiotagger](https://docs.google.com/spreadsheets/d/1afugW3R1FRDN-mwt5SQLY4R7aLAu3RqzjN3pR1497Ok/edit#gid=0)
  82. - [Roon Knowledge Base - File Tag Best Practice](https://kb.roonlabs.com/File_Tag_Best_Practice)
  83. - [Roon Knowledge Base - Roon Vs Tags](https://kb.roonlabs.com/Roon_Vs_Tags)
  84. ### Other specs
  85. - [ReplayGain 2.0 specification](http://wiki.hydrogenaud.io/index.php?title=ReplayGain_2.0_specification)