[![Coverage Status](https://coveralls.io/repos/github/containerbuildsystem/pyarn/badge.svg?branch=master)](https://coveralls.io/github/containerbuildsystem/pyarn?branch=master)
# PYarn
If, for some weird reason, you need to parse a Yarn's `yarn.lock` file using
Python, you are in the right place!
PYarn is currently in an early developmente stage. It will create a dict from a
yarn.lock file, given the yarn.lock file is correct as per [its
implementation](https://github.com/yarnpkg/yarn/blob/master/src/lockfile/parse.js).
At this moment, there is no guarantees that PYarn will behave well (e.g., raise
an error) in case a malformed Yarn lockfile is passed to PYarn.
PYarn only supports Yarn v1 lockfiles. Parsing Yarn v2 lockfiles should be
trivial since they are yaml files.
## Development
```
make devel
make check
```
## Usage
The following prints all the content in the `yarn.lock` file:
```
from pyarn import lockfile
my_lockfile = lockfile.Lockfile.from_file(FILE_NAME)
print(my_lockfile.data)
# or
my_lockfile.to_json()
```
`my_lockfile.data` is a `dict` where the top level keys are the top level entries
(i.e., the package names) for the `yarn.lock` file entries.
## Releasing
Before releasing a new version to PyPI, don't forget to bump the version number in
[setup.cfg](./setup.cfg).
Make sure to `git tag` the release commit with the corresponding version and create
a Github release explaining what is new.
Afterwards, releasing to PyPI is quite simple:
```shell
make build
twine check dist/*
twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://github.com/containerbuildsystem/pyarn",
"name": "pyarn",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "Yarn,JavaScript,lockfile",
"author": "Red Hat, Inc.",
"author_email": "athos@redhat.com",
"download_url": "https://files.pythonhosted.org/packages/55/d4/b504f7acfe5ba3b9dcc65042bd8c7e3ea6ed6d17d31eddb9b2b57259e88a/pyarn-0.2.0.tar.gz",
"platform": "any",
"description": "[![Coverage Status](https://coveralls.io/repos/github/containerbuildsystem/pyarn/badge.svg?branch=master)](https://coveralls.io/github/containerbuildsystem/pyarn?branch=master)\n\n# PYarn\n\nIf, for some weird reason, you need to parse a Yarn's `yarn.lock` file using\nPython, you are in the right place!\n\nPYarn is currently in an early developmente stage. It will create a dict from a\nyarn.lock file, given the yarn.lock file is correct as per [its\nimplementation](https://github.com/yarnpkg/yarn/blob/master/src/lockfile/parse.js).\nAt this moment, there is no guarantees that PYarn will behave well (e.g., raise\nan error) in case a malformed Yarn lockfile is passed to PYarn.\n\nPYarn only supports Yarn v1 lockfiles. Parsing Yarn v2 lockfiles should be\ntrivial since they are yaml files.\n\n## Development\n\n```\nmake devel\nmake check\n```\n\n## Usage\n\nThe following prints all the content in the `yarn.lock` file:\n\n```\nfrom pyarn import lockfile\n\nmy_lockfile = lockfile.Lockfile.from_file(FILE_NAME)\nprint(my_lockfile.data)\n# or\nmy_lockfile.to_json()\n```\n\n`my_lockfile.data` is a `dict` where the top level keys are the top level entries\n(i.e., the package names) for the `yarn.lock` file entries.\n\n## Releasing\n\nBefore releasing a new version to PyPI, don't forget to bump the version number in\n[setup.cfg](./setup.cfg).\n\nMake sure to `git tag` the release commit with the corresponding version and create\na Github release explaining what is new.\n\nAfterwards, releasing to PyPI is quite simple:\n\n```shell\nmake build\ntwine check dist/*\ntwine upload dist/*\n```\n",
"bugtrack_url": null,
"license": "GPLv3+",
"summary": "Yarn JS package manager lockfile parser",
"version": "0.2.0",
"split_keywords": [
"yarn",
"javascript",
"lockfile"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "56b2364628359ecd772c50107a3bd6e4ca30ec32a26a2a60591698002469bf0b",
"md5": "5c5a91e67a6cb4c373c4eaccc034a3b7",
"sha256": "d06e8b79bb830f142187b57ee664dc0104f658efdb2b2bae7ed99eaf7746eb1a"
},
"downloads": -1,
"filename": "pyarn-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5c5a91e67a6cb4c373c4eaccc034a3b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 21488,
"upload_time": "2023-03-14T17:00:12",
"upload_time_iso_8601": "2023-03-14T17:00:12.274493Z",
"url": "https://files.pythonhosted.org/packages/56/b2/364628359ecd772c50107a3bd6e4ca30ec32a26a2a60591698002469bf0b/pyarn-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "55d4b504f7acfe5ba3b9dcc65042bd8c7e3ea6ed6d17d31eddb9b2b57259e88a",
"md5": "374c45807b59dd89464f1dc32e6b5298",
"sha256": "542ff739af2b81a1200776eff2b4d2566a330846decbd0f815999b196d7b067d"
},
"downloads": -1,
"filename": "pyarn-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "374c45807b59dd89464f1dc32e6b5298",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 24023,
"upload_time": "2023-03-14T17:00:14",
"upload_time_iso_8601": "2023-03-14T17:00:14.427747Z",
"url": "https://files.pythonhosted.org/packages/55/d4/b504f7acfe5ba3b9dcc65042bd8c7e3ea6ed6d17d31eddb9b2b57259e88a/pyarn-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-14 17:00:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "containerbuildsystem",
"github_project": "pyarn",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "ply",
"specs": []
}
],
"tox": true,
"lcname": "pyarn"
}