Skip to content

Commit c088568

Browse files
authored
Improve dev onboarding and docs (#160)
* add more details around installing on virtualenv or conda environments * add instructions to run the pyscript command in dev * add section about how to create a new release * add section about how the release process works * fix mispellings (enviroment and avaible) * pin the python version when creating the dev environment * add note on how to build the package whell locally
1 parent 44b47dc commit c088568

File tree

1 file changed

+109
-3
lines changed

1 file changed

+109
-3
lines changed

CONTRIBUTING.md

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,29 @@ git clone https://github.com/pyscript/pyscript.git
1414
pip install --upgrade pip
1515
```
1616

17-
Make a virtualenv and activate it:
17+
Create a local environment with your environment manager of choice.
18+
19+
### Virtualenv
20+
21+
In case you choose Virtualenv, make a virtualenv and activate it using the following commands:
1822

1923
```shell
2024
python -m venv .venv
2125
source .venv/bin/activate
2226
```
2327

24-
Install your local enviroment dependencies
28+
### Conda
29+
30+
In case you choose to use conda, use the following commands:
31+
32+
```shell
33+
conda create -n pyscript-cli python=3.13
34+
conda activate pyscript-cli
35+
```
36+
37+
### Installation
38+
39+
Now that you have your environment set up and activated, install your local environment dependencies
2540

2641
```shell
2742
pip install -e ".[dev]"
@@ -33,12 +48,43 @@ It is now possible to normally use the CLI. For more information on how to use i
3348

3449
## Run the tests
3550

36-
After setting up your developer enviroment, you can run the tests with the following command from the root directory:
51+
After setting up your developer environment, you can run the tests with the following command from the root directory:
3752

3853
```shell
3954
pytest .
4055
```
4156

57+
# Running CLI Commands
58+
59+
Once the installation process is done, the `pyscript` CLI is available to be used once the environment has been
60+
activated. Simply run `pyscript` with the appropriate command. For instance, to see the list of commands:
61+
62+
```shell
63+
>> pyscript --help
64+
65+
Usage: pyscript [OPTIONS] COMMAND [ARGS]...
66+
67+
Command Line Interface for PyScript.
68+
69+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
70+
│ --version Show project version and exit. │
71+
│ --help Show this message and exit. │
72+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
73+
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
74+
│ create Create a new pyscript project with the passed in name, creating a new directory in the current directory. Alternatively, use `--wrap` so as to embed a │
75+
│ python file instead. │
76+
│ run Creates a local server to run the app on the path and port specified. │
77+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
78+
```
79+
80+
or, to run a pyscript app:
81+
82+
```shell
83+
>> pyscript run
84+
Serving from /pyscript-example at port 8000. To stop, press Ctrl+C.
85+
127.0.0.1 - - [30/Apr/2025 17:01:03] "GET / HTTP/1.1" 200 -
86+
```
87+
4288
## Documentation
4389

4490
### Install the documentation dependencies
@@ -77,3 +123,63 @@ e.g.:
77123
```shell
78124
make -C docs html
79125
```
126+
127+
128+
## Creating a New Release
129+
130+
To create a new release of pyscript-cli, follow these steps:
131+
132+
1. Update the version number in `src/pyscript/version`
133+
134+
2. Update CHANGELOG.md with the changes since the last release
135+
136+
3. Create a new git tag matching the version number:
137+
```shell
138+
git tag X.Y.Z
139+
```
140+
141+
4. Push the tag to GitHub:
142+
```shell
143+
git push origin X.Y.Z
144+
```
145+
146+
5. The GitHub Actions workflow will automatically:
147+
- Verify the tag matches the version in `src/pyscript/version`
148+
- Run tests
149+
- Build and publish the package to PyPI
150+
- Create a GitHub release
151+
152+
6. Verify the new version is available on PyPI: https://pypi.org/project/pyscript-cli/
153+
154+
Note: Make sure all tests pass locally before creating a new release. The release workflow will fail if there are any test failures or version mismatches.
155+
156+
Note 2: The version number in `src/pyscript/version` and the tag pushed to git (`X.Y.Z` in the example above) MUST MATCH! If they don't match the, the
157+
action to create and publish the release won't start.
158+
159+
160+
### How the Release Process Works
161+
162+
The release process is automated through GitHub Actions workflows. Here's what happens behind the scenes:
163+
164+
1. When a new tag is pushed, it triggers the release workflow
165+
2. The workflow first checks that:
166+
- The tag name matches the version in `src/pyscript/version`
167+
- All tests pass successfully
168+
169+
3. If checks pass, the workflow:
170+
- Builds the Python package using setuptools
171+
- Creates source and wheel distributions
172+
- Uploads the distributions to PyPI using twine
173+
- Creates a GitHub release with the tag name
174+
175+
4. The version check is performed by the `check_tag_version()` function in setup.py, which:
176+
- Reads the version from `src/pyscript/version`
177+
- Compares it to the git tag that triggered the workflow
178+
- Fails if they don't match exactly
179+
180+
5. The PyPI upload uses credentials stored as GitHub repository secrets
181+
182+
This automated process ensures consistent and reliable releases while preventing common issues like version mismatches or failed tests from being published.
183+
184+
NOTE: If you wanna build locally, run `CHECK_VERSION=False python -m build`. This will skip the check tag version conditions defined in `setup.py`, allowing
185+
to create the wheel locally, without having a tag with a version matching the `src/pyscript/version` file.

0 commit comments

Comments
 (0)