A sandbox project is included in this repository to aid in development.
- ...everything in the compatibility section on the main README.
- Hatch
- Node.js v20
- Yarn
- Pre-commit
- Caddy (optional, but recommended for https testing)
- GNU
Clone the repository
git clone [email protected]:Stormbase/django-otp-webauthn.git
Install the Node.js dependencies
yarn install
Build the frontend
yarn start
Let Hatch install the Python dependencies and create a virtual environment for you
hatch shell
Migrate the database
python manage.py migrate
Create a superuser
python manage.py createsuperuser
Start the development server
python manage.py runserver
If using Caddy, you can run it with the included Caddyfile
. This will set up a reverse proxy with https for the development server.
caddy run
# You can now access the sandbox at https://localhost/
If this is the first time you are running Caddy, you need to install the Caddy certificate authority (CA) certificate. This is needed to trust the self-signed certificates that Caddy generates for https.
caddy trust
From here, you can login using the superuser you created. You can register a passkey by clicking the "Register a passkey" button. The "verify now" link will take you to the verification page where you can use your passkey to authenticate.
Additionally – once you've registered a passkey – your browser should prompt you to use your passkey when logging in. Completely passwordless!
The sandbox is used to test the functionality of the package. It is a Django project that uses the package as a dependency. The package is installed in the sandbox as a local package. This allows you to make changes to the package and see the effects in the sandbox.
In addition, the same sandbox is also used by the E2E browser automation tests (see tests/e2e
folder) to automate the testing of JavaScript functionality and make sure all the pieces work together.
All commands must be run from the virtual environment created by Hatch. Use hatch shell
to activate.
To run the tests, you can use the following command:
pytest
If you are interested in test coverage, run the following commands:
coverage run -m pytest
coverage report
# or, to generate a visual HTML report in the `htmlcov` directory
coverage html
This project uses pre-commit to enforce code linting and formatting. This will automatically run certain checks before you are able to create a git commit.
To install the pre-commit hooks, run the following command:
pre-commit install
The pre-commit hooks will now run automatically when you try to commit changes. If you want to run the checks manually, you can use the following command:
pre-commit run --all-files
This project's documentation uses the Sphinx Alabaster theme.
To build the documentation, follow these steps:
-
Clone the repository:
git clone [email protected]:Stormbase/django-otp-webauthn.git
-
Navigate to the docs folder:
cd docs
-
Build the documentation:
make html
-
Serve it, and watch for changes:
make run
Releasing a new version is semi-automated. The following steps should be taken:
- Make sure
all-contributors
is up to date. Runnpx all-contributors-cli check
to compare the contributors inall-contributorsrc
with the contributors in the git history.- If there are new contributors, figure out what areas they contributed in and a run
npx all-contributors-cli add <username> [code,bug]
. Refer to emoji key in the All Contributors specification for the appropriate emoji. npx all-contributors-cli generate
to update theCONTRIBUTORS.md
file.
- If there are new contributors, figure out what areas they contributed in and a run
- Ensure that the version in
pyproject.toml
is correct. If not update using,hatch version major|minor|patch
. - Ensure
CHANGELOG.md
is up to date. Fill in the new version number and date. - Commit the changes.
- (optional) create a git tag for the new version:
git tag -a v0.0.0 -m "v0.0.0"
. Replace0.0.0
with the appropriate version number. - Create a new release on GitHub. Use the tag you created in the previous step. Or allow GitHub to create the tag for you if you didn't create one.
- Creating the release will trigger a GitHub action that will publish the new version to PyPI. View the action to ensure it completes successfully.