Skip to content

Commit

Permalink
Apply updates from cookiecutter
Browse files Browse the repository at this point in the history
This automated commit applies the latest updates from our cookiecutters [1] to
this repo.

[1]: https://github.com/hypothesis/cookiecutters
  • Loading branch information
github-actions[bot] authored and seanh committed Aug 16, 2023
1 parent 83a6259 commit aaf797e
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 29 deletions.
36 changes: 33 additions & 3 deletions bin/make_db
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
"""Initialize the dev environment's DB."""
#!/usr/bin/env python3
import sys
"""Initialize the dev environment's DB."""
import alembic.command
import alembic.config
from pyramid.paster import bootstrap
bootstrap("conf/development.ini")
from sqlalchemy import text
from sqlalchemy.exc import ProgrammingError

from test_pyramid_app.db import Base, create_engine


def is_stamped(engine) -> bool:
"""Return True if the DB is stamped with an Alembic revision ID."""
with engine.connect() as connection:
try:
if connection.execute(text("select * from alembic_version")).first():
return True
except ProgrammingError:
pass

return False


def main():
with bootstrap("conf/development.ini") as env:
settings = env["registry"].settings
engine = create_engine(settings)

if not is_stamped(engine):
Base.metadata.create_all(engine)
alembic.command.stamp(alembic.config.Config("conf/alembic.ini"), "head")


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion requirements/checkformatting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/checkformatting.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/checkformatting.in
#
black==23.7.0
# via -r requirements/checkformatting.in
Expand Down Expand Up @@ -38,6 +38,7 @@ tomli==2.0.1
# via
# black
# build
# pep517
# pip-tools
wheel==0.38.1
# via pip-tools
Expand Down
2 changes: 1 addition & 1 deletion requirements/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/coverage.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/coverage.in
#
build==0.8.0
# via pip-tools
Expand Down
26 changes: 21 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/dev.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/dev.in
#
alembic==1.11.1
# via -r requirements/prod.txt
Expand Down Expand Up @@ -116,8 +116,11 @@ oauthlib==3.2.2
# via
# -r requirements/prod.txt
# requests-oauthlib
packaging==21.3
# via build
packaging==23.1
# via
# -r requirements/prod.txt
# build
# zope-sqlalchemy
parso==0.8.3
# via jedi
pastedeploy==2.1.1
Expand Down Expand Up @@ -171,20 +174,21 @@ pyjwt==2.6.0
# via
# -r requirements/prod.txt
# pyramid-googleauth
pyparsing==3.0.9
# via packaging
pyramid==2.0.1
# via
# -r requirements/prod.txt
# pyramid-googleauth
# pyramid-ipython
# pyramid-jinja2
# pyramid-tm
pyramid-googleauth==1.0.5
# via -r requirements/prod.txt
pyramid-ipython==0.2
# via -r requirements/dev.in
pyramid-jinja2==2.10
# via -r requirements/prod.txt
pyramid-tm==2.5
# via -r requirements/prod.txt
python-dateutil==2.8.2
# via
# -r requirements/prod.txt
Expand All @@ -205,13 +209,15 @@ rsa==4.9
six==1.16.0
# via
# -r requirements/prod.txt
# asttokens
# click-repl
# google-auth
# python-dateutil
sqlalchemy==2.0.17
# via
# -r requirements/prod.txt
# alembic
# zope-sqlalchemy
stack-data==0.3.0
# via ipython
supervisor==4.2.5
Expand All @@ -225,6 +231,11 @@ traitlets==5.3.0
# via
# ipython
# matplotlib-inline
transaction==3.1.0
# via
# -r requirements/prod.txt
# pyramid-tm
# zope-sqlalchemy
translationstring==1.4
# via
# -r requirements/prod.txt
Expand Down Expand Up @@ -273,6 +284,10 @@ zope-interface==5.4.0
# via
# -r requirements/prod.txt
# pyramid
# transaction
# zope-sqlalchemy
zope-sqlalchemy==3.0
# via -r requirements/prod.txt

# The following packages are considered to be unsafe in a requirements file:
pip==22.2.1
Expand All @@ -288,3 +303,4 @@ setuptools==65.5.1
# supervisor
# zope-deprecation
# zope-interface
# zope-sqlalchemy
3 changes: 2 additions & 1 deletion requirements/format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/format.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/format.in
#
black==23.7.0
# via -r requirements/format.in
Expand Down Expand Up @@ -38,6 +38,7 @@ tomli==2.0.1
# via
# black
# build
# pep517
# pip-tools
wheel==0.38.1
# via pip-tools
Expand Down
22 changes: 18 additions & 4 deletions requirements/functests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/functests.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/functests.in
#
alembic==1.11.1
# via -r requirements/prod.txt
Expand Down Expand Up @@ -116,10 +116,12 @@ oauthlib==3.2.2
# via
# -r requirements/prod.txt
# requests-oauthlib
packaging==21.3
packaging==23.1
# via
# -r requirements/prod.txt
# build
# pytest
# zope-sqlalchemy
pastedeploy==2.1.1
# via
# -r requirements/prod.txt
Expand Down Expand Up @@ -162,17 +164,18 @@ pyjwt==2.6.0
# via
# -r requirements/prod.txt
# pyramid-googleauth
pyparsing==3.0.9
# via packaging
pyramid==2.0.1
# via
# -r requirements/prod.txt
# pyramid-googleauth
# pyramid-jinja2
# pyramid-tm
pyramid-googleauth==1.0.5
# via -r requirements/prod.txt
pyramid-jinja2==2.10
# via -r requirements/prod.txt
pyramid-tm==2.5
# via -r requirements/prod.txt
pytest==7.4.0
# via
# -r requirements/functests.in
Expand Down Expand Up @@ -208,12 +211,18 @@ sqlalchemy==2.0.17
# via
# -r requirements/prod.txt
# alembic
# zope-sqlalchemy
tomli==2.0.1
# via
# build
# pep517
# pip-tools
# pytest
transaction==3.1.0
# via
# -r requirements/prod.txt
# pyramid-tm
# zope-sqlalchemy
translationstring==1.4
# via
# -r requirements/prod.txt
Expand Down Expand Up @@ -268,6 +277,10 @@ zope-interface==5.4.0
# via
# -r requirements/prod.txt
# pyramid
# transaction
# zope-sqlalchemy
zope-sqlalchemy==3.0
# via -r requirements/prod.txt

# The following packages are considered to be unsafe in a requirements file:
pip==23.0.1
Expand All @@ -282,3 +295,4 @@ setuptools==65.5.1
# pyramid
# zope-deprecation
# zope-interface
# zope-sqlalchemy
29 changes: 22 additions & 7 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe requirements/lint.in
# pip-compile --allow-unsafe --config=pyproject.toml requirements/lint.in
#
alembic==1.11.1
# via
Expand Down Expand Up @@ -182,12 +182,13 @@ oauthlib==3.2.2
# -r requirements/functests.txt
# -r requirements/tests.txt
# requests-oauthlib
packaging==21.3
packaging==23.1
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
# build
# pytest
# zope-sqlalchemy
pastedeploy==2.1.1
# via
# -r requirements/functests.txt
Expand Down Expand Up @@ -258,17 +259,13 @@ pyjwt==2.6.0
# pyramid-googleauth
pylint==2.17.4
# via -r requirements/lint.in
pyparsing==3.0.9
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
# packaging
pyramid==2.0.1
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
# pyramid-googleauth
# pyramid-jinja2
# pyramid-tm
pyramid-googleauth==1.0.5
# via
# -r requirements/functests.txt
Expand All @@ -277,6 +274,10 @@ pyramid-jinja2==2.10
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
pyramid-tm==2.5
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
pytest==7.4.0
# via
# -r requirements/functests.txt
Expand Down Expand Up @@ -326,6 +327,7 @@ sqlalchemy==2.0.17
# -r requirements/functests.txt
# -r requirements/tests.txt
# alembic
# zope-sqlalchemy
toml==0.10.2
# via -r requirements/lint.in
tomli==2.0.1
Expand All @@ -340,6 +342,12 @@ tomli==2.0.1
# pytest
tomlkit==0.11.1
# via pylint
transaction==3.1.0
# via
# -r requirements/functests.txt
# -r requirements/tests.txt
# pyramid-tm
# zope-sqlalchemy
translationstring==1.4
# via
# -r requirements/functests.txt
Expand Down Expand Up @@ -415,6 +423,12 @@ zope-interface==5.4.0
# -r requirements/functests.txt
# -r requirements/tests.txt
# pyramid
# transaction
# zope-sqlalchemy
zope-sqlalchemy==3.0
# via
# -r requirements/functests.txt
# -r requirements/tests.txt

# The following packages are considered to be unsafe in a requirements file:
pip==23.0.1
Expand All @@ -433,3 +447,4 @@ setuptools==65.5.1
# pyramid
# zope-deprecation
# zope-interface
# zope-sqlalchemy
2 changes: 2 additions & 0 deletions requirements/prod.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ newrelic
sqlalchemy
psycopg2
alembic
pyramid-tm
zope.sqlalchemy
celery
pyramid-googleauth
pyramid-jinja2
Loading

0 comments on commit aaf797e

Please sign in to comment.