welcome[bot]: 💖 Thanks for opening your first pull request! 💖

Please make sure you read the following:

* [Authorship Guidelines](https://github.com/fatiando/contributing/blob/master/CONTRIBUTING.md): Our rules for giving you credit for your contributions, including authorship on publications and [Zenodo](https://zenodo.org/communities/fatiando) archives.
* [Contributing Guide](https://github.com/fatiando/contributing/blob/master/CONTRIBUTING.md): What the review process is like and our infrastructure for testing and documentation.
* [Code of Conduct](https://github.com/fatiando/contributing/blob/master/CODE_OF_CONDUCT.md): How we expect people to interact in our projects.

A few things to keep in mind:

* Remember to run `make format` to make sure your code follows our style guide.
* If you need help writing tests, take a look at the existing ones for inspiration. If you don't know where to start, let us know and we'll walk you through it.
* All new features should be documented. It helps to write the docstrings for your functions/classes before writing the code. This will help you think about your code design and results in better code.
* No matter what, we are really grateful that you put in the effort to do this! ⭐

diff --git a/AUTHORS.md b/AUTHORS.md
index 9f353a8..e644199 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -4,6 +4,7 @@ The following people have made contributions to the project (in alphabetical
 order by last name) and are considered "The Pooch Developers":
 
 * [Anderson Banihirwe](https://github.com/andersy005) - The US National Center for Atmospheric Research, USA (ORCID: [0000-0001-6583-571X](https://orcid.org/0000-0001-6583-571X))
+* [Mathias Hauser](https://github.com/mathause) - Institute for Atmospheric and Climate Science, ETH Zurich, Zurich, Switzerland (ORCID: [0000-0002-0057-4878](https://orcid.org/0000-0002-0057-4878))
 * [Hugo van Kemenade](https://github.com/hugovk) - Independent (Non-affiliated) (ORCID: [0000-0001-5715-8632](https://www.orcid.org/0000-0001-5715-8632))
 * [Kacper Kowalik](https://github.com/Xarthisius) - National Center for Supercomputing Applications, Univeristy of Illinois at Urbana-Champaign, USA (ORCID: [0000-0003-1709-3744](https://www.orcid.org/0000-0003-1709-3744))
 * [John Leeman](https://github.com/jrleeman)
diff --git a/doc/usage.rst b/doc/usage.rst
index da638ea..2ad43df 100644
--- a/doc/usage.rst
+++ b/doc/usage.rst
@@ -616,6 +616,22 @@ prefixed with ``alg:``, e.g.
     c137.csv sha1:e32b18dab23935bc091c353b308f724f18edcb5e
     cronen.csv md5:b53c08d3570b82665784cedde591a8b0
 
+From version 1.2 the registry file can also contain line comments, prepended with a ``#``, e.g.:
+
+.. code-block:: none
+
+    # C-137 sample data
+    c137.csv 19uheidhlkjdwhoiwuhc0uhcwljchw9ochwochw89dcgw9dcgwc
+    # Cronenberg sample data
+    cronen.csv 1upodh2ioduhw9celdjhlfvhksgdwikdgcowjhcwoduchowjg8w
+
+.. note::
+
+    Make sure you set the pooch version in your ``setup.py`` to version 1.2 or
+    later when using comments as earlier versions cannot handle them:
+     ``install_requires = [..., "pooch>=1.2", ...]``
+
+
 To make sure the registry file is shipped with your package, include the following in
 your ``MANIFEST.in`` file:
 
diff --git a/pooch/core.py b/pooch/core.py
index 9b3ea19..45b6704 100644
--- a/pooch/core.py
+++ b/pooch/core.py
@@ -615,7 +615,8 @@ class Pooch:
         a space. Hash can specify checksum algorithm using "alg:hash" format.
         In case no algorithm is provided, SHA256 is used by default.
         Only one file per line is allowed. Custom download URLs for individual
-        files can be specified as a third element on the line.
+        files can be specified as a third element on the line. Line comments
+        can be added and must be prepended with ``#``.
 
         Parameters
         ----------
@@ -635,7 +636,12 @@ class Pooch:
                 if isinstance(line, bytes):
                     line = line.decode("utf-8")
 
-                elements = line.strip().split()
+                line = line.strip()
+                # skip line comments
+                if line.startswith("#"):
+                    continue
+
+                elements = line.split()
                 if not len(elements) in [0, 2, 3]:
                     raise OSError(
                         "Invalid entry in Pooch registry file '{}': "

Comments in registry file?
It could be worthwhile to support comments in registry files. For simplicity comments one could require that they need to be on a new line:

```
# this ressource
c137.csv 19uheidhlkjdwhoiwuhc0uhcwljchw9ochwochw89dcgw9dcgwc
# that ressource
cronen.csv 1upodh2ioduhw9celdjhlfvhksgdwikdgcowjhcwoduchowjg8w
```
However, it's probably not really possible to use this in a backward-compatible way...

**Are you willing to help implement and maintain this feature?** Yes

<!--
Every feature we add is code that we will have to maintain and keep updated.
This takes a lot of effort. If you are willing to be involved in the project
and help maintain your feature, it will make it easier for us to accept it.
-->

diff --git a/pooch/tests/data/registry_comments.txt b/pooch/tests/data/registry_comments.txt
new file mode 100644
index 0000000..89fd8a6
--- /dev/null
+++ b/pooch/tests/data/registry_comments.txt
@@ -0,0 +1,14 @@
+# a comment
+subdir/tiny-data.txt baee0894dba14b12085eacb204284b97e362f4f3e5a5807693cc90ef415c1b2d
+tiny-data.txt baee0894dba14b12085eacb204284b97e362f4f3e5a5807693cc90ef415c1b2d
+large-data.txt 98de171fb320da82982e6bf0f3994189fff4b42b23328769afce12bdd340444a
+tiny-data.zip 0d49e94f07bc1866ec57e7fd1b93a351fba36842ec9b13dd50bf94e8dfa35cbb
+
+ # a comment with a starting space
+store.zip 0498d2a001e71051bbd2acd2346f38da7cbd345a633cb7bf0f8a20938714b51a
+tiny-data.tar.gz 41503f083814f43a01a8e9a30c28d7a9fe96839a99727a7fdd0acf7cd5bab63b
+
+store.tar.gz 088c7f4e0f1859b1c769bb6065de24376f366374817ede8691a6ac2e49f29511
+tiny-data.txt.bz2 753663687a4040c90c8578061867d1df623e6aa8011c870a5dbd88ee3c82e306
+tiny-data.txt.gz 2e2da6161291657617c32192dba95635706af80c6e7335750812907b58fd4b52
+tiny-data.txt.xz 99dcb5c32a6e916344bacb4badcbc2f2b6ee196977d1d8187610c21e7e607765
diff --git a/pooch/tests/test_core.py b/pooch/tests/test_core.py
index 5c0ecbd..0a8478b 100644
--- a/pooch/tests/test_core.py
+++ b/pooch/tests/test_core.py
@@ -231,6 +231,14 @@ def test_pooch_load_registry():
     assert pup.registry_files.sort() == list(REGISTRY).sort()
 
 
+def test_pooch_load_registry_comments():
+    "Loading the registry from a file and strip line comments"
+    pup = Pooch(path="", base_url="")
+    pup.load_registry(os.path.join(DATA_DIR, "registry_comments.txt"))
+    assert pup.registry == REGISTRY
+    assert pup.registry_files.sort() == list(REGISTRY).sort()
+
+
 def test_pooch_load_registry_fileobj():
     "Loading the registry from a file object"
     path = os.path.join(DATA_DIR, "registry.txt")

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
coverage==7.2.7
exceptiongroup==1.2.2
execnet==2.0.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.2.0
-e git+https://github.com/fatiando/pooch.git@01341a9dc8de352112296131326ddaae6a7135f9#egg=pooch
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-xdist==3.5.0
requests==2.31.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: pooch
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - charset-normalizer==3.4.1
      - coverage==7.2.7
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - packaging==24.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - requests==2.31.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/pooch

pooch/tests/test_core.py::test_pooch_load_registry_comments
pooch/tests/test_core.py::test_retrieve pooch/tests/test_core.py::test_retrieve_fname pooch/tests/test_core.py::test_retrieve_default_path pooch/tests/test_core.py::test_pooch_custom_url pooch/tests/test_core.py::test_pooch_download pooch/tests/test_core.py::test_pooch_logging_level pooch/tests/test_core.py::test_pooch_update pooch/tests/test_core.py::test_pooch_corrupted pooch/tests/test_core.py::test_check_availability pooch/tests/test_core.py::test_check_availability_on_ftp pooch/tests/test_core.py::test_fetch_with_downloader pooch/tests/test_core.py::test_stream_download[tiny-data.txt] pooch/tests/test_core.py::test_stream_download[subdir/tiny-data.txt]
pooch/tests/test_core.py::test_pooch_local pooch/tests/test_core.py::test_pooch_file_not_in_registry pooch/tests/test_core.py::test_pooch_load_registry pooch/tests/test_core.py::test_pooch_load_registry_fileobj pooch/tests/test_core.py::test_pooch_load_registry_custom_url pooch/tests/test_core.py::test_pooch_load_registry_invalid_line pooch/tests/test_core.py::test_invalid_hash_alg pooch/tests/test_core.py::test_alternative_hashing_algorithms pooch/tests/test_core.py::test_download_action
AUTHORS.md doc/usage.rst pooch/core.py
AUTHORS.md doc/usage.rst pooch/core.py