Preocts / htmx-fastapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python 3.8 | 3.9 | 3.10 | 3.11 Code style: black pre-commit

pre-commit.ci status Python tests

htmx-fastapi

Install:

python -m pip install -e .[dev,test]

Run:

uvicorn htmx_fastapi.main:app --reload

Local developer installation

It is strongly recommended to use a virtual environment (venv) when working with python projects. Leveraging a venv will ensure the installed dependency files will not impact other python projects or any system dependencies.

The following steps outline how to install this repo for local development. See the CONTRIBUTING.md file in the repo root for information on contributing to the repo.

Windows users: Depending on your python install you will use py in place of python to create the venv.

Linux/Mac users: Replace python, if needed, with the appropriate call to the desired version while creating the venv. (e.g. python3 or python3.8)

All users: Once inside an active venv all systems should allow the use of python for command line instructions. This will ensure you are using the venv's python and not the system level python.


Installation steps

Clone this repo and enter root directory of repo:

git clone https://github.com/Preocts/htmx-fastapi
cd htmx-fastapi

Create the venv:

python -m venv venv

Activate the venv:

# Linux/Mac
. venv/bin/activate

# Windows
venv\Scripts\activate

The command prompt should now have a (venv) prefix on it. python will now call the version of the interpreter used to create the venv

Install editable library and development requirements:

python -m pip install --editable .[dev,test]

Install pre-commit (see below for details):

pre-commit install

Misc Steps

Run pre-commit on all files:

pre-commit run --all-files

Run tests (quick):

pytest

Run tests:

nox

Build dist:

python -m pip install --upgrade build
python -m build

To deactivate (exit) the venv:

deactivate

Updating dependencies

New dependencys can be added to the requirements-*.in file. It is recommended to only use pins when specific versions or upgrades beyond a certain version are to be avoided. Otherwise, allow pip-compile to manage the pins in the generated requirements-*.txt files.

Once updated following the steps below, the package can be installed if needed.

To update the generated files with a dependency:

pip-compile --no-emit-index-url requirements/requirements.in
pip-compile --no-emit-index-url requirements/requirements-dev.in
pip-compile --no-emit-index-url requirements/requirements-test.in

To attempt to upgrade all generated dependencies add the --upgrade flag.


A framework for managing and maintaining multi-language pre-commit hooks.

This repo is setup with a .pre-commit-config.yaml with the expectation that any code submitted for review already passes all selected pre-commit checks. pre-commit is installed with the development requirements and runs seemlessly with git hooks.


Error: File "setup.py" not found.

If you recieve this error while installing an editible version of this project you have two choices:

  1. Update your pip to at least version 22.3.1
  2. Add the following empty setup.py to the project if upgrading pip is not an option
from setuptools import setup

setup()

About

License:Other


Languages

Language:Python 73.0%Language:HTML 22.3%Language:CSS 3.1%Language:Dockerfile 1.7%