Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.

Commit 6fefdb3

Browse files
committed
Add --ignore-missing-imports
1 parent 974a5ca commit 6fefdb3

6 files changed

Lines changed: 23 additions & 9 deletions

File tree

.github/templates/flask/module/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
def create_app():
66
app = Flask(__name__)
77
FlaskDynaconf(app) # config managed by Dynaconf
8-
app.load_extensions("EXTENSIONS") # Load extensions from settings.toml
8+
app.config.load_extensions(
9+
"EXTENSIONS"
10+
) # Load extensions from settings.toml
911
return app

.github/templates/flask/module/ext/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class UserAdmin(sqla.ModelView):
17-
column_list = ['username']
17+
column_list = ["username"]
1818
can_edit = False
1919

2020
def on_model_change(self, form, model, is_created):

.github/templates/flask/module/ext/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
def verify_login(user):
88
"""Validates user login"""
9-
username = user.get('username')
10-
password = user.get('password')
9+
username = user.get("username")
10+
password = user.get("password")
1111
if not username or not password:
1212
return False
1313
existing_user = User.query.filter_by(username=username).first()
@@ -21,7 +21,7 @@ def verify_login(user):
2121
def create_user(username, password):
2222
"""Creates a new user"""
2323
if User.query.filter_by(username=username).first():
24-
raise RuntimeError(f'{username} already exists')
24+
raise RuntimeError(f"{username} already exists")
2525
user = User(username=username, password=generate_password_hash(password))
2626
db.session.add(user)
2727
db.session.commit()

.github/templates/flask/module/ext/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def init_app(app):
3535

3636
# add a single command
3737
@app.cli.command()
38-
@click.option('--username', '-u')
39-
@click.option('--password', '-p')
38+
@click.option("--username", "-u")
39+
@click.option("--password", "-p")
4040
def add_user(username, password):
4141
"""Adds a new user to the database"""
4242
return create_user(username, password)

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ fmt: ## Format code using black & isort.
2626
$(ENV_PREFIX)isort project_name/
2727
$(ENV_PREFIX)black -l 79 project_name/
2828
$(ENV_PREFIX)black -l 79 tests/
29+
$(ENV_PREFIX)black -l 79 .github/templates/
2930

3031
.PHONY: lint
3132
lint: ## Run pep8, black, mypy linters.
3233
$(ENV_PREFIX)flake8 project_name/
34+
$(ENV_PREFIX)flake8 .github/templates/
3335
$(ENV_PREFIX)black -l 79 --check project_name/
3436
$(ENV_PREFIX)black -l 79 --check tests/
35-
$(ENV_PREFIX)mypy project_name/
37+
$(ENV_PREFIX)black -l 79 --check .github/templates/
38+
$(ENV_PREFIX)mypy --ignore-missing-imports project_name/
3639

3740
.PHONY: test
3841
test: lint ## Run tests and generate coverage report.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ A low dependency and really simple to start project template for Python Projects
1717
4. Read the file [CONTRIBUTING.md](CONTRIBUTING.md)
1818
5. Then clone your new project and happy coding!
1919

20+
> **NOTE**: **WAIT** until first CI run on github actions before cloning your new project.
21+
2022
### What is included on this template?
2123

24+
- 🖼️ Templates for starting multiple application types:
25+
* **Basic low dependency** Python program (default)
26+
* **Flask** with database, admin interface, restapi and authentication.
27+
* **FastAPI** with database, authentication and Swagger UI.
28+
* **Click** CLI
29+
* **Typer** CLI
30+
* more
31+
**Run `make init` to generate a new project based on a template.**
2232
- 📦 A basic [setup.py](setup.py) file to provide installation, packaging and distribution for your project.
2333
Template uses setuptools because it's the de-facto standard for Python packages, you can run `make switch-to-poetry` later if you want.
2434
- 🤖 A [Makefile](Makefile) with the most useful commands to install, test, lint, format and release your project.
@@ -32,7 +42,6 @@ A low dependency and really simple to start project template for Python Projects
3242
- 🛳️ Automatic release to [PyPI](https://pypi.org) using [twine](https://twine.readthedocs.io/en/latest/) and github actions.
3343
- 🎯 Entry points to execute your program using `python -m <project_name>` or `$ project_name` with basic CLI argument parsing.
3444
- 🔄 Continuous integration using [Github Actions](.github/workflows/) with jobs to lint, test and release your project on Linux, Mac and Windows environments.
35-
- 🖼️ An easy way to add a flask, fastapi, click or Typer application to your project with `make init`.
3645

3746
> Curious about architectural decisions on this template? read [ABOUT_THIS_TEMPLATE.md](ABOUT_THIS_TEMPLATE.md)
3847
> If you want to contribute to this template please open an [issue](https://github.com/rochacbruno/python-project-template/issues) or fork and send a PULL REQUEST.

0 commit comments

Comments
 (0)