diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..be3fafe --- /dev/null +++ b/.woodpecker.yaml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..46ea939 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11 + +ADD ./dist/stickynotes-*.whl /tmp +RUN pip install /tmp/*.whl + +EXPOSE 8000 +CMD ["hypercorn", "stickynotes.app"] diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..38d57af --- /dev/null +++ b/README.rst @@ -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. diff --git a/pyproject.toml b/pyproject.toml index c98b5f5..3a150c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/setup.py b/setup.py deleted file mode 100644 index 01dcd75..0000000 --- a/setup.py +++ /dev/null @@ -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', - ], -) diff --git a/stickynotes/views.py b/stickynotes/views.py index 14a36a1..6b57417 100644 --- a/stickynotes/views.py +++ b/stickynotes/views.py @@ -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)