Skip to content

Commit

Permalink
Add python3 -m cog.server.http wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nevillelyh committed Jan 6, 2025
1 parent b88d926 commit a2046e4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp
with:
skip-wheel: true
outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions python/cog/server/http/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os
import sys

# Lightweight wrapper from `python3 -m cog.server.http` to cog-server

args = sys.argv
args[0] = 'cog-server'
port = os.getenv('PORT')
if port is not None:
args += ['--port', port]
os.execvp('cog-server', args)
14 changes: 0 additions & 14 deletions python/coglet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
import pathlib
import sys
import warnings

try:
from ._version import __version__
except ImportError:
__version__ = '0.0.0+unknown'

warnings.warn(
(
'coglet/_compat/ is being added to the front of sys.path '
"for 'cog' import compatibility"
),
category=ImportWarning,
stacklevel=2,
)
sys.path.insert(0, str(pathlib.Path(__file__).absolute().parent / '_compat'))

0 comments on commit a2046e4

Please sign in to comment.