-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: add YAML configuration support (#10)
* WIP: Adding configuration script - Added PyYAML to requirements - Created configuration.py * WIP: Add validation for db_table prompt - This change ensures the value entered for db_table can be converted to a boolean - The config now saves db_table as boolean
- Loading branch information
1 parent
ad0a33a
commit 7494777
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import yaml | ||
|
||
name = input("Project Name: ") | ||
organism = input("Organism: ") | ||
short_name = input("Organism Short Name: ") | ||
project_info = input("Project Description: ") | ||
while True: | ||
db_table = input("Database Table (True/False): ") | ||
try: | ||
assert db_table.lower() in ["true","false"] | ||
db_table = db_table.capitalize() | ||
db_table = bool(db_table) | ||
break | ||
except Exception: | ||
print("Answer must be True or False.") | ||
|
||
values = { | ||
"Project name": name, | ||
"Organism": organism, | ||
"Organism short name": short_name, | ||
"Project description": project_info, | ||
"Database table": db_table | ||
} | ||
|
||
with open(r".github\tests\config.yml", "w") as output_file: | ||
yaml.dump(values, output_file, sort_keys=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters