Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
curskey committed Oct 21, 2023
0 parents commit 19bd4c8
Show file tree
Hide file tree
Showing 24 changed files with 828 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4
max_line_length = 100

[*.{yml,yaml,json,js,css,html}]
indent_size = 2
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish 🐍 📦 to PyPI and TestPyPI

on:
release:
types: [published]

pull_request:
branches:
- main

permissions:
contents: read

jobs:
publish:
name: Publish 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install build dependencies
run: |
python -m pip install -U pip
pip install flit
- name: Publish 📦 to PyPI
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
flit publish
if: ${{ github.event_name == 'release' }}

- name: Publish 📦 to Test PyPI
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
flit publish --repository testpypi
if: ${{ github.event_name == 'pull_request' }}
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests with Pytest

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flit
flit install --deps all
- name: Test with pytest
run: |
pytest -v
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
build/
dist/
*.egg
*.egg-info/
MANIFEST

# Test / coverage reports
htmlcov/
.pytest_cache/
.coverage
.coverage.*
*,cover
.cache

# Flask stuff:
instance/
.webassets-cache

# Environments
.env
env/
.env/
venv/
.venv/

# PyCharm
.idea/
.fleet

# VS Code
.vscode

# Vim, Emacs
*.swp
*~

docs/build
.mypy_cache/
.ruff_cache/
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
default_language_version:
python: python3.10

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v3.11.1
hooks:
- id: pyupgrade
args: ["--py310-plus"]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
args: ['--config=./pyproject.toml']

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.286
hooks:
- id: ruff
args: ['--config=./pyproject.toml']

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
args: ['--config-file=./pyproject.toml']
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.10"

python:
install:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Change Log
==========

Version 0.1
-----------

Released 2023-10-21

- First public preview release.
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BSD 3-Clause License

Copyright (c) 2023, curskey

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 changes: 61 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Flask-Blueprints-Loader
=======================

Flask-Blueprints-Loader is an extension for `Flask`_ that automatically discovers and registers `Blueprint`_ for your application.

.. _Flask: https://flask.palletsprojects.com/
.. _Blueprint: https://flask.palletsprojects.com/en/3.0.x/blueprints/

Installing
----------

Install using `pip`_:

.. code-block:: sh
$ pip install -U flask-blueprints-loader
.. _pip: https://pip.pypa.io/en/stable/

Initialize the Extension
------------------------

Application Instance Pattern

.. code-block:: py3
from flask import Flask
from flask_blueprints_loader import BlueprintsLoader
app = Flask(__name__)
loader = BlueprintsLoader(app)
with app.app_context():
loader.register_blueprints()
Application Factories Pattern

.. code-block:: py3
from flask import Flask
from flask_blueprints_loader import BlueprintsLoader
loader = BlueprintsLoader()
def create_app():
app = Flask(__name__)
loader.init_app(app)
with app.app_context():
loader.register_blueprints()
return app
Links
-----

- Documentation: https://flask-blueprints-loader.readthedocs.io/en/latest/
- PyPI Releases: https://pypi.org/project/flask-blueprints-loader/
- Source Code: https://github.com/curskey/flask-blueprints-loader/
- Issue Tracker: https://github.com/curskey/flask-blueprints-loader/issues/
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Pallets-Sphinx-Themes==2.1.1
sphinx==7.2.6
sphinx_issues==3.0.1
-e .
5 changes: 5 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
API Reference
-------------

.. autoclass:: flask_blueprints_loader.blueprints_loader.BlueprintsLoader
:members:
1 change: 1 addition & 0 deletions docs/source/changes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../../CHANGES.rst
Loading

0 comments on commit 19bd4c8

Please sign in to comment.