cm107 commited on
Commit
d7d22f5
1 Parent(s): f418104

Introduce mypkg

Browse files
Files changed (7) hide show
  1. .gitignore +1 -0
  2. app.py +2 -3
  3. mypkg/__init__.py +1 -0
  4. requirements.txt +15 -0
  5. setup.py +50 -0
  6. static/css/main.css +15 -10
  7. templates/index.html +5 -0
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  __pycache__
2
  *.pyc
3
  venv
 
 
1
  __pycache__
2
  *.pyc
3
  venv
4
+ *.egg-info
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import flask
2
  import os
3
- # from dotenv import load_dotenv
4
- # load_dotenv()
5
 
6
  app = flask.Flask(__name__, template_folder="./templates/")
7
 
@@ -9,7 +8,7 @@ app = flask.Flask(__name__, template_folder="./templates/")
9
  @app.route('/')
10
  def index():
11
  print('Route: /')
12
- return flask.render_template('index.html')
13
 
14
  @app.route('/about')
15
  def about():
 
1
  import flask
2
  import os
3
+ import mypkg
 
4
 
5
  app = flask.Flask(__name__, template_folder="./templates/")
6
 
 
8
  @app.route('/')
9
  def index():
10
  print('Route: /')
11
+ return flask.render_template('index.html', mypkg_version=mypkg.__version__)
12
 
13
  @app.route('/about')
14
  def about():
mypkg/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = '1.0'
requirements.txt CHANGED
@@ -1,6 +1,21 @@
 
1
  click==8.1.3
 
2
  Flask==2.2.2
 
3
  itsdangerous==2.1.2
4
  Jinja2==3.1.2
 
5
  MarkupSafe==2.1.1
 
 
 
 
 
 
 
 
 
 
6
  Werkzeug==2.2.2
 
 
1
+ astroid==2.12.13
2
  click==8.1.3
3
+ dill==0.3.6
4
  Flask==2.2.2
5
+ isort==5.10.1
6
  itsdangerous==2.1.2
7
  Jinja2==3.1.2
8
+ lazy-object-proxy==1.8.0
9
  MarkupSafe==2.1.1
10
+ mccabe==0.7.0
11
+ -e git+https://huggingface.co/spaces/cm107/test_flask_space@f418104de34a36b6156e8b98d29eacf067bd9f5e#egg=mypkg
12
+ numpy==1.23.5
13
+ opencv-python==4.6.0.66
14
+ Pillow==9.3.0
15
+ platformdirs==2.6.0
16
+ pylint==2.15.8
17
+ PyYAML==6.0
18
+ tomli==2.0.1
19
+ tomlkit==0.11.6
20
  Werkzeug==2.2.2
21
+ wrapt==1.14.1
setup.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import setup, find_packages
2
+ import codecs
3
+ import os.path
4
+
5
+ packages = find_packages(
6
+ where='.',
7
+ include=[
8
+ 'mypkg*'
9
+ ]
10
+ )
11
+
12
+ def read(rel_path):
13
+ here = os.path.abspath(os.path.dirname(__file__))
14
+ with codecs.open(os.path.join(here, rel_path), 'r') as fp:
15
+ return fp.read()
16
+
17
+ def get_version(rel_path):
18
+ # https://packaging.python.org/en/latest/guides/single-sourcing-package-version/
19
+ for line in read(rel_path).splitlines():
20
+ if line.startswith('__version__'):
21
+ delim = '"' if '"' in line else "'"
22
+ return line.split(delim)[1]
23
+ else:
24
+ raise RuntimeError("Unable to find version string.")
25
+
26
+ setup(
27
+ name='mypkg',
28
+ version=get_version("mypkg/__init__.py"),
29
+ description='My (Example) Package',
30
+ author='Clayton Mork',
31
+ author_email='mork.clayton3@gmail.com',
32
+ license='MIT License',
33
+ packages=packages,
34
+ classifiers=[
35
+ "Programming Language :: Python :: 3",
36
+ "License :: OSI Approved :: MIT License",
37
+ "Operating System :: OS Independent",
38
+ ],
39
+ install_requires=[
40
+ 'pylint>=2.15.5',
41
+ 'numpy>=1.23.4',
42
+ 'opencv-python>=4.6.0.66',
43
+ 'Pillow>=9.2.0',
44
+ 'PyYAML>=6.0'
45
+ ],
46
+ python_requires='>=3.10',
47
+ entry_points={
48
+ "console_scripts": []
49
+ }
50
+ )
static/css/main.css CHANGED
@@ -3,24 +3,24 @@ body {
3
  font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
 
9
  }
10
 
11
- p {
12
  color: rgb(107, 114, 128);
13
  font-size: 15px;
14
  margin-bottom: 10px;
15
  margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
  .card p:last-child {
@@ -48,4 +48,9 @@ p {
48
 
49
  .test_button_text_empty {
50
  display: inline-block;
 
 
 
 
 
51
  }
 
3
  font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
+ .card {
7
+ max-width: 620px;
8
+ margin: 0 auto;
9
+ padding: 16px;
10
+ border: 1px solid lightgray;
11
+ border-radius: 16px;
12
  }
13
 
14
+ .card p {
15
  color: rgb(107, 114, 128);
16
  font-size: 15px;
17
  margin-bottom: 10px;
18
  margin-top: 5px;
19
  }
20
 
21
+ .card h1 {
22
+ font-size: 16px;
23
+ margin-top: 0;
 
 
 
24
  }
25
 
26
  .card p:last-child {
 
48
 
49
  .test_button_text_empty {
50
  display: inline-block;
51
+ }
52
+
53
+ #pkg_version {
54
+ color: purple;
55
+ font-size: large;
56
  }
templates/index.html CHANGED
@@ -27,6 +27,11 @@
27
  <button id="btn2" class="test_button">Click Me Too!</button>
28
  <div id="btn2_text" class="test_button_text_empty"></div>
29
 
 
 
 
 
 
30
  <h1>Navigation</h1>
31
  <ul>
32
  <li>
 
27
  <button id="btn2" class="test_button">Click Me Too!</button>
28
  <div id="btn2_text" class="test_button_text_empty"></div>
29
 
30
+ <h1>mypkg</h1>
31
+ <div id="pkg_version">
32
+ <p style="display:inline-block">Version</p>: {{ mypkg_version }}
33
+ </div>
34
+
35
  <h1>Navigation</h1>
36
  <ul>
37
  <li>