Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stand-alone dev setup docs. #4326

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contribute to Documentation
# Contribute to documentation

Most of the work on the Hypha User Guide takes place on the [project’s GitHub repository](https://github.com/HyphaApp/hypha/). To get started, check out the list of [open issues](https://github.com/HyphaApp/hypha/issues) and pull requests. By contributing to the Hypha User Guide, you’re expected to follow the [Code of Conduct](./code-of-conduct.md).

Expand All @@ -19,7 +19,7 @@ This project consists of several distinct documentation types with specific purp
Provides step-by-step instructions on how to set up a local instance of Hypha.
> Write technical documentation with a new developer in mind. Create a quickstart doc wherever possible. What is the bare minimum information that a user needs to get started with the feature that you are documenting? Start there.

### User Guides
### User guides

Guides are focused on accomplishing a specific task and can assume some level of prerequisite knowledge. There may be multiple approaches to accomplishing a task, and we welcome your input.

Expand Down
80 changes: 69 additions & 11 deletions docs/getting-started/contributing/developer-tips.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hypha developer tips
# Developer tips

## Git configuration and commands

Expand All @@ -24,11 +24,71 @@ To update the feature branch on GitHub you then need to do a forced push. Instea
git push --force-with-lease
```

## Coding style and linting in pre-commit hook

Hypha's coding style is enforced by ruff, stylelint and biome.

Install pre-commit to auto-format the code before each commit:

```shell
pre-commit install
```

If you want to check all files without committing you can run:

```shell
pre-commit run --all-files
```

The pre-commit hook also updates the requirements files for you, see next section about uv.


## Make best use of uv

For development [uv](https://docs.astral.sh/uv/) is a Hypha requirement. It is fast and easy to use.

uv is used to:

* Setup the virtual environment
* Install python dependencies.
* Add and remove python packages.
* Update python packages.
* Generate the requirements files.

See also [Stand alone development setup](/setup/deployment/development/stand-alone/)

### Add and remove packages with uv

All python requirements are listed in `pyproject.toml`.

To add a package:

```shell
uv add django-htmx
```

To remove a package:

```shell
uv remove django-select2
```

After adding or removing a packages run this to update `uv.lock`.

```shell
uv sync
```

When you attempt to commit the pre-commit hook will update the requirements files for you.

The requirements files exist so you do not need uv for deployment.


## Postgres snapshots/restore

Hypha dev requirements contain the [dslr](https://github.com/mixxorz/DSLR) tool. Use this for fast snapshots and restores of the postgres database.

Perfekt when testing migrations and other times when you need to reset the database or switch between databases.
Perfect when testing migrations and other times when you need to reset the database or switch between databases.

Take a snapshot, you can have as many as you like.

Expand Down Expand Up @@ -56,23 +116,21 @@ dslr list

## Commands in Makefile

This is the one stop place to find commands for runiing test, build resources and docs, linting and code style checks/fixes.

## Coding style and linting in pre-commit hook

Hypha's coding style is enforced by ruff and prettier and comes pre-configured with prettier.
This is the one stop place to find commands for running test, build resources and docs, linting and code style checks/fixes.

Install pre-commit to auto-format the code before each commit:
The one command you will be running the most is:

```shell
pre-commit install
make serve
```

This command runs `npm watch` to keep the front end updates and runs development servers for both Hypha app and the Hypha docs.

## Editor extensions

If you editor does not a Language Server Protocol (LSP) preinstalled make sure to add the plugin for it. Then add "LSP-ruff" for a fast Python linter and code transformation tool.
If you editor does not have a Language Server Protocol (LSP) preinstalled make sure to add the plugin for it. Then add "LSP-ruff" for a fast Python linter and code transformation tool.

Your editor most likely have plugins for the other languages Hypha uses as well, css/scss, yaml and html. We recoment to install them as well.
Your editor most likely have plugins for the other languages Hypha uses as well, css/scss, yaml and html. We recommend to install them as well.

## Shell configuration

Expand Down
8 changes: 4 additions & 4 deletions docs/setup/administrators/cron-jobs.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Possible Cron Commands
# Possible cron commands

Hypha comes stock with management commands that can be utilized in tandem with a job scheduler to automate specific tasks

## Account Cleanup
## Account cleanup

Accounts that haven't been logged into in 5 months can be marked as inactive with the following command:

```shell
python3 manage.py accounts_cleanup
```

## Drafts Cleanup
## Drafts cleanup

Drafts that haven't been modified in a specified time (in days) can be deleted with the following command:

Expand All @@ -26,4 +26,4 @@ Example: to delete all drafts that haven't been modified in a year without a con

```shell
python3 manage.py drafts_cleanup 365 --noinput
```
```
Loading
Loading