Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
[run]
branch = True
parallel = True
data_file = build/.coverage

[report]
include=bottle.py

[html]
directory = build/coverage
source = bottle
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: latest

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
5 changes: 4 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bottle is written and maintained by Marcel Hellkamp <[email protected]>.

Thanks to all the people who found bugs, sent patches, spread the word, helped each other on the mailing-list and made this project possible. I hope the following (alphabetically sorted) list is complete. If you miss your name on that list (or want your name removed) please :doc:`tell me <contact>` or add it yourself.
Thanks to all the people who found bugs, sent patches, spread the word, helped each other on the mailing-list and made this project possible. I hope the following (alphabetically sorted) list is complete. If you miss your name on that list (or want your name removed) please file a pull request.

* acasajus
* Adam R. Smith
Expand Down Expand Up @@ -36,6 +36,7 @@ Thanks to all the people who found bugs, sent patches, spread the word, helped e
* Johannes Krampf
* Jonas Haag
* Joshua Roesslein
* Judson Neer
* Karl
* Kevin Zuber
* Kraken
Expand All @@ -47,6 +48,7 @@ Thanks to all the people who found bugs, sent patches, spread the word, helped e
* Michael Soulier
* `reddit <http://reddit.com/r/python>`_
* Nicolas Vanhoren
* Oz N Tiram
* Robert Rollins
* rogererens
* rwxrwx
Expand All @@ -62,3 +64,4 @@ Thanks to all the people who found bugs, sent patches, spread the word, helped e
* voltron
* Wieland Hoffmann
* zombat
* Thiago Avelino
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012, Marcel Hellkamp.
Copyright (c) 2009-2024, Marcel Hellkamp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include bottle.py
include setup.py
include README.rst
include LICENSE.txt
include LICENSE
include test/views/*.tpl
include test/*.py
53 changes: 34 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,52 +1,67 @@
PATH := build/python/bin:$(PATH)
VERSION = $(shell python setup.py --version)
ALLFILES = $(shell echo bottle.py test/*.py test/views/*.tpl)
VENV = build/venv
TESTBUILD = build/python

.PHONY: release coverage install docs test 2to3 clean
.PHONY: venv release coverage install docs test clean

release: clean venv
release: clean test_all venv
$(VENV)/bin/python3 setup.py --version | egrep -q -v '[a-zA-Z]' # Fail on dev/rc versions
git commit -e -m "Release of $(VERSION)" # Fail on nothing to commit
git tag -a -m "Release of $(VERSION)" $(VERSION) # Fail on existing tags
git push origin HEAD # Fail on out-of-sync upstream
git push origin tag $(VERSION) # Fail on dublicate tag
$(VENV)/bin/python3 setup.py sdist bdist_wheel # Build project
$(VENV)/bin/twine upload dist/bottle-$(VERSION)* # Release to pypi
$(VENV)/bin/twine upload dist/$(VERSION)* # Release to pypi

venv: $(VENV)/.installed
$(VENV)/.installed: Makefile
python3 -mvenv $(VENV)
$(VENV)/bin/python3 -mensurepip
$(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -U setuptools wheel twine coverage
$(VENV)/bin/pip install -U setuptools wheel twine pytest coverage
$(VENV)/bin/pip install -U sphinx sphinx-intl transifex-client
touch $(VENV)/.installed

coverage:
-mkdir build/
coverage erase
COVERAGE_PROCESS_START=.coveragerc python -m unittest discover
coverage combine
coverage report
coverage html
coverage: venv
$(VENV)/bin/coverage erase
$(VENV)/bin/coverage run -m pytest
$(VENV)/bin/coverage combine
$(VENV)/bin/coverage report
$(VENV)/bin/coverage html

push: test
push: test_all
git push origin HEAD

install:
python setup.py install

docs:
sphinx-build -b html -d build/docs/doctrees docs build/docs/html
docs: venv
$(VENV)/bin/sphinx-build -b html -d build/docs/doctrees docs build/docs/html/;

test:
python -m unittest discover
tx-pull: venv
. $(VENV)/bin/activate; \
cd docs/_locale/ \
&& tx pull -af

tx-push: venv
. $(VENV)/bin/activate; \
cd docs/_locale/ \
&& sphinx-build -b gettext -E .. _pot \
&& sphinx-intl update-txconfig-resources -p _pot -d . --transifex-project-name bottle \
&& tx push -s

tx:
$(MAKE) tx-push
$(MAKE) tx-pull

test: venv
. $(VENV)/bin/activate; pytest

clean:
rm -rf build/ dist/ MANIFEST 2>/dev/null || true
rm -rf $(VENV) build/ dist/ MANIFEST .coverage .name htmlcov 2>/dev/null || true
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '._*' -exec rm -f {} +
find . -name '.coverage*' -exec rm -f {} +
79 changes: 59 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
Bottle Web Framework
====================

.. image:: http://bottlepy.org/docs/dev/_static/logo_nav.png
:target: http://bottlepy.org/
:alt: Bottle Logo
:align: right

Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (URL routing) with URL parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file and with no dependencies other than the
Python Standard Library.
.. image:: https://github.com/bottlepy/bottle/workflows/Tests/badge.svg
:target: https://github.com/bottlepy/bottle/workflows/Tests
:alt: Tests Status

Homepage and documentation: http://bottlepy.org/
License: MIT (see LICENSE)
.. image:: https://img.shields.io/pypi/v/bottle.svg
:target: https://pypi.python.org/pypi/bottle/
:alt: Latest Version

Installation and Dependencies
-----------------------------
.. image:: https://img.shields.io/pypi/l/bottle.svg
:target: https://pypi.python.org/pypi/bottle/
:alt: License

Install bottle with ``pip install bottle`` or just `download bottle.py <http://pypi.python.org/pypi/bottle>`_ and place it in your project directory. There are no (hard) dependencies other than the Python Standard Library.
.. _mako: http://www.makotemplates.org/
.. _cheetah: http://www.cheetahtemplate.org/
.. _jinja2: http://jinja.pocoo.org/
.. _paste: https://pythonpaste.readthedocs.io/
.. _fapws3: https://github.com/william-os4y/fapws3
.. _bjoern: https://github.com/jonashaag/bjoern
.. _cherrypy: https://docs.cherrypy.dev/
.. _WSGI: https://wsgi.readthedocs.io/
.. _Python: http://python.org/

============================
Bottle: Python Web Framework
============================

Example
-------
Bottle is a fast, simple and lightweight WSGI_ micro web-framework for Python_. It is distributed as a single file module and has no dependencies other than the `Python Standard Library <http://docs.python.org/library/>`_.


* **Routing:** Requests to function-call mapping with support for clean and dynamic URLs.
* **Templates:** Fast and pythonic `*built-in template engine* <http://bottlepy.org/docs/dev/tutorial.html#tutorial-templates>`_ and support for mako_, jinja2_ and cheetah_ templates.
* **Utilities:** Convenient access to form data, file uploads, cookies, headers and other HTTP-related metadata.
* **Server:** Built-in HTTP development server and support for paste_, fapws3_, bjoern_, `Google App Engine <https://cloud.google.com/appengine/>`_, cherrypy_ or any other WSGI_ capable HTTP server.

Homepage and documentation: http://bottlepy.org


Example: "Hello World" in a bottle
----------------------------------

.. code-block:: python

from bottle import route, run
from bottle import route, run, template

@route('/hello/<name>')
def index(name):
return template('<b>Hello {{name}}</b>!', name=name)

run(host='localhost', port=8080)

Run this script or paste it into a Python console, then point your browser to `<http://localhost:8080/hello/world>`_. That's it.


Download and Install
--------------------

.. __: https://github.com/bottlepy/bottle/raw/master/bottle.py

Install the latest stable release with ``pip install bottle`` or download `bottle.py`__ (unstable) into your project directory. There are no hard dependencies other than the Python standard library.

License
-------

.. __: https://github.com/bottlepy/bottle/raw/master/LICENSE

@route('/hello/<name>')
def hello(name):
return '<h1>Hello %s!</h1>' % name.title()
Code and documentation are available according to the MIT License (see LICENSE__).

run(host='localhost', port=8080)
The Bottle logo however is *NOT* covered by that license. It is allowed to use the logo as a link to the bottle homepage or in direct context with the unmodified library. In all other cases, please ask first.
Loading
Loading