Skip to content

Commit

Permalink
Drop bottle in favour of a tiny hand-rolled "framework"
Browse files Browse the repository at this point in the history
Turns out ycmd needs a tiny part of the whole framework specification
from PEP 3333.
Note that this does not fully conform to the specification, but it
mostly does.

Currently we are only handling POST and GET requests.
Support for middleware is limited. Inspired by Bottle plugins API, but
only `plugin.__call__` and `app.install` are implemented.
Error handling is also limited. Application needs to replace the default
error handler that *will* handle all errors.
  • Loading branch information
bstaletic committed Mar 31, 2024
1 parent 1693a93 commit 15e6c2b
Show file tree
Hide file tree
Showing 10 changed files with 323 additions and 97 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "third_party/bottle"]
path = third_party/bottle
url = https://github.com/defnull/bottle
[submodule "third_party/jedi"]
path = third_party/jedi_deps/jedi
url = https://github.com/davidhalter/jedi
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bottle >= 0.12.18
regex >= 2020.2.20
jedi >= 0.16.0
watchdog >= 0.10.2
4 changes: 0 additions & 4 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
LIBCLANG_DIR = p.join( DIR_OF_THIRD_PARTY, 'clang', 'lib' )

python_path = [
p.join( DIR_OF_THIRD_PARTY, 'bottle' ),
p.join( DIR_OF_THIRD_PARTY, 'regex-build' ),
p.join( DIR_OF_THIRD_PARTY, 'frozendict' ),
p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ),
p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ),
p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ),
p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ),
p.join( DIR_OF_THIRD_PARTY, 'waitress' ),
]
if os.environ.get( 'PYTHONPATH' ) is not None:
python_path.append( os.environ[ 'PYTHONPATH' ] )
Expand Down
1 change: 0 additions & 1 deletion third_party/bottle
Submodule bottle deleted from fee878
12 changes: 1 addition & 11 deletions ycmd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,10 @@
DIR_OF_REQUESTS_DEPS = os.path.join( DIR_OF_THIRD_PARTY, 'requests_deps' )
sys.path[ 0:0 ] = [
os.path.join( ROOT_DIR ),
os.path.join( DIR_OF_THIRD_PARTY, 'bottle' ),
os.path.join( DIR_OF_THIRD_PARTY, 'regex-build' ),
os.path.join( DIR_OF_THIRD_PARTY, 'frozendict' ),
os.path.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ),
os.path.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ),
os.path.join( DIR_OF_REQUESTS_DEPS, 'requests' ),
os.path.join( DIR_OF_REQUESTS_DEPS, 'chardet' ),
os.path.join( DIR_OF_REQUESTS_DEPS, 'certifi' ),
os.path.join( DIR_OF_REQUESTS_DEPS, 'idna' ),
os.path.join( DIR_OF_REQUESTS_DEPS, 'urllib3', 'src' ),
os.path.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ),
os.path.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ),
os.path.join( DIR_OF_THIRD_PARTY, 'waitress' ) ]
os.path.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ) ]
sys.path.append( os.path.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ) )

import atexit
Expand Down Expand Up @@ -203,7 +194,6 @@ def Main():
args.stderr,
args.keep_logfiles )
atexit.register( handlers.ServerCleanup )
handlers.app.uninstall( True )
handlers.app.install( WatchdogPlugin( args.idle_suicide_seconds,
args.check_interval_seconds ) )
handlers.app.install( HmacPlugin( hmac_secret ) )
Expand Down

0 comments on commit 15e6c2b

Please sign in to comment.