Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build process #76

Merged
merged 8 commits into from
May 8, 2024
Merged
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
21 changes: 12 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.py]
[*.toml]
indent_size = 2

[*.ini]
indent_size = 4
max_line_length = 100

[*.html]
[*.yml]
indent_size = 2

[{*.css,*.pcss}]
indent_size = 2
[*.py]
indent_size = 4
max_line_length = 100

[{*.yml,*.yaml}]
[*.json]
indent_size = 2

[*.ini]
indent_size = 4
[*.html]
indent_size = 2

[*.sh]
[{*.css,*.pcss}]
indent_size = 2
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Switch Python files to use double quotes
d00cda74fab5bd100dca4792c9f7503429186069
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
Expand All @@ -26,9 +26,9 @@ jobs:
test-css:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: current
- name: Build and test
Expand Down
31 changes: 12 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,26 @@ on:
release:
types: [published]
jobs:
publish-python:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Tags are needed to compute the current version number
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: current
- name: Build CSS
run: |
yarn install --frozen-lockfile
yarn run build
- name: Install tox
- name: Install Python build
run: |
pip install --upgrade pip
pip install tox
- name: Publish to PyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: "true"
pip install build
- name: Build the Python distribution
run: |
tox -e release
python -m build
- name: Publish the Python distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 0 additions & 13 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions auth_style/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class AuthStyleConfig(AppConfig):
name = 'auth_style'
verbose_name = 'Auth Style'
name = "auth_style"
verbose_name = "Auth Style"
4 changes: 2 additions & 2 deletions dev/auth_style_design/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class AuthStyleDesignConfig(AppConfig):
name = 'auth_style_design'
verbose_name = 'Auth Style Design'
name = "auth_style_design"
verbose_name = "Auth Style Design"
11 changes: 5 additions & 6 deletions dev/auth_style_design/migrations/0001_default_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def update_default_site(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
Site = apps.get_model('sites', 'Site') # noqa: N806
Site = apps.get_model("sites", "Site") # noqa: N806

# A default site object may or may not exist.
# If this is a brand-new database, the post_migrate will not fire until the very end of the
Expand All @@ -14,23 +14,22 @@ def update_default_site(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor
# object already.
Site.objects.update_or_create(
pk=settings.SITE_ID,
defaults={'domain': 'auth-style-design.test', 'name': 'Auth Style Design'},
defaults={"domain": "auth-style-design.test", "name": "Auth Style Design"},
)


def rollback_default_site(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
Site = apps.get_model('sites', 'Site') # noqa: N806
Site = apps.get_model("sites", "Site") # noqa: N806

# This is the initial value of the default site object, as populated by the sites app.
# If it doesn't exist for some reason, there is nothing to roll back.
Site.objects.filter(pk=settings.SITE_ID).update(domain='example.com', name='example.com')
Site.objects.filter(pk=settings.SITE_ID).update(domain="example.com", name="example.com")


class Migration(migrations.Migration):

dependencies = [
# This is the final sites app migration
('sites', '0002_alter_domain_unique'),
("sites", "0002_alter_domain_unique"),
]

operations = [
Expand Down
25 changes: 12 additions & 13 deletions dev/auth_style_design/migrations/0002_default_allauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@


def create_default_allauth(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
User = apps.get_model('auth', 'User') # noqa: N806
EmailAddress = apps.get_model('account', 'EmailAddress') # noqa: N806
User = apps.get_model("auth", "User") # noqa: N806
EmailAddress = apps.get_model("account", "EmailAddress") # noqa: N806

user = User.objects.create_user(
username='[email protected]',
email='[email protected]',
password='password',
first_name='John',
last_name='Doe',
username="[email protected]",
email="[email protected]",
password="password",
first_name="John",
last_name="Doe",
)
EmailAddress.objects.create(
user=user,
Expand All @@ -23,20 +23,19 @@ def create_default_allauth(apps: StateApps, schema_editor: BaseDatabaseSchemaEdi


def delete_default_allauth(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
User = apps.get_model('auth', 'User') # noqa: N806
User = apps.get_model("auth", "User") # noqa: N806

User.objects.filter(email='[email protected]').delete()
User.objects.filter(email="[email protected]").delete()
# EmailAddress will cascade delete


class Migration(migrations.Migration):

dependencies = [
('auth_style_design', '0001_default_site'),
("auth_style_design", "0001_default_site"),
# This is the final auth app migration
('auth', '0012_alter_user_first_name_max_length'),
("auth", "0012_alter_user_first_name_max_length"),
# This is the final account (Allauth) app migration
('account', '0002_email_max_length'),
("account", "0002_email_max_length"),
]

operations = [
Expand Down
27 changes: 13 additions & 14 deletions dev/auth_style_design/migrations/0003_default_oauth_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,33 @@


def create_default_oauth_application(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
User = apps.get_model('auth', 'User') # noqa: N806
Application = apps.get_model('oauth2_provider', 'Application') # noqa: N806
User = apps.get_model("auth", "User") # noqa: N806
Application = apps.get_model("oauth2_provider", "Application") # noqa: N806

user = User.objects.get(email='[email protected]')
user = User.objects.get(email="[email protected]")
Application.objects.create(
user=user,
redirect_uris='http://127.0.0.1:8000/ urn:ietf:wg:oauth:2.0:oob',
client_type='public', # Application.CLIENT_PUBLIC
authorization_grant_type='authorization-code', # Application.GRANT_AUTHORIZATION_CODE
client_secret='',
name='auth-style-design',
redirect_uris="http://127.0.0.1:8000/ urn:ietf:wg:oauth:2.0:oob",
client_type="public", # Application.CLIENT_PUBLIC
authorization_grant_type="authorization-code", # Application.GRANT_AUTHORIZATION_CODE
client_secret="",
name="auth-style-design",
)


def delete_default_oauth_application(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor):
Application = apps.get_model('oauth2_provider', 'Application') # noqa: N806
Application = apps.get_model("oauth2_provider", "Application") # noqa: N806

Application.objects.filter(name='auth-style-design').delete()
Application.objects.filter(name="auth-style-design").delete()


class Migration(migrations.Migration):

dependencies = [
('auth_style_design', '0002_default_allauth'),
("auth_style_design", "0002_default_allauth"),
# This is the final auth app migration
('auth', '0012_alter_user_first_name_max_length'),
("auth", "0012_alter_user_first_name_max_length"),
# This is the final oauth2_provider app migration
('oauth2_provider', '0005_auto_20211222_2352'),
("oauth2_provider", "0005_auto_20211222_2352"),
]

operations = [
Expand Down
Loading