PyCran
Overview 👀
Yet another metadata parser for R source packages and R metadata information
Package: ABACUS
Version: 1.0.0
Depends: R (>= 3.1.0)
Imports: ggplot2 (>= 3.1.0), shiny (>= 1.3.1),
Suggests: rmarkdown (>= 1.13), knitr (>= 1.22)
License: GPL-3
MD5sum: 50c54c4da09307cb95a70aaaa54b9fbd
NeedsCompilation: no
For more see: https://cran.r-project.org/src/contrib/PACKAGES
PyCran lets us parse raw metadata and get it as dictionary, you can:
- Encode metadata dictionary to raw format,
- Decode raw metadata and receive it as dictionary,
- Load from tar archive with R library sources.
Installation 💾
$ pip install pycran
Usage 🚀
Decode
import pycran
raw_metadata = """
Package: ABACUS
Version: 1.0.0
Depends: R (>= 3.1.0)
Imports: ggplot2 (>= 3.1.0), shiny (>= 1.3.1),
Suggests: rmarkdown (>= 1.13), knitr (>= 1.22)
License: GPL-3
MD5sum: 50c54c4da09307cb95a70aaaa54b9fbd
NeedsCompilation: no
"""
assert pycran.decode(raw_metadata) == {
"Package": "ABACUS",
"Version": "1.0.0",
"Depends": "R (>= 3.1.0)",
"Imports": "ggplot2 (>= 3.1.0), shiny (>= 1.3.1),",
"Suggests": "rmarkdown (>= 1.13), knitr (>= 1.22)",
"License": "GPL-3",
"MD5sum": "50c54c4da09307cb95a70aaaa54b9fbd",
"NeedsCompilation": "no",
}
Encode
import pycran
metadata = {
"Package": "ABACUS",
"Version": "1.0.0",
"Depends": "R (>= 3.1.0)",
"Imports": "ggplot2 (>= 3.1.0), shiny (>= 1.3.1),",
"Suggests": "rmarkdown (>= 1.13), knitr (>= 1.22)",
"License": "GPL-3",
"MD5sum": "50c54c4da09307cb95a70aaaa54b9fbd",
"NeedsCompilation": "no",
}
expected = """
Package: ABACUS
Version: 1.0.0
Depends: R (>= 3.1.0)
Imports: ggplot2 (>= 3.1.0), shiny (>= 1.3.1),
Suggests: rmarkdown (>= 1.13), knitr (>= 1.22)
License: GPL-3
MD5sum: 50c54c4da09307cb95a70aaaa54b9fbd
NeedsCompilation: no
"""
assert pycran.encode(metadata) == expected
Load from R source archive
import pycran
# you can pass path to archive
pycran.from_file("PATH/TO/PACKAGE/ABACUS_1.0.0.tar.gz")
# or you can pass tarfile object
import tarfile
pycran.from_file(tarfile.open("PATH/TO/PACKAGE/ABACUS_1.0.0.tar.gz"))
Parse raw metadata
In cases when you need to parse metadata for multiple
packages you can pass the data to pycran.parse function
import pycran
# somehow you download the contents of https://cran.r-project.org/src/contrib/PACKAGES
package_list = requests.get(https://cran.r-project.org/src/contrib/PACKAGES).text()
# And parse it as a result you will get a generator which you can iterate
pycran.parse(package_list)
Enjoy!
✨ 🍰 ✨
Metadata
Release files for pycran 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycran-0.2.0.tar.gz | 986.0 kB | Without provenance | Details for pycran-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycran-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pycran-0.2.0-py3-none-any.whl |
Total release size: 994.6 kB
Release files / pycran-0.2.0.tar.gz
| Download URL | pycran-0.2.0.tar.gz |
|---|---|
| Size | 986.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07ff69ec8469f90735f075fe26ed267fe9bc1aec8bd519815804ff493ea64283
|
|
BLAKE2b-256 checksum How to use checksums |
6748c4838168c8d2d73f4c9300a6e35c730d6983e5ba83edc6b1f816792c0216
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Release files / pycran-0.2.0-py3-none-any.whl
| Download URL | pycran-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5c119ccab969f659a468aa65b3b1bbdfcad3c835ab30eb0955f5e14f0a9ded1
|
|
BLAKE2b-256 checksum How to use checksums |
2c60a4360a82472dadb529930d936c23fad31f02c51c9c9f59fd98c23cdf561b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Security for pycran 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.