|
| 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., create PyPI account, create PyPI API token) you have to complete throughout the package creation process. |
| 7 | +
|
| 8 | +**Operating system note:** The current iteration of this guide has been tested on the Windows OS only. Many commands are Windows-specific. OS-specific commands are indicated with parentheses after the description of the command, e.g., [COMMAND_DESCRIPTION] (Windows). Corresponding commands for macOS and Linux will be added in the future. |
| 9 | +``` |
| 10 | + |
| 11 | +## Environment Setup |
| 12 | + |
| 13 | +:::{table} |
| 14 | +:widths: auto |
| 15 | +:align: center |
| 16 | + |
| 17 | +| Description | Syntax | |
| 18 | +|---|---| |
| 19 | +| Set PowerShell execution policy (Windows) | `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser` | |
| 20 | +| Install Scoop (Windows) | `Invoke-RestMethod -Uri https://get.scoop.sh \| Invoke-Expression` | |
| 21 | +| Add "main" bucket as download source (Windows) | `scoop bucket add main` | |
| 22 | +| Add "versions" bucket as download source (Windows) | `scoop bucket add versions` | |
| 23 | +| Install pipx (Windows) | `scoop install pipx` or `scoop install main/pipx` | |
| 24 | +| Update PATH variable with pipx directory | `pipx ensurepath` | |
| 25 | +| Install hatch | `pipx install hatch` or `pip 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` or `pip 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 | +| Install development dependencies | `python -m pip install ".[DEPENDENCY_GROUP]"` | |
| 44 | +| List packages installed in current environment | `pip list` | |
| 45 | +| Install package from GitHub | `pip install git+https://github.com/user/repo.git@branch_or_tag` | |
| 46 | +| Create development environment | `hatch env create` | |
| 47 | +| Activate development environment | `hatch shell` | |
| 48 | +| Exit development environment | `exit` | |
| 49 | + |
| 50 | +::: |
| 51 | + |
| 52 | +## Package Publishing |
| 53 | + |
| 54 | +:::{table} |
| 55 | +:widths: auto |
| 56 | +:align: center |
| 57 | + |
| 58 | +| Description | Syntax | |
| 59 | +|---|---| |
| 60 | +| Build package sdist and wheel distributions | `hatch build` | |
| 61 | +| Publish package to Test PyPI | `hatch publish -r test` | |
| 62 | +| Install package from Test PyPI | `pip install -i https://test.pypi.org/simple/ [PACKAGE_NAME]` | |
| 63 | +| Publish package to PyPI | `hatch publish` | |
| 64 | +| Install package from PyPI | `pip install -i https://pypi.org/simple/ [PACKAGE_NAME]` | |
| 65 | +| Create conda-forge recipe | `grayskull pypi [PACKAGE_NAME]` | |
| 66 | +| Check that package installs properly | `pip check` | |
| 67 | +| Install package from conda-forge | `conda install -c conda-forge [PACKAGE_NAME]` | |
| 68 | + |
| 69 | +::: |
| 70 | + |
| 71 | +## Versions and Environments |
| 72 | + |
| 73 | +:::{table} |
| 74 | +:widths: auto |
| 75 | +:align: center |
| 76 | + |
| 77 | +| Description | Syntax | |
| 78 | +|---|---| |
| 79 | +| View environments | `hatch env show` | |
| 80 | +| Print path to active hatch environment | `hatch env find` | |
| 81 | +| Bump package version - major | `hatch version major` | |
| 82 | +| Bump package version - minor | `hatch version minor` | |
| 83 | +| Bump package version - patch | `hatch version patch` | |
| 84 | +| Run test scripts on multiple Python versions | `hatch run all:[SCRIPT_NAME]` | |
| 85 | + |
| 86 | +::: |
0 commit comments