Skip to content

Commit

Permalink
updates dependecies and legacy scripts default python version. drops …
Browse files Browse the repository at this point in the history
…python 3.6
  • Loading branch information
filiplajszczak committed Feb 10, 2023
1 parent 5937718 commit e084148
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Expand Up @@ -7,20 +7,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]

name: Python ${{ matrix.python-version }}
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: UTC

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -14,12 +14,12 @@ from your own machine (see [usage](#Usage) below).
### On PythonAnywhere
In a PythonAnywhere Bash console, run:

pip3.9 install --user pythonanywhere
pip3.10 install --user pythonanywhere

If there is no `python3.9` on your PythonAnywhere account,
you should upgrade your account to the newest system image.
See [here](https://help.pythonanywhere.com/pages/ChangingSystemImage) how to do that.
`pa` works with python 3.6, 3.7 and 3.8, but we recommend using the latest system image.
`pa` works with python 3.7, 3.8 and 3.9, but we recommend using the latest system image.

### On your own machine
Install the `pythonanywhere` package from [PyPI](https://pypi.org/project/pythonanywhere/).
Expand Down Expand Up @@ -61,7 +61,7 @@ Some legacy [scripts](https://github.com/pythonanywhere/helper_scripts/blob/mast
Pull requests are welcome! You'll find tests in the [tests](https://github.com/pythonanywhere/helper_scripts/blob/master/tests) folder...

# prep your dev environment
mkvirtualenv --python=python3.6 helper_scripts
mkvirtualenv --python=python3.10 helper_scripts
pip install -r requirements.txt
pip install -e .

Expand Down
4 changes: 2 additions & 2 deletions cli/django.py
Expand Up @@ -19,10 +19,10 @@ def autoconfigure(
help="Domain name, eg www.mydomain.com",
),
python_version: str = typer.Option(
"3.6",
"3.7",
"-p",
"--python-version",
help="Python version, eg '3.8'",
help="Python version, eg '3.9'",
),
nuke: bool = typer.Option(
False,
Expand Down
4 changes: 2 additions & 2 deletions cli/webapp.py
Expand Up @@ -22,10 +22,10 @@ def create(
help="Domain name, eg www.mydomain.com",
),
python_version: str = typer.Option(
"3.6",
"3.7",
"-p",
"--python-version",
help="Python version, eg '3.8'",
help="Python version, eg '3.9'",
),
nuke: bool = typer.Option(
False,
Expand Down
1 change: 0 additions & 1 deletion pythonanywhere/api/base.py
Expand Up @@ -3,7 +3,6 @@
import requests

PYTHON_VERSIONS = {
"3.6": "python36",
"3.7": "python37",
"3.8": "python38",
"3.9": "python39",
Expand Down
2 changes: 1 addition & 1 deletion pythonanywhere/snakesay.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python3.6
#!/usr/bin/env python3.7
import sys
import textwrap

Expand Down
26 changes: 13 additions & 13 deletions requirements.txt
@@ -1,17 +1,17 @@
python-dateutil==2.8.1
click==8.0.3
python-dateutil==2.8.2
click==8.1.3
docopt==0.6.2
importlib-metadata==4.8.3
importlib-metadata==4.13.0
packaging
psutil==5.7.0
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock==3.6.1
pytest-mypy==0.6.2
requests==2.26.0
responses==0.16.0
psutil==5.9.4
pytest==7.2.0
pytest-cov==4.0.0
pytest-mock==3.10.0
pytest-mypy==0.10.3
requests==2.28.2
responses==0.22.0
schema==0.7.2
tabulate==0.8.9
typer==0.4.0
urllib3==1.26.7
tabulate==0.9.0
typer==0.7.0
urllib3==1.26.14
virtualenvwrapper==4.8.4
4 changes: 2 additions & 2 deletions scripts/pa_autoconfigure_django.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Autoconfigure a Django project from on a github URL.
- downloads the repo
Expand All @@ -13,7 +13,7 @@
Options:
--branch=<branch> Branch name in case of multiple branches [default: None]
--domain=<domain> Domain name, eg www.mydomain.com [default: your-username.pythonanywhere.com]
--python=<python-version> Python version, eg "3.8" [default: 3.6]
--python=<python-version> Python version, eg "3.8" [default: 3.7]
--nuke *Irrevocably* delete any existing web app config on this domain. Irrevocably.
"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_create_scheduled_task.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Create a scheduled task.
Two categories of tasks are available: daily and hourly.
Expand Down
4 changes: 2 additions & 2 deletions scripts/pa_create_webapp_with_virtualenv.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Create a web app with a virtualenv
- creates a simple hello world web app
Expand All @@ -11,7 +11,7 @@
Options:
--domain=<domain> Domain name, eg www.mydomain.com [default: your-username.pythonanywhere.com]
--python=<python-version> Python version, eg "3.8" [default: 3.6]
--python=<python-version> Python version, eg "3.8" [default: 3.7]
--nuke *Irrevocably* delete any existing web app config on this domain. Irrevocably.
"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_delete_scheduled_task.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Delete scheduled task(s) by id or nuke'em all.
Usage:
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_delete_webapp_logs.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Deletes webapp logs.
- gets list of logs via api
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_get_scheduled_task_specs.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Get current scheduled task's specs file by task id.
Available specs are: command, enabled, interval, hour, minute, printable-time,
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_get_scheduled_tasks_list.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Get list of user's scheduled tasks as a table with columns:
id, interval, at (hour:minute/minute past), status (enabled/disabled), command.
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_install_webapp_letsencrypt_ssl.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Set the HTTPS certificate and private key for a website, assuming that these have been generated by the dehydrated
script that gets them from Let's Encrypt, and that they're in the standard place. This script should normally only
be run on PythonAnywhere.
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_install_webapp_ssl.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Set the HTTPS certificate and private key for a website to the contents of two files, and reload the site.
Usage:
Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_reload_webapp.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Reloads the given site
Usage:
Expand Down
4 changes: 2 additions & 2 deletions scripts/pa_start_django_webapp_with_virtualenv.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Create a new Django webapp with a virtualenv. Defaults to
your free domain, the latest version of Django and Python 3.6
Expand All @@ -8,7 +8,7 @@
Options:
--domain=<domain> Domain name, eg www.mydomain.com [default: your-username.pythonanywhere.com]
--django=<django-version> Django version, eg "1.8.4" [default: latest]
--python=<python-version> Python version, eg "2.7" [default: 3.6]
--python=<python-version> Python version, eg "2.7" [default: 3.7]
--nuke *Irrevocably* delete any existing web app config on this domain. Irrevocably.
"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/pa_update_scheduled_task.py
@@ -1,4 +1,4 @@
#!/usr/bin/python3.6
#!/usr/bin/python3.7
"""Update a scheduled task using id and proper specs.
Note that logfile name will change after updating the task but it won't be
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Expand Up @@ -9,7 +9,7 @@

setup(
name="pythonanywhere",
version="0.10.3",
version="0.11.0",
description="PythonAnywhere helper tools for users",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -26,7 +26,6 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.6",
],
keywords="pythonanywhere api cloud web hosting",
packages=["cli", "pythonanywhere", "pythonanywhere.api"],
Expand All @@ -40,7 +39,7 @@
"typer",
],
extras_require={},
python_requires=">=3.6",
python_requires=">=3.7",
package_data={},
data_files=[],
entry_points={},
Expand Down
10 changes: 5 additions & 5 deletions tests/test_virtualenvs.py
Expand Up @@ -12,31 +12,31 @@ def test_path(self, virtualenvs_folder):
assert v.path == Path(virtualenvs_folder) / "domain.com"

def test_create_uses_bash_and_sources_virtualenvwrapper(self, mock_subprocess, virtualenvs_folder):
v = Virtualenv("domain.com", "3.6")
v = Virtualenv("domain.com", "3.7")
v.create(nuke=False)
args, kwargs = mock_subprocess.check_call.call_args
command_list = args[0]
assert command_list[:2] == ["bash", "-c"]
assert command_list[2].startswith("source virtualenvwrapper.sh && mkvirtualenv")

def test_create_calls_mkvirtualenv_with_python_version_and_domain(self, mock_subprocess, virtualenvs_folder):
v = Virtualenv("domain.com", "3.6")
v = Virtualenv("domain.com", "3.7")
v.create(nuke=False)
args, kwargs = mock_subprocess.check_call.call_args
command_list = args[0]
bash_command = command_list[2]
assert "mkvirtualenv --python=python3.6 domain.com" in bash_command
assert "mkvirtualenv --python=python3.7 domain.com" in bash_command

def test_nuke_option_deletes_virtualenv(self, mock_subprocess, virtualenvs_folder):
v = Virtualenv("domain.com", "3.6")
v = Virtualenv("domain.com", "3.7")
v.create(nuke=True)
args, kwargs = mock_subprocess.check_call.call_args
command_list = args[0]
assert command_list[:2] == ["bash", "-c"]
assert command_list[2].startswith("source virtualenvwrapper.sh && rmvirtualenv domain.com")

def test_install_pip_installs_each_package(self, mock_subprocess, virtualenvs_folder):
v = Virtualenv("domain.com", "3.6")
v = Virtualenv("domain.com", "3.7")
v.create(nuke=False)
v.pip_install("package1 package2==1.1.2")
args, kwargs = mock_subprocess.check_call.call_args_list[-1]
Expand Down

0 comments on commit e084148

Please sign in to comment.