Skip to content

Commit

Permalink
Move requirements into setup.py to aid conda. #9
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeckennedy committed Apr 12, 2024
1 parent 98621f4 commit 55abe3a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions .idea/ruff.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jinja_partials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jinja_partials - Simple reuse of partial HTML page templates in the Jinja template language for Python web frameworks.
"""

__version__ = '0.2.0'
__version__ = '0.2.1'
__author__ = 'Michael Kennedy <[email protected]>'
__all__ = [
'register_extensions',
Expand All @@ -29,7 +29,7 @@
except ImportError:
starlette = None

if TYPE_CHECKING:
if TYPE_CHECKING and flask and starlette:
from flask import Flask
from starlette.templating import Jinja2Templates

Expand Down
36 changes: 19 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@
from setuptools import setup


def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*?)`'), text_type(r'``\1``'), fd.read())


with open('./requirements.txt', 'r', encoding='utf-8') as fin:
requires_list = [line.strip() for line in fin if line and line.strip()]
def read_readme(filename):
try:
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*?)`'), text_type(r'``\1``'), fd.read())
except:
return ''


def read_version():
filename = os.path.join(os.path.dirname(__file__), 'jinja_partials', '__init__.py')
with open(filename, mode="r", encoding='utf-8') as fin2:
for line in fin2:
if line and line.strip() and line.startswith('__version__'):
return line.split('=')[1].strip().strip("'").strip('"')
try:
filename = os.path.join(os.path.dirname(__file__), 'jinja_partials', '__init__.py')
with open(filename, mode="r", encoding='utf-8') as fin2:
for line in fin2:
if line and line.strip() and line.startswith('__version__'):
return line.split('=')[1].strip().strip("'").strip('"')

return "0.0.0.0"
return "0.0.0.0"
except:
return "0.0.0.0"


setup(
Expand All @@ -37,12 +39,12 @@ def read_version():
author_email="[email protected]",

description="Simple reuse of partial HTML page templates in the Jinja template language for Python web frameworks.",
long_description=read("README.md"),
long_description=read_readme("README.md"),
long_description_content_type="text/markdown",

packages=find_packages(exclude=('tests', 'example', 'readme_resources', 'build', 'dist',)),

install_requires=requires_list,
install_requires=['jinja2'],

classifiers=[
'Development Status :: 2 - Pre-Alpha',
Expand Down

0 comments on commit 55abe3a

Please sign in to comment.