Skip to main content

YamlStripper

YamlStripper is a Python command-line tool for removing specified fields from YAML files.

Installation

To use YamlStripper, you need to have Python 3 installed on your computer. You can download and install Python 3 from the official Python website: https://www.python.org/downloads/

After installing Python 3, you can install YamlStripper using pip, the Python package manager:

pip install yaml-stripper

Usage

To use YamlStripper, open a command prompt or terminal window and type the following command:

yaml-stripper input_file output_file -f field1 field2 ...

where:

  • input_file - The input YAML file to remove fields from.
  • output_file - The output YAML file without the specified fields.
  • -f field1 field2 ... - The fields to remove from the input YAML file.

For example, if you have a YAML file called example.yaml with the following contents:

name: John
age: 30
email: john@example.com
phone: 123-456-7890

and you want to remove the email and phone fields from this YAML file and save the result in a new file called stripped.yaml, you can use the following command:

yaml-stripper example.yaml stripped.yaml -f email phone

After running the command, a new file called stripped.yaml will be created with the following contents:

name: John
age: 30

Examples

Here are some more examples of how to use YamlStripper:

Example 1

Suppose you have a YAML file called data.yaml with the following contents:

name: Alice
age: 25
email: alice@example.com
phone: 987-654-3210
address:
  street: 123 Main St
  city: Anytown
  state: CA
  zip: 12345

You want to remove the email and phone fields from this YAML file and save the result in a new file called stripped.yaml. Here's how you can use YamlStripper to achieve this:

yaml-stripper data.yaml stripped.yaml -f email phone

After running the command, a new file called stripped.yaml will be created with the following contents:

name: Alice
age: 25
address:
  street: 123 Main St
  city: Anytown
  state: CA
  zip: 12345

Example 2

Suppose you have a YAML file called config.yaml with the following contents:

debug: true
port: 8000
database:
  host: localhost
  port: 5432
  name: mydb
  user: myuser
  password: mypass

You want to remove the debug field from this YAML file and save the result in a new file called stripped.yaml. Here's how you can use YamlStripper to achieve this:

yaml-stripper config.yaml stripped.yaml -f debug

After running the command, a new file called stripped.yaml will be created with the following contents:

port: 8000
database:
  host: localhost
  port: 5432
  name: mydb
  user: myuser
 

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml-stripper-2.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_stripper-2.1.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file yaml-stripper-2.1.2.tar.gz.

File metadata

  • Download URL: yaml-stripper-2.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for yaml-stripper-2.1.2.tar.gz
Algorithm Hash digest
SHA256 d9490100ca4e8366b3564e0a282e795585d2df4b887aeee26c60486bc5c9f28f
MD5 0c85c6e9327b8db819942686c25c2a4c
BLAKE2b-256 ccd940f40ba90e3fd5a8ae5b8bf0e6b1c8ec100f6811cb49308a820a4fb99b4e

See more details on using hashes here.

File details

Details for the file yaml_stripper-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: yaml_stripper-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for yaml_stripper-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b3409f6ecd6899f11ed5638073db575deed9ffb35c2c9d8eec465a9a7d3936
MD5 8edce8806892cec47322a9d38498e4fe
BLAKE2b-256 dc04a041bb9f5269b5d6673b5c2818db06e14ed348751ac5171c1d5440f603d6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.2 This release

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

0.1.29

2 files

0.1.28

2 files

0.1.27

2 files

0.1.26

2 files

0.1.25

2 files

0.1.24

2 files

0.1.23

2 files

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page