Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project-wide options #369

Merged
merged 44 commits into from
Feb 16, 2022
Merged

Project-wide options #369

merged 44 commits into from
Feb 16, 2022

Conversation

Helveg
Copy link
Contributor

@Helveg Helveg commented Feb 12, 2022

Describe the work done

  • Project options: Option values can be read/written from/to pyproject.toml where a tools.bsb section is added.
  • Options can be registered/unregistered.
  • Option descriptors can provide a getter (might not be used everywhere yet) ot transform values from the source.
  • ConfigOption is now a global option which has env, cli and project values.
  • CLI contexts can be reset to allow repeat commands in 1 Python process (so commands can safely be called from code).
  • Command dryruns added: These don't execute the code or handler, but do parse the args and set the CLI context.
  • Default HDF5 from template is now called network.hdf5 instead of template.hdf5
  • Default option descriptor now gets/sets on scoped private var (_bsbopt_<name>_value)
  • Added __delete__ to all descriptors to unset option values.
  • Env var bools parsed and rev parsed
  • BsbOption.get takes a priority now, which will pick the value of the prioritized property above all others.
  • Added store/read/get to bsb.options to store and read in pyproject, or to fetch the value of an option from anywhere or prio.
  • Added docs and tests for the options module 🎉

Tasks

  • Added tests
  • Updated documentation

@Helveg Helveg changed the title Feature/project options Project options Feb 12, 2022
@Helveg Helveg changed the title Project options Project-wide options Feb 12, 2022
@codecov
Copy link

codecov bot commented Feb 12, 2022

Codecov Report

Merging #369 (4178920) into main (fa88985) will increase coverage by 0.90%.
The diff coverage is 91.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
+ Coverage   56.68%   57.59%   +0.90%     
==========================================
  Files          90       96       +6     
  Lines       11153    11778     +625     
==========================================
+ Hits         6322     6783     +461     
- Misses       4831     4995     +164     
Impacted Files Coverage Δ
bsb/exceptions.py 100.00% <ø> (ø)
bsb/cli/commands/_projects.py 41.93% <40.00%> (ø)
bsb/cli/__init__.py 67.74% <59.09%> (ø)
bsb/cli/commands/__init__.py 89.47% <66.66%> (ø)
bsb/_contexts.py 84.37% <83.33%> (ø)
bsb/option.py 92.66% <86.99%> (+24.14%) ⬆️
bsb/options.py 94.84% <92.30%> (+2.11%) ⬆️
tests/test_options.py 98.54% <98.54%> (ø)
bsb/_options.py 96.77% <100.00%> (+21.77%) ⬆️
bsb/cli/commands/_commands.py 81.42% <100.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa88985...4178920. Read the comment docs.

@Helveg Helveg marked this pull request as ready for review February 14, 2022 18:57
@Helveg Helveg merged commit 2a52d0c into main Feb 16, 2022
@Helveg Helveg deleted the feature/project-options branch February 16, 2022 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant