Skip to content

Commit bf240bd

Browse files
committed
Add command line reference guide
1 parent 6a58271 commit bf240bd

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ by the community now! Join our community review process or watch development of
9797
:::
9898
::::
9999

100+
::::{grid-item}
101+
:::{card} ✿ Reference Guides ✿
102+
:class-card: left-aligned
103+
104+
* [Command Line Reference Guide](/tutorials/command-line-reference)
105+
106+
:::
107+
::::
108+
100109
:::::
101110

102111

tutorials/command-line-reference.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
:::

tutorials/intro.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ Add a license & code of conduct <add-license-coc>
5050
Update metadata in pyproject.toml <pyproject-toml>
5151
:::
5252

53+
:::{toctree}
54+
:hidden:
55+
:caption: Reference Guides
56+
57+
Command Line Reference Guide <command-line-reference>
58+
:::
59+
5360
:::{admonition} Learning Objectives
5461

5562
This lesson introduces you to the basic components of a Python package.

0 commit comments

Comments
 (0)