Add support for building Docker files and CI pipelines and removed

setup.py
This commit is contained in:
Raoul Snyman 2023-07-27 16:26:27 -07:00
parent 73f2e54a74
commit 1fb85502d6
6 changed files with 68 additions and 55 deletions

18
.woodpecker.yaml Normal file
View File

@ -0,0 +1,18 @@
steps:
lint:
image: python:3.11
commands:
- pip install hatch
- hatch lint:lint
build:
image: python:3.11
commands:
- pip install hatch
- hatch build
# when: tag
deploy:
image: python:3.11
commands:
- pip install hatch
- hatch upload
when: tag

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM python:3.11
ADD ./dist/stickynotes-*.whl /tmp
RUN pip install /tmp/*.whl
EXPOSE 8000
CMD ["hypercorn", "stickynotes.app"]

33
README.rst Normal file
View 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.

View File

@ -37,8 +37,6 @@ dependencies = [
"nord-pygments",
"psycopg2_binary",
"Pygments",
"requests",
"short_url",
]
[project.optional-dependencies]
@ -46,7 +44,6 @@ dev = [
"pytest-cov",
"pytest",
]
[project.urls]
Homepage = "https://bin.snyman.info"
@ -60,3 +57,12 @@ include = [
[tool.hatch.envs.default.scripts]
server = "quart -A stickynotes.app run"
[tool.hatch.envs.lint]
skip-install = true
dependencies = [
"flake8"
]
[tool.hatch.envs.lint.scripts]
lint = "flake8"

View File

@ -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',
],
)

View File

@ -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)