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

Use papis add for import #43

Merged
merged 9 commits into from
Mar 6, 2024
Merged

Conversation

kiike
Copy link
Contributor

@kiike kiike commented Mar 5, 2024

As per discussion in papis/papis#765, this proposal imports papers from Zotero using the papis.command.add.run API instead of writing out yaml files. I took advantage to rename the arguments too and allow the use of the link argument.

@kiike kiike force-pushed the pr-use-papis-add-for-import branch from 2e434c5 to 3f5bb6a Compare March 5, 2024 21:01
@kiike kiike force-pushed the pr-use-papis-add-for-import branch from 46337ab to 6969d3a Compare March 5, 2024 21:04
@kiike kiike force-pushed the pr-use-papis-add-for-import branch from a77992e to e08781c Compare March 5, 2024 22:00
@kiike kiike force-pushed the pr-use-papis-add-for-import branch from e08781c to 6bac21c Compare March 5, 2024 22:02
@kiike
Copy link
Contributor Author

kiike commented Mar 5, 2024

So the tests fail on Windows due to the encoding error mentioned in the issues and PRs and that is blocked for an unreleased fix. Does this affect this PR? After merging perhaps an obvious step is marking the test as skippable on Windows.

Copy link
Contributor

@alexfikl alexfikl left a comment

Choose a reason for hiding this comment

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

Left two small questions, but overall this looks good to me! Thanks for working on it!

Have you tested it on your library too? Unfortunately the unittests are not particularly great here.. :(

papis_zotero/sql.py Outdated Show resolved Hide resolved
tests/test_sql.py Outdated Show resolved Hide resolved
papis_zotero/sql.py Outdated Show resolved Hide resolved
@alexfikl
Copy link
Contributor

alexfikl commented Mar 6, 2024

So the tests fail on Windows due to the encoding error mentioned in the issues and PRs and that is blocked for an unreleased fix. Does this affect this PR? After merging perhaps an obvious step is marking the test as skippable on Windows.

Yeah, it would be great if you could add a little snippet at the top of the failing tests:

if sys.platform == "win32":
	pytest.xfail("Fails due to wrong enconding in papis<=0.13.")

We'll remove that when the new version is out.

@kiike
Copy link
Contributor Author

kiike commented Mar 6, 2024

Left two small questions, but overall this looks good to me! Thanks for working on it!

Have you tested it on your library too? Unfortunately the unittests are not particularly great here.. :(

Yes, I use it for my "production" library. I started working on this small patch since I didn't like how the default import left my library. I no longer had an easy way of navigating the documents except if i used the papis tui. Now, the file explorer lets me see which documents I have and also the citation for typst at the same time:

image

@alexfikl
Copy link
Contributor

alexfikl commented Mar 6, 2024

Yes, I use it for my "production" library. I started working on this small patch since I didn't like how the default import left my library. I no longer had an easy way of navigating the documents except if i used the papis tui. Now, the file explorer lets me see which documents I have and also the citation for typst at the same time:

image

That's awesome ❤️

@kiike
Copy link
Contributor Author

kiike commented Mar 6, 2024

The test is passing on my machine so I'll check what might be wrong here.

@kiike
Copy link
Contributor Author

kiike commented Mar 6, 2024

I just realised why the tests passed on my machine but not on CI. I had a modification in papis/commands/add so that folder_name was populated from args or from the config. This was needed as we are not using the CLI, to execute the papis.commands.add.run function.

Instead of modifying papis/commands/add, i am changing the function call here so we pass the folder_name as argument with the papis config.

@kiike kiike force-pushed the pr-use-papis-add-for-import branch from 5bcfec3 to 232aabe Compare March 6, 2024 11:34
@alexfikl
Copy link
Contributor

alexfikl commented Mar 6, 2024

Thanks for all the work! In it goes 🚀

@alexfikl alexfikl merged commit bdfb4e9 into papis:main Mar 6, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants