362 lines
11 KiB
Plaintext
362 lines
11 KiB
Plaintext
==> ./contents <==
|
||
|
||
==> ./setup.cfg <==
|
||
# flake8 doesn't support pyproject.toml yet:
|
||
# https://github.com/PyCQA/flake8/issues/234
|
||
[flake8]
|
||
exclude = setup.py,venv,build,dist
|
||
max-line-length = 88
|
||
|
||
==> ./.gitignore <==
|
||
# Python
|
||
__pycache__/
|
||
|
||
# Files created by this set up:
|
||
venv/
|
||
build/
|
||
|
||
dist/
|
||
*.egg-info/
|
||
.pytest_cache/
|
||
.mypy_cache/
|
||
|
||
==> ./Makefile <==
|
||
all: run
|
||
|
||
clean:
|
||
rm -rf venv build dist .pytest_cache .mypy_cache *.egg-info
|
||
|
||
venv:
|
||
python3 -m venv venv && \
|
||
venv/bin/pip install --upgrade pip setuptools && \
|
||
venv/bin/pip install --editable ".[dev]"
|
||
|
||
run: venv
|
||
venv/bin/flask --app scipaperloader --debug run
|
||
|
||
format: venv
|
||
venv/bin/black . && venv/bin/isort .
|
||
|
||
format-check: venv
|
||
venv/bin/black --check . && venv/bin/isort --check .
|
||
|
||
lint: venv
|
||
venv/bin/flake8 .
|
||
|
||
mypy: venv
|
||
venv/bin/mypy
|
||
|
||
test: venv
|
||
venv/bin/pytest
|
||
|
||
dist: venv format-check lint mypy test
|
||
venv/bin/pip wheel --wheel-dir dist --no-deps .
|
||
|
||
==> ./pyproject.toml <==
|
||
[build-system]
|
||
requires = ["setuptools"]
|
||
build-backend = "setuptools.build_meta"
|
||
|
||
[project]
|
||
name = "scipaperloader"
|
||
version = "1.0.0"
|
||
requires-python = ">=3.8.1,<4"
|
||
dependencies = [
|
||
"Flask>=3.0.2,<4",
|
||
]
|
||
|
||
[project.optional-dependencies]
|
||
dev = [
|
||
"pytest>=8,<9",
|
||
"flake8>=7,<8",
|
||
"black>=24.2.0,<25",
|
||
"isort>=5.13.1,<6",
|
||
"mypy>=1.8.0,<2",
|
||
]
|
||
|
||
[tool.setuptools.package-data]
|
||
"*" = ["**/static/**/*", "**/templates/**/*"]
|
||
|
||
[tool.pytest.ini_options]
|
||
testpaths = ["tests"]
|
||
|
||
[tool.black]
|
||
line-length = 88
|
||
|
||
[tool.isort]
|
||
profile = "black"
|
||
|
||
[tool.mypy]
|
||
ignore_missing_imports = true
|
||
files = "scipaperloader,tests"
|
||
|
||
==> ./tests/test_scipaperloader.py <==
|
||
import pytest
|
||
|
||
from scipaperloader import create_app
|
||
|
||
|
||
@pytest.fixture
|
||
def app():
|
||
app = create_app({"TESTING": True})
|
||
# set up here
|
||
yield app
|
||
# tear down here
|
||
|
||
|
||
@pytest.fixture
|
||
def client(app):
|
||
return app.test_client()
|
||
|
||
|
||
def test_index(client):
|
||
response = client.get("/")
|
||
assert b"It works!" in response.data
|
||
|
||
==> ./scipaperloader/templates/index.html <==
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>SciPaperLoader</title>
|
||
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
||
</head>
|
||
<body class="message">
|
||
<h1>It works!</h1>
|
||
<h2>Next steps</h2>
|
||
<p>
|
||
The development environment is now set up and you can start coding! Check
|
||
out the <code>README.md</code> for the development environment usage.
|
||
</p>
|
||
<p>
|
||
If you are new to Flask, both
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/quickstart/">
|
||
Quickstart</a>
|
||
and
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/tutorial/">
|
||
Tutorial</a>
|
||
are great resources to get up and running quickly.
|
||
</p>
|
||
<p>
|
||
Check out Flask documentation for more
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/patterns/">
|
||
patterns</a>
|
||
such as using SQL DB or Mongo DB, making a single-page application and
|
||
many more features.
|
||
</p>
|
||
<p>
|
||
When you are ready to deploy, you may want to consider these:
|
||
</p>
|
||
<ul>
|
||
<li>
|
||
Depending on the target infrastructure, configure the
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/deploying/">
|
||
deployment,
|
||
</a>
|
||
</li>
|
||
<ul>
|
||
<li>
|
||
... and set a
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/tutorial/deploy/#configure-the-secret-key">
|
||
<code>SECRET_KEY</code></a>
|
||
in production.
|
||
</li>
|
||
</ul>
|
||
<li>
|
||
Depending on the deployment model, you may want to change the
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/logging/">
|
||
logging configuration</a>, and
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/config/">
|
||
how the configuration works</a>.
|
||
</li>
|
||
<li>Decide how to
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/errorhandling/">
|
||
handle errors</a>.
|
||
</li>
|
||
<li>
|
||
Consider your application
|
||
<a href="https://flask.palletsprojects.com/en/3.0.x/security/">
|
||
security</a>.
|
||
</li>
|
||
</ul>
|
||
</body>
|
||
</html>
|
||
|
||
==> ./scipaperloader/__pycache__/views.cpython-313.pyc <==
|
||
<EFBFBD>
|
||
|
||
|