Hatch docs

main
Jeff Moe 2023-10-04 14:36:48 -06:00
parent f559986512
commit 89b1f44907
1 changed files with 88 additions and 10 deletions

View File

@ -236,7 +236,7 @@ black --preview tasteful-python*
Use pipx to install hatch dependencies so the hatch
dependency versions don't conflict with the project's
dependencies. Perhaps this should be done for all the
development dependenices like black, flake8 (?).
development dependencies like black, flake8 (?).
Don't run this as root or in a virtual environment,
just as regular user:
@ -248,6 +248,9 @@ pipx install hatch
pipx ensurepath
# perhaps logout / login or new terminal
eval "$(register-python-argcomplete pipx)"
# perhaps
_HATCH_COMPLETE=bash_source hatch > ~/.hatch-complete.bash
. ~/.hatch-complete.bash
```
@ -276,10 +279,11 @@ The TOML file format is documented here:
* https://toml.io/en/v1.0.0
#### Hatch Create
Create new project:
```
hatch new "foo"
hatch new --cli foo
```
For a pre-existing project, it can be set up for hatch thusly:
@ -292,17 +296,90 @@ hatch new --init
Using `--init` on a pre-existing project won't create the
directory structure, it just changes `pyproject.toml`.
Create files and directories, such as:
#### Hatch Shell
After new hatch creation, enter the shell:
```
cd foo/
mkdir -p src/foo
touch src/foo/__about__.py
touch src/foo/__init__.py
mkdir -p tests
touch tests/__init__.py
touch LICENSE.txt
touch README.md
hatch shell
```
#### Hatch Version
Various hatch versioning commands:
```
# print version 0.0.1
hatch version
# increment major version 1.0.0
hatch version major
# increment minor version 1.1.0
hatch version minor
# increment patch version 1.1.1
hatch version patch
# increment rc version 1.1.1rc0
hatch version rc
```
#### Hatch Configuration
Default config file:
```
hatch config find
```
File gets put in `~/.config/hatch/config.toml`.
#### Hatch Add Dependency
```
hatch run pip list
${EDITOR} pyproject.toml
```
Add dependency to `dependencies` section.
Then to Sync dependencies, re-run:
```
hatch run pip list
```
See also:
```
hatch dep show table
hatch dep show requirements
```
#### Hatch Testing
```
hatch run test
hatch run cov
```
#### Hatch Build
Build such as:
```
hatch build
hatch build --clean
```
#### Hatch Publish
Upload to PyPI:
```
hatch publish
```
#### Hatch Misc
```
hatch run which python3
hatch env
hatch config
hatch project metadata
hatch status
```
@ -340,6 +417,7 @@ Such as:
* Push to PyPI test server.
* Also re-build on ppc64le.
* Linter, such as flake8 and bugbear.
* mypyc.
# Upstream