Skip to content

Commit

Permalink
Merge pull request #18 from MohamedNasser8/main
Browse files Browse the repository at this point in the history
Add logging and replace print statements Fixes #13
  • Loading branch information
ltorres6 authored Mar 25, 2024
2 parents 9c4dcd1 + c785e5a commit 1cefab3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
/.venv
30 changes: 24 additions & 6 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import os
import sys
import venv
import logging

# logging root configuration
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')


def set_debug_mode(debug_mode):
if debug_mode:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)


def distribute():
"""Create new version on PyPI
Expand All @@ -13,14 +26,22 @@ def distribute():
You need: PyPI username and password.
You need to type in the PyPI password rather than copy-pasting.
"""

create_venv()
install()

os.system(activate() + ' && ' + 'pip install --upgrade build')
os.system(activate() + ' && ' + 'python -m build')
os.system(activate() + ' && ' + 'pip install --upgrade twine')
os.system(activate() + ' && ' + 'twine upload dist/*')

def create_venv():
venv_dir = os.path.join(os.getcwd(), ".venv")
if not os.path.exists(venv_dir):
logging.info("Creating virtual environment...")
os.system('py -3 -m venv .venv')
else:
logging.info("Virtual environment already exists.")

def activate():
"""Active virtual environment"""

Expand All @@ -36,15 +57,12 @@ def activate():
def install():
"""Install requirements to a virtual environment"""

print('Creating virtual environment..')
os.system('py -3 -m venv .venv')

print('Installing requirements..')
logging.info("Installing requirements...")
os.system(activate() + ' && ' + 'py -m pip install -r requirements.txt')



if __name__ == '__main__':

#install()
set_debug_mode(debug_mode=True)
distribute()
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy
scipy
matplotlib
matplotlib
logging

0 comments on commit 1cefab3

Please sign in to comment.