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

__version__ #100

Closed
TyberiusPrime opened this issue Mar 21, 2019 · 2 comments
Closed

__version__ #100

TyberiusPrime opened this issue Mar 21, 2019 · 2 comments

Comments

@TyberiusPrime
Copy link

It would be cool if pyo3-pack packages defined their version to be the one from cargo.toml automatically.

In the meanwhile, how would I define such a static string for my pymodule?

@konstin
Copy link
Member

konstin commented Mar 21, 2019

I assume you're using pyo3 or rust-cpython, things are different for cffi.

While pyo3-pack adds the version from Cargo.toml as the packages version, it can't really change your python module. However, you can easily add __version__ yourself with

    m.add("__version__", env!("CARGO_PKG_VERSION"))?;

I think that this should become part of the pyo3 docs, and you might also want to have a look at https://github.com/PyO3/pyo3-built/, even though it's a bit outdated.

@TyberiusPrime
Copy link
Author

Sometimes, at the end of a long day of coding, you find that something is just as easy as it should be.
This will work nicely for me - and yes it's a good idea to maybe even add it to the 'this is how you do a python module' example on PyO3.

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