Closed NicoHood closed 2 years ago
Should be there as well. Pr welcome.
How would I setup a local copy of a python module? Do I need to add it to something like a PATH variable?
I personally use the built-in venv. Never had a need to modify python path.
https://realpython.com/python-virtual-environments-a-primer/
See https://pyairtable.readthedocs.io/en/latest/about.html#contribute
Hey, I had a look at it and it looks doable. However I currently aint got time to work into the codebase. Would you be so kind and add this minor fix? I guess for you it is 10x easier. :)
Hi, I had the time to write the patch, but the magic git hooks that you've introduced are broken for me. I guess that is because I am using python 3.10?
All done! ✨ 🍰 ✨
1 file would be reformatted, 30 files would be left unchanged.
==> Building Docs 📚
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/__main__.py", line 13, in <module>
from sphinx.cmd.build import main
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
from sphinx.application import Sphinx
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/application.py", line 32, in <module>
from sphinx.config import Config
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/config.py", line 21, in <module>
from sphinx.util import logging
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/util/__init__.py", line 41, in <module>
from sphinx.util.typing import PathMatcher
File "/home/user/Documents/Akten/Gewerbe/Partyborn/git/partyalarm/pyairtable/.venv/lib/python3.10/site-packages/sphinx/util/typing.py", line 37, in <module>
from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/usr/lib/python3.10/types.py)
make: *** [Makefile:45: docs] Error 1
This is related to sphinx, I have Sphinx 4.1.2
installed (tells me the venv pip command): https://github.com/sphinx-doc/sphinx/issues/9562
https://github.com/gtalarico/pyairtable/blob/main/requirements-dev.txt#L2
Just to be safe, here is the diff, so you can apply it yourself. Its quite simple.
diff --git a/pyairtable/api/abstract.py b/pyairtable/api/abstract.py
index 8829768..60a4b05 100644
--- a/pyairtable/api/abstract.py
+++ b/pyairtable/api/abstract.py
@@ -94,9 +94,10 @@ class ApiAbstract(metaclass=abc.ABCMeta):
)
return self._process_response(response)
- def _get_record(self, base_id: str, table_name: str, record_id: str) -> dict:
+ def _get_record(self, base_id: str, table_name: str, record_id: str, **options) -> dict:
record_url = self._get_record_url(base_id, table_name, record_id)
- return self._request("get", record_url)
+ params = self._options_to_params(**options)
+ return self._request("get", record_url, params=params)
def _iterate(self, base_id: str, table_name: str, **options):
offset = None
diff --git a/pyairtable/api/table.py b/pyairtable/api/table.py
index aa9e503..6550cb5 100644
--- a/pyairtable/api/table.py
+++ b/pyairtable/api/table.py
@@ -49,12 +49,12 @@ class Table(ApiAbstract):
"""
return super()._get_record_url(self.base_id, self.table_name, record_id)
- def get(self, record_id: str):
+ def get(self, record_id: str, **options):
"""
Same as :meth:`Api.get <pyairtable.api.Api.get>`
but without ``base_id`` and ``table_name`` arg.
"""
- return super()._get_record(self.base_id, self.table_name, record_id)
+ return super()._get_record(self.base_id, self.table_name, record_id, **options)
def iterate(self, **options):
"""
I could get the Sphinx thing running by updating it and setting the lang
to en
in the config. But I guess this very specific setup is more your part, so feel free to upgrade it however you like.
Currently the get method does not accept any options. Sadly I want to use the
return_fields_by_field_id
option there as well. https://github.com/gtalarico/pyairtable/blob/main/pyairtable/api/table.py#L52