https://github.com/databio/yacman

YAML configuration manager

https://github.com/databio/yacman

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords from Contributors

bioinformatics bioinformatics-pipeline ngs pipeline-submission-engine
Last synced: 10 months ago · JSON representation

Repository

YAML configuration manager

Basic Info
Statistics
  • Stars: 6
  • Watchers: 15
  • Forks: 2
  • Open Issues: 10
  • Releases: 29
Created about 7 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

yacman
Run pytests Test locking parallel codecov Code style: black Anaconda-Server Badge

Yacman is a YAML configuration manager. It provides some convenience tools for dealing with YAML configuration files.

Please see this Python notebook for features and usage instructions and this document for API documentation.

Upgrading guide

How to upgrade to yacman v1.0.0. Yacman v1 provides 2 feature upgrades:

  1. Constructors take the form of yacman.YAMLConfigManager.from_x(...) functions, to make it clearer how to create a new ym object.
  2. It separates locks into read locks and write locks, to allow mutliple simultaneous readers.

The v0.9.3 transition release has 3 versions of the basic yacman object, namely: - attmap-based version (YacAttMap) - non-attmap-but-mostly-compatible (YAMLConfigManager) - new future object (FutureYAMLConfigManager...), which is explicitly not backwards compatible with the attmap version.

In v1.0.0, FutureYAMLConfigManager will be renamed to YAMLConfigManager and the old stuff will be removed. Here's how to transition your code:

Use the FutureYAMLConfigManager in 0.9.3

  1. Import the FutureYAMLConfigManager

Change from:

python from yacman import YAMLConfigManager

to

python from yacman import FutureYAMLConfigManager as YAMLConfigManager

Once we switch from v0.9.3 to v1.X.X, you will need to switch back.

  1. Update any context managers to use write_lock or read_lock

python from yacman import write_lock, read_lock

Change

python with ym as locked_ym: locked_ym.write()

to

python with write_lock(ym) as locked_ym: locked_ym.rebase() locked_ym.write()

In the new system, you must use rebase() before write() if you want to allow for multiple processes to possibly have written the file since you read it in.

More examples:

```python

from yacman import FutureYAMLConfigManager as YAMLConfigManager from yacman import readlock, writelock

data = {"mylist": [1,2,3], "myint": 8, "mystr": "hello world!", "mydict": {"nested_val": 15}}

ym = YAMLConfigManager(data)

ym["mylist"] ym["myint"] ym["my_dict"]

Use in a context manager to write to the file

ym["new_var"] = 15

Use a write-lock, and rebase before writing to ensure you capture any changes since you loaded the file

with write(ym) as lockedym: lockedym.rebase() locked_ym.write()

use a read lock to rebase -- this will replay any in-memory updates on top of whatever is re-read from the file

with readlock(ym) as lockedym: locked_ym.rebase()

use a read lock to reset the in-memory object to whatever is on disk

with readlock(ym) as lockedym: locked_ym.reset()

```

  1. Update any constructors to use the from_{x} functions

You can no longer just create a YAMLConfigManager object directly; now you need to use the constructor helpers.

Examples:

```python from yacman import FutureYAMLConfigManager as YAMLConfigManager

data = {"mylist": [1,2,3], "myint": 8, "mystr": "hello world!", "mydict": {"nestedval": 15}} filepath = "tests/data/full.yaml" yaml_data = "myvar: myval"

yacman.YAMLConfigManager.fromyamlfile(filepath) yacman.YAMLConfigManager.fromyamldata(yamldata) yacman.YAMLConfigManager.from_obj(data)

```

In the past, you could load from a file and overwrite some attributes with a dict of variables, all from the constructor. Now it would is more explicit:

python ym = yacman.YacMan.from_yaml_file(file_path) ym.update_from_obj(data)

To exppand environment variables in values, use .exp.

python ym.exp["text_expand_home_dir"]

From v0.9.3 (using future) to v1.X.X:

Switch back to:

from yacman import YAMLConfigManager

Demos

Some interactive demos

```python from yacman import FutureYAMLConfigManager as YAMLConfigManager ym = yacman.YAMLConfigManager(entries=["a", "b", "c"]) ym.to_dict() ym

print(ym.to_yaml())

ym = YAMLConfigManager(entries={"top": {"bottom": ["a", "b"], "bottom2": "a"}, "b": "c"}) ym print(ym.to_yaml())

ym = YAMLConfigManager(filepath="tests/data/confschema.yaml") print(ym.toyaml()) ym

ym = YAMLConfigManager(filepath="tests/data/empty.yaml") print(ym.to_yaml())

ym = YAMLConfigManager(filepath="tests/data/list.yaml") print(ym.to_yaml())

ym = YAMLConfigManager(YAMLConfigManager(filepath="tests/data/full.yaml").exp) print(ym.to_yaml())

ym = YAMLConfigManager(filepath="tests/data/full.yaml") print(ym.to_yaml(expand=True))

```

Owner

  • Name: Databio
  • Login: databio
  • Kind: organization
  • Location: University of Virginia

Solving problems in computational biology

GitHub Events

Total
Last Year

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 264
  • Total Committers: 5
  • Avg Commits per committer: 52.8
  • Development Distribution Score (DDS): 0.367
Past Year
  • Commits: 18
  • Committers: 1
  • Avg Commits per committer: 18.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Michal Stolarczyk s****3@g****m 167
nsheff n****f@u****m 74
Vince v****r@g****m 13
nsheff n****n@c****g 9
Nicola Soranzo n****o@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 34
  • Total pull requests: 31
  • Average time to close issues: 6 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 6
  • Total pull request authors: 4
  • Average comments per issue: 2.68
  • Average comments per pull request: 0.61
  • Merged pull requests: 31
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nsheff (24)
  • vreuter (4)
  • stolarczyk (3)
  • rcorces (1)
  • afrendeiro (1)
  • zz1874 (1)
Pull Request Authors
  • nsheff (18)
  • stolarczyk (12)
  • vreuter (2)
  • nsoranzo (1)
Top Labels
Issue Labels
likely-solved (8) bug (6) enhancement (3) question (2) docs (1) version-specific (1)
Pull Request Labels

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 48,703 last-month
  • Total docker downloads: 30,558
  • Total dependent packages: 16
    (may contain duplicates)
  • Total dependent repositories: 47
    (may contain duplicates)
  • Total versions: 70
  • Total maintainers: 5
proxy.golang.org: github.com/databio/yacman
  • Versions: 29
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.3%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 11 months ago
pypi.org: yacman

A standardized configuration object for reference genome assemblies

  • Versions: 30
  • Dependent Packages: 10
  • Dependent Repositories: 47
  • Downloads: 48,703 Last month
  • Docker Downloads: 30,558
Rankings
Dependent packages count: 1.1%
Docker downloads count: 1.3%
Downloads: 1.6%
Dependent repos count: 2.1%
Average: 7.8%
Forks count: 19.2%
Stargazers count: 21.6%
Last synced: 10 months ago
spack.io: py-yacman

A YAML configuration manager.

  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 14.2%
Average: 18.6%
Forks count: 30.1%
Stargazers count: 30.2%
Maintainers (1)
Last synced: 10 months ago
conda-forge.org: yacman
  • Versions: 10
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent packages count: 19.5%
Dependent repos count: 34.0%
Average: 41.2%
Forks count: 54.2%
Stargazers count: 57.0%
Last synced: 11 months ago

Dependencies

.github/workflows/black.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • psf/black stable composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/run-locking-tests.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/run-pytest.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v1 composite
requirements/requirements-all.txt pypi
  • attmap >=0.13.0
  • jsonschema >=3.2.0
  • oyaml *
  • pyyaml >=3.13
  • ubiquerg >=0.6.1
requirements/requirements-test.txt pypi
  • pytest * test
  • pytest-cov * test