Skip to content

Commit

Permalink
Feature: add YAML configuration support (#10)
Browse files Browse the repository at this point in the history
* 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
AlexandraGloria authored Mar 19, 2021
1 parent ad0a33a commit 7494777
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/tests/configuration.py
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)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pyparsing == 2.4.7
memote == 0.12.0
requests == 2.25.1
json2html == 1.3.0
beautifulsoup4 == 4.9.3
beautifulsoup4 == 4.9.3
PyYAML == 5.4.1

0 comments on commit 7494777

Please sign in to comment.