summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan DeMasi <me@jrdemasi.com>2020-06-29 19:30:45 -0600
committerJonathan DeMasi <me@jrdemasi.com>2020-06-29 19:30:45 -0600
commit0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26 (patch)
tree25b957334bdf54609c43ecc9105faf47b22d1909
parentbe1c844d6455fb898a4b4d6ce06b1ea585640576 (diff)
downloadprojects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar.gz
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar.bz2
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar.lz
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar.xz
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.tar.zst
projects-0e0ffd745c4dcf9d0f9010a26c6f8531646a0c26.zip
added 'utils' to currently house auto project starter
-rw-r--r--python/utils/.gitignore138
-rwxr-xr-xpython/utils/main.py48
2 files changed, 186 insertions, 0 deletions
diff --git a/python/utils/.gitignore b/python/utils/.gitignore
new file mode 100644
index 0000000..a81c8ee
--- /dev/null
+++ b/python/utils/.gitignore
@@ -0,0 +1,138 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+cover/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+.pybuilder/
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+# For a library or package, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# .python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# pytype static type analyzer
+.pytype/
+
+# Cython debug symbols
+cython_debug/
diff --git a/python/utils/main.py b/python/utils/main.py
new file mode 100755
index 0000000..a1d7087
--- /dev/null
+++ b/python/utils/main.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+
+import sys
+import os
+import urllib.request
+import venv
+import subprocess
+
+
+def make_project_dir(directory):
+ try:
+ os.makedirs(directory)
+ except FileExistsError:
+ print("The directory you provided already exists, not doing anything")
+ exit(1)
+ return
+
+
+def get_gitignore(directory):
+ url = "https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore"
+ urllib.request.urlretrieve(url, os.path.join(directory, '.gitignore'))
+ return
+
+
+def make_venv(directory):
+ venvdir = os.path.join(directory, 'venv')
+ venv.create(env_dir=venvdir, with_pip=True)
+ return venvdir
+
+
+def prepare_venv(venv):
+ whichpip = os.path.join(venv, 'bin', 'pip')
+ output = subprocess.check_output(
+ [whichpip, 'install', 'autopep8', 'pylint'])
+ return
+
+
+def main():
+ directory = sys.argv[1]
+ make_project_dir(directory)
+ get_gitignore(directory)
+ venv = make_venv(directory)
+ prepare_venv(venv)
+ return
+
+
+if __name__ == '__main__':
+ main() \ No newline at end of file