Comments (5)
By the way, I'm on PyConPL till Sunday so feel free to ping me and we can meet and discuss it.
from databooks.
Yes let's do that!!
Not sure why this is happening at a first glance tbh. Let's meet up and we can look into it 🤝
from databooks.
I think we should discuss this. For operations like meta
, there is no need to look for git repository. If I run databooks meta something.ipynb
without a git repository, I get:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/lbalhar/Software/databooks/databooks/__main__.py", line 4, in <module>
app(prog_name="databooks")
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/typer/main.py", line 214, in __call__
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 1655, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 920, in make_context
self.parse_args(ctx, args)
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 1378, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 2360, in handle_parse_result
value = self.process_value(ctx, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/click/core.py", line 2322, in process_value
value = self.callback(ctx, self, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/typer/main.py", line 833, in wrapper
return callback(**use_params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/Software/databooks/databooks/cli.py", line 52, in _config_callback
get_config(
File "/home/lbalhar/Software/databooks/databooks/config.py", line 19, in get_config
repo_dir = get_repo().working_dir
^^^^^^^^^^
File "/home/lbalhar/Software/databooks/databooks/git_utils.py", line 38, in get_repo
repo = Repo(path=repo_dir)
^^^^^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/git/repo/base.py", line 266, in __init__
self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
^^^^^^^^^^^^^^^
File "/home/lbalhar/.virtualenvs/databooks/lib/python3.11/site-packages/git/repo/base.py", line 347, in common_dir
raise InvalidGitRepositoryError()
git.exc.InvalidGitRepositoryError
And in situations where you need a git repository for example for getting a list of files with conflicts, the app should look for git repository to which the file belongs to instead of the one in CWD. Let's say I have a git repo in /foo/bar/ and a file with conflict in /foo/bar/notebooks/file.ipynb and I run the tool from /tmp - the tool should find the repo in /foo/bar.
But the main question is, why do you need a repository at all? I think it can be necessary only for the new diff command but meta, assert, fix and show commands don't need it at all.
from databooks.
That's a good point. We always look for git repos by default to look for config files (look until the repo root and if there's no pyproject.toml
until then use default values) - but I agree we shouldn't see errors if we cannot find them.
why do you need a repository at all? I think it can be necessary only for the new diff command but meta, assert, fix and show commands don't need it at all.
That would be the case for meta
and assert
, but for fix
and diff
we do need the git repos - fix
we actually look at the git-ls-files
to get the blobs of the original files and compare them (so we're not reeeeeally fixing anything but rather going back to previous versions and comparing them). And for that we need the git repo info.
the app should look for git repository to which the file belongs to instead of the one in CWD
Completely agree. There is an implementation for finding the common parent (in case you pass different paths) and looking for the repo root there but I don't think we're using it everywhere (which we definitely should).
So summary of changes:
- Return default values in the CLI in case we don't find the repo (for
meta
andassert
) - All git repos should be found based on the file paths, not the current working dir
from databooks.
Done!! And thanks for the suggestion! Maybe worth double checking with you that the fixes are working?
from databooks.
Related Issues (14)
- Databooks minimal python version to 3.7
- pre-commit hook invalid value HOT 1
- "Dynamic" recipes HOT 2
- Unable to keep "kernelspec" HOT 1
- RPM package in Fedora - problem with Typer version HOT 4
- pytest 7.2.0 no longer depends on py HOT 2
- Can I have the pre-commit hook recurse subdirectories? HOT 1
- consider adding flake8-docstrings to ci HOT 1
- Add python 3.11 to list of supported versions HOT 2
- [RFE] databooks run HOT 3
- add example on how to strip metadata in github action HOT 5
- Enrich diffs
- move to pydantic v2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from databooks.