|
| 1 | +# Command Line Reference Guide |
| 2 | + |
| 3 | +```{important} |
| 4 | +**What these tables are:** These tables summarize the command line inputs (e.g., `pipx install hatch`, `hatch build`) necessary to complete all steps in the package creation process, from installing Hatch to publishing the package on PyPI and conda-forge. |
| 5 | +
|
| 6 | +**What these tables are not:** These tables do not cover the manual/non-automated steps (e.g., update `pyproject.toml` file, create PyPI account, create PyPI API token) you have to complete throughout the package creation process. |
| 7 | +``` |
| 8 | + |
| 9 | +## Environment Setup |
| 10 | + |
| 11 | +:::{table} |
| 12 | +:widths: auto |
| 13 | +:align: center |
| 14 | + |
| 15 | +| Description | Syntax | |
| 16 | +|---|---| |
| 17 | +| Set PowerShell execution policy | `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` | |
| 18 | +| Install Scoop | `Invoke-RestMethod -Uri https://get.scoop.sh \| Invoke-Expression` | |
| 19 | +| Add "main" bucket as download source | `scoop bucket add main` | |
| 20 | +| Add "versions" bucket as download source | `scoop bucket add versions` | |
| 21 | +| Install pipx | `scoop install pipx`or `scoop install main/pipx` | |
| 22 | +| Install python | `scoop install python` or `scoop install main/python` | |
| 23 | +| Install specific python version | `scoop install versions/python311` | |
| 24 | +| Update PATH variable with pipx directory | `pipx ensurepath` | |
| 25 | +| Install hatch | `pipx install hatch` | |
| 26 | +| List hatch commands | `hatch -h` | |
| 27 | +| Open location of hatch config file | `hatch config explore` | |
| 28 | +| Print contents of hatch config file | `hatch config show` | |
| 29 | +| Install grayskull | `pipx install grayskull` | |
| 30 | + |
| 31 | +::: |
| 32 | + |
| 33 | +## Package Development |
| 34 | + |
| 35 | +:::{table} |
| 36 | +:widths: auto |
| 37 | +:align: center |
| 38 | + |
| 39 | +| Description | Syntax | |
| 40 | +|---|---| |
| 41 | +| Create package structure and baseline contents | `hatch new [PACKAGE_NAME]` | |
| 42 | +| Install package locally in editable mode | `python -m pip install -e .` | |
| 43 | +| List packages installed in current environment | `pip list` | |
| 44 | +| Install package from GitHub | `pip install git+https://github.com/user/repo.git@branch_or_tag` | |
| 45 | +| Create development environment | `hatch env create` | |
| 46 | +| Activate development environment | `hatch shell` | |
| 47 | +| Exit development environment | `exit` | |
| 48 | + |
| 49 | +::: |
| 50 | + |
| 51 | +## Package Publishing |
| 52 | + |
| 53 | +:::{table} |
| 54 | +:widths: auto |
| 55 | +:align: center |
| 56 | + |
| 57 | +| Description | Syntax | |
| 58 | +|---|---| |
| 59 | +| Build package sdist and wheel distributions | `hatch build` | |
| 60 | +| Publish package to Test PyPI | `hatch publish -r test` | |
| 61 | +| Install package from Test PyPI | `pip install -i https://test.pypi.org/simple/ [PACKAGE_NAME]` | |
| 62 | +| Publish package to PyPI | `hatch publish` | |
| 63 | +| Install package from PyPI | `pip install -i https://pypi.org/simple/ [PACKAGE_NAME]` | |
| 64 | +| Create conda-forge recipe | `grayskull pypi [PACKAGE_NAME]` | |
| 65 | +| Check that package installs properly | `pip check` | |
| 66 | +| Install package from conda-forge | `conda install -c conda-forge [PACKAGE_NAME]` | |
| 67 | + |
| 68 | +::: |
| 69 | + |
| 70 | +## Miscellaneous Commands |
| 71 | + |
| 72 | +:::{table} |
| 73 | +:widths: auto |
| 74 | +:align: center |
| 75 | + |
| 76 | +| Description | Syntax | |
| 77 | +|---|---| |
| 78 | +| View environments hatch has access to | `hatch env show` | |
| 79 | +| Print path to active hatch environment | `hatch env find` | |
| 80 | +| Bump package version - major | `hatch version major` | |
| 81 | +| Bump package version - minor | `hatch version minor` | |
| 82 | +| Bump package version - patch | `hatch version patch` | |
| 83 | +| Run test scripts on multiple Python versions | `hatch run all:[SCRIPT_NAME]` | |
| 84 | + |
| 85 | +::: |
0 commit comments