How to remove dev dependencies from poetry.lock file? #304
-
Hi, first of all thank you for this great tool! I'm trying to cleanup a Here's an extract of the file with one package item to keep and one to remove: # This file is automatically @generated by Poetry and should not be changed by hand.
[[package]]
name = "amqp"
version = "5.1.1"
description = "Low-level AMQP client for Python (fork of amqplib)."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
{file = "amqp-5.1.1-py3-none-any.whl", hash = "sha256:6f0956d2c23d8fa6e7691934d8c3930eadb44972cbbd1a7ae3a520f735d43359"},
{file = "amqp-5.1.1.tar.gz", hash = "sha256:2c1b13fecc0893e946c65cbd5f36427861cffa4ea2201d8f6fca22e2a373b5e2"},
]
[package.dependencies]
vine = ">=5.0.0"
[package.source]
type = "legacy"
reference = "gitlab"
[[package]]
name = "aspy-yaml"
version = "1.3.0"
description = "A few extensions to pyyaml."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
{file = "aspy.yaml-1.3.0-py2.py3-none-any.whl", hash = "sha256:463372c043f70160a9ec950c3f1e4c3a82db5fca01d334b6bc89c7164d744bdc"},
{file = "aspy.yaml-1.3.0.tar.gz", hash = "sha256:e7c742382eff2caed61f87a39d13f99109088e5e93f04d76eb8d4b28aa143f45"},
]
[package.dependencies]
pyyaml = "*"
[package.source]
type = "legacy"
reference = "gitlab"
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "11906e262bbd920bae2cbcae29857696a39c8bf597db3b1c9fa194ce1a21a6f7" I just downloaded the latest dasel version, and I tried with cat poetry.lock | dasel delete -r toml -s 'package.all().filter(equal(category, dev))' but nothing came up, so I started to do a step-by-step troubleshooting.
I was expecting that the last command would output Tanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @sanzoghenzo, Dasel is currently sensitive to space characters in the selectors. You should be able to just remove that space before $ cat poetry.lock | dasel -r toml 'package.all().filter(equal(category,dev))'
category = "dev"
description = "A few extensions to pyyaml."
name = "aspy-yaml"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.3.0"
[dependencies]
pyyaml = "*"
[[files]]
file = "aspy.yaml-1.3.0-py2.py3-none-any.whl"
hash = "sha256:463372c043f70160a9ec950c3f1e4c3a82db5fca01d334b6bc89c7164d744bdc"
[[files]]
file = "aspy.yaml-1.3.0.tar.gz"
hash = "sha256:e7c742382eff2caed61f87a39d13f99109088e5e93f04d76eb8d4b28aa143f45"
[source]
reference = "gitlab"
type = "legacy"
I did try running the delete command to test but had an error thrown - it looks like I'm incorrectly typing something somewhere in the code. I'll have to dig into this when I'm back from my holiday (I leave on Friday). Sorry for the delay but I'm busy packing. $ cat poetry.lock | dasel delete -r toml 'package.all().filter(equal(category,dev))'
panic: reflect.Set: value of type []interface {} is not assignable to type []map[string]interface {}
goroutine 1 [running]:
reflect.Value.assignTo({0xe9cfa0?, 0xc0002a61f8?, 0xc000295b00?}, {0xf24794, 0xb}, 0xe9d1e0, 0x0)
C:/Program Files/Go/src/reflect/value.go:3145 +0x2a5
reflect.Value.Set({0xe9d1e0?, 0xc0000091a0?, 0x94?}, {0xe9cfa0?, 0xc0002a61f8?, 0xc00027f0b0?})
C:/Program Files/Go/src/reflect/value.go:2160 +0xeb
github.com/tomwright/dasel/v2.Value.Index.func2()
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/value.go:219 +0x24c
github.com/tomwright/dasel/v2.Value.Delete(...)
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/value.go:141
github.com/tomwright/dasel/v2.Delete({0xef8400?, 0xc00027ed20?}, {0xc0000164b0?, 0xc000132500?})
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/context.go:148 +0x262
github.com/tomwright/dasel/v2/internal/command.runDeleteCommand(0xc00012bd08, 0xefb289?)
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/internal/command/delete.go:90 +0x15b
github.com/tomwright/dasel/v2/internal/command.deleteRunE(0xc00027c600?, {0xc00027e450, 0x1, 0x3?})
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/internal/command/delete.go:74 +0x317
github.com/spf13/cobra.(*Command).execute(0xc00027c600, {0xc00027e3f0, 0x3, 0x3})
C:/Users/Tom/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc00027c000)
C:/Users/Tom/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
C:/Users/Tom/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
main.main()
C:/Users/Tom/go/pkg/mod/github.com/tomwright/dasel/v2@v2.1.1/cmd/dasel/main.go:10 +0x27 |
Beta Was this translation helpful? Give feedback.
Hey @sanzoghenzo,
Dasel is currently sensitive to space characters in the selectors. You should be able to just remove that space before
dev
and have it work: