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

Support for crates with different library name #15

Closed
jonasbb opened this issue Sep 26, 2018 · 1 comment
Closed

Support for crates with different library name #15

jonasbb opened this issue Sep 26, 2018 · 1 comment
Assignees

Comments

@jonasbb
Copy link

jonasbb commented Sep 26, 2018

I tried to use the crate prettytable-rs in evcxr_jupyter, however I cannot get it to work. I think the problem is that even though the crate name is prettytable-rs, the library is only called prettytable (you use extern crate prettytable;).

Writing :dep prettytable-rs = "0.7" prints

can't find crate for `prettytable_rs`

on the terminal. Trying extern crate prettytable; results in the error

error: no matching package named `prettytable` found

being shown in the Jupyter notebook.

@davidlattimore
Copy link
Collaborator

Thanks for filing this. I didn't know it was possible to rename a library like that. It looks like it's possible to get the crate name by running "cargo metadata" after adding the dependency to Cargo.toml. e.g.:

 {
            "name": "prettytable-rs",
            "targets": [
                {
                    "kind": ["lib"],
                    "crate_types": ["lib"],
                    "name": "prettytable",
                },
            ],
}

So that would be one option to fix the :dep command.

As Celti mentioned on #21, we probably want to think about how this will look once 2018 is stable.

I suppose separating :dep and extern crate would fix this, albeit at the cost of users having to write both for every crate they import. Then later "use" instead of "extern crate".

@davidlattimore davidlattimore self-assigned this Oct 6, 2018
davidlattimore added a commit that referenced this issue Oct 6, 2018
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

No branches or pull requests

2 participants