Building out pipeline #2
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@ __pycache__
|
||||
stickynotes.cfg
|
||||
build
|
||||
dist
|
||||
.coverage
|
||||
htmlcov
|
||||
|
23
.woodpecker.yaml
Normal file
23
.woodpecker.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
steps:
|
||||
lint:
|
||||
image: python:3.11
|
||||
commands:
|
||||
- pip install hatch
|
||||
- hatch run lint:run
|
||||
test:
|
||||
image: python:3.11
|
||||
commands:
|
||||
- pip install hatch
|
||||
- cp stickynotes.example.cfg stickynotes.cfg
|
||||
- hatch run tests:run
|
||||
publish-package:
|
||||
image: python:3.11
|
||||
commands:
|
||||
- pip install hatch
|
||||
- hatch publish --repo $PIP_REPOSITORY --user $PIP_USERNAME --auth $PIP_TOKEN --no-prompt
|
||||
secrets:
|
||||
- pip_repository
|
||||
- pip_username
|
||||
- pip_token
|
||||
when:
|
||||
event: tag
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM python:3.11
|
||||
|
||||
RUN pip install stickynotes --index-url https://git.snyman.info/packages/raoul/index
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["hypercorn", "stickynotes.app"]
|
33
README.rst
Normal file
33
README.rst
Normal file
@ -0,0 +1,33 @@
|
||||
===========
|
||||
StickyNotes
|
||||
===========
|
||||
|
||||
StickyNotes is a simple "pastebin" written in Python using Quart, SQLAlchemy, Pygments and a few other libraries.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
The easiest way to install StickyNotes is via Docker and Docker Compose. Here's an example config:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
version: '3'
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
- POSTGRES_USER=stickynotes
|
||||
- POSTGRES_DB=stickynotes
|
||||
- POSTGRES_PASSWORD=stickynotes
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- "./data/postgres:/var/lib/postgresql/data"
|
||||
app:
|
||||
image: git.snyman.info/raoul/stickynotes:latest
|
||||
env:
|
||||
- SQLALCHEMY_URL=postgres://stickynotes:stickynotes@postgres/stickynotes
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:8000:8000"
|
||||
|
||||
Once you have that up and running, you can set up NGINX or another reverse proxy to port 8000 on 127.0.0.1.
|
@ -37,8 +37,6 @@ dependencies = [
|
||||
"nord-pygments",
|
||||
"psycopg2_binary",
|
||||
"Pygments",
|
||||
"requests",
|
||||
"short_url",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
@ -59,4 +57,23 @@ include = [
|
||||
]
|
||||
|
||||
[tool.hatch.envs.default.scripts]
|
||||
server = "quart -A stickynotes.app run"
|
||||
serve = "quart -A stickynotes.app run"
|
||||
|
||||
[tool.hatch.envs.lint]
|
||||
skip-install = true
|
||||
dependencies = [
|
||||
"flake8"
|
||||
]
|
||||
|
||||
[tool.hatch.envs.lint.scripts]
|
||||
run = "flake8"
|
||||
|
||||
[tool.hatch.envs.tests]
|
||||
dependencies = [
|
||||
"pytest-asyncio",
|
||||
"pytest-cov",
|
||||
"pytest",
|
||||
]
|
||||
|
||||
[tool.hatch.envs.tests.scripts]
|
||||
run = "pytest --cov=stickynotes --cov-report=html"
|
||||
|
51
setup.py
51
setup.py
@ -1,51 +0,0 @@
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
setup(
|
||||
name='StickyNotes',
|
||||
version='0.2',
|
||||
author='Raoul Snyman',
|
||||
description='A simple pastebin',
|
||||
url='https://bin.snyman.info',
|
||||
license='GPLv3+',
|
||||
packages=['stickynotes'],
|
||||
include_package_data=True,
|
||||
platforms='any',
|
||||
python_requires='>=3.5',
|
||||
install_requires=[
|
||||
'Flask',
|
||||
'Flask-SQLAlchemy',
|
||||
'Pygments',
|
||||
'requests',
|
||||
'short_url',
|
||||
'psycopg2_binary',
|
||||
'nord-pygments'
|
||||
],
|
||||
extras_require={
|
||||
'dev': [
|
||||
'pytest>=3',
|
||||
'pytest-cov',
|
||||
],
|
||||
},
|
||||
classifiers=[
|
||||
'Development Status :: 2 - Pre-Alpha',
|
||||
'Environment :: Web Environment',
|
||||
'Framework :: Flask',
|
||||
'Intended Audience :: Other Audience',
|
||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Topic :: Internet :: WWW/HTTP',
|
||||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
||||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Content Management System',
|
||||
'Topic :: Internet :: WWW/HTTP :: WSGI',
|
||||
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
|
||||
],
|
||||
)
|
@ -1,5 +1,3 @@
|
||||
[stickynotes]
|
||||
sqlalchemy_database_uri = sqlite:///stickynotes.sqlite
|
||||
sqlalchemy_database_uri = sqlite:///
|
||||
secret_key = yoursecretkeyhere
|
||||
recaptcha_site_key =
|
||||
recaptcha_secret_key =
|
||||
|
BIN
stickynotes/static/stickynotes.png
Normal file
BIN
stickynotes/static/stickynotes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
63
stickynotes/static/stickynotes.svg
Normal file
63
stickynotes/static/stickynotes.svg
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="67.896645mm"
|
||||
height="67.598412mm"
|
||||
viewBox="0 0 67.896645 67.598412"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="stickynotes.svg"
|
||||
inkscape:export-filename="stickynotes.png"
|
||||
inkscape:export-xdpi="95.769089"
|
||||
inkscape:export-ydpi="95.769089"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1"
|
||||
inkscape:cx="372"
|
||||
inkscape:cy="179.5"
|
||||
inkscape:window-width="2048"
|
||||
inkscape:window-height="1089"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-39.478145,-66.168889)">
|
||||
<g
|
||||
id="g1058"
|
||||
transform="matrix(0.52694337,0,0,0.52462675,18.768345,31.479611)"
|
||||
style="stroke-width:2.51608;stroke-dasharray:none">
|
||||
<path
|
||||
id="rect234"
|
||||
style="fill:#ffff00;stroke:#000000;stroke-width:2.51608;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
d="M 40.559798,67.379867 V 193.71427 h 94.750292 l 31.5836,-31.5836 V 67.379867 Z" />
|
||||
<path
|
||||
id="path1053"
|
||||
style="fill:#808000;stroke:#000000;stroke-width:2.51608;stroke-linecap:square;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
inkscape:transform-center-x="-6.6074958"
|
||||
inkscape:transform-center-y="10.398467"
|
||||
d="m 135.3101,162.13068 h 31.58358 l -31.58358,31.58357 z"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
@ -59,7 +59,7 @@ async def notes():
|
||||
.filter(or_(StickyNote.expiry == None, StickyNote.expiry < datetime.utcnow()))\
|
||||
.filter(~StickyNote.private)\
|
||||
.order_by(StickyNote.created.desc())\
|
||||
.limit(10) # noqa
|
||||
.limit(10) # noqa: E711
|
||||
return await render_template('notes.html', notes=notes)
|
||||
|
||||
|
||||
|
16
tests/test_views.py
Normal file
16
tests/test_views.py
Normal file
@ -0,0 +1,16 @@
|
||||
import pytest
|
||||
|
||||
from stickynotes.app import make_app
|
||||
|
||||
pytestmark = [pytest.mark.asyncio]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
return make_app()
|
||||
|
||||
|
||||
async def test_index(app):
|
||||
test_client = app.test_client()
|
||||
response = await test_client.get('/')
|
||||
assert response.status_code == 200
|
Loading…
Reference in New Issue
Block a user