Skip to content

Commit

Permalink
Refactor structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Nov 29, 2023
1 parent a9db082 commit 7b233f8
Show file tree
Hide file tree
Showing 48 changed files with 23 additions and 37 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@ name: CI
on: [push, pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install Python requirements
run: pip install -r requirements.txt
- name: Lint Python
run: |
isort . --diff --verbose
black . --check --verbose
flake8 . --verbose
test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -34,10 +16,10 @@ jobs:
- name: Get fixtures
run: cd .. && git clone https://github.com/nationalarchives/tna-frontend.git
- name: Install Python requirements
run: pip install -r requirements.txt
run: pip install -r test/requirements.txt
- name: Install Node dependencies
run: cd tasks && npm install
run: cd test/tasks && npm install
- name: Run server
run: flask --app tna-frontend-jinja run --debug --port 5000 &
run: flask --app test run --debug --port 5000 &
- name: Run the tests
run: node ./tasks/test.mjs || exit 1
run: node ./test/tasks/test-fixtures.mjs || exit 1
8 changes: 4 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
- name: Get fixtures
run: cd .. && git clone https://github.com/nationalarchives/tna-frontend.git
- name: Install Python requirements
run: pip install -r requirements.txt
run: pip install -r test/requirements.txt
- name: Install Node dependencies
run: cd tasks && npm install
run: cd test/tasks && npm install
- name: Run server
run: flask --app tna-frontend-jinja run --debug --port 5000 &
run: flask --app test run --debug --port 5000 &
- name: Run the tests
run: node ./tasks/test.mjs || exit 1
run: node ./test/tasks/test-fixtures.mjs || exit 1

deploy:
name: Upload release to PyPI
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
### Changed

- Refactor structure of project

### Deprecated
### Removed
### Fixed
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
## Quickstart

```sh
flask --app tna-frontend-jinja run --debug --port 5000
node tasks/test.mjs
python -m venv venv
python install -r test/requirements.txt
flask --app test run --debug --port 5000
node test/tasks/test-fixtures.mjs
```
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"Topic :: Software Development :: User Interfaces",
"Topic :: Text Processing :: Markup :: HTML",
],
packages=setuptools.find_packages(exclude=["app"]),
packages=["tna_frontend_jinja"],
package_data={
"templates": ["*.html"],
"": ["**/*.html"],
},
python_requires=">=3.8",
install_requires=["flask>=2"],
Expand Down
3 changes: 3 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .app import create_app

app = create_app()
2 changes: 1 addition & 1 deletion app/__init__.py → test/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def create_app():
app = Flask(__name__, template_folder="../templates")
app = Flask(__name__, template_folder="../../tna_frontend_jinja/templates")

from .components import bp as components_bp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

bp = Blueprint("components", __name__, template_folder="test-templates")

from app.components import routes # noqa: E402,F401
from test.app.components import routes # noqa: E402,F401
3 changes: 1 addition & 2 deletions app/components/routes.py → test/app/components/routes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import json
from test.app.components import bp

from flask import render_template, request

from app.components import bp


def render_component(template):
params = request.args.get("params")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions tna-frontend-jinja.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7b233f8

Please sign in to comment.