Skip to content

Commit 924c2f0

Browse files
committed
remove prompts from bash commands for copyability; closes #3430
1 parent 2a02e7f commit 924c2f0

4 files changed

Lines changed: 52 additions & 52 deletions

File tree

docs/development.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ is required for building the C API documentation.
8989
On Debian/Ubuntu we can install these with:
9090

9191
```bash
92-
$ sudo apt install build-essential doxygen
92+
sudo apt install build-essential doxygen
9393
```
9494

9595
All Python development is managed using [uv](https://docs.astral.sh/uv/).
@@ -108,7 +108,7 @@ in ``python/pyproject.toml`` and managed with [uv](https://docs.astral.sh/uv/).
108108
Install all development dependencies by running, from the `python/` directory:
109109

110110
```bash
111-
$ uv sync
111+
uv sync
112112
```
113113

114114
The lock file lives at `python/uv.lock` and must be kept up to date. Run
@@ -127,12 +127,12 @@ To get a local git development environment, please follow these steps:
127127
- Make a fork of the tskit repo on [GitHub](http://github.com/tskit-dev/tskit)
128128
- Clone your fork into a local directory:
129129
```bash
130-
$ git clone git@github.com:YOUR_GITHUB_USERNAME/tskit.git
130+
git clone git@github.com:YOUR_GITHUB_USERNAME/tskit.git
131131
```
132132
- Install the {ref}`sec_development_workflow_prek` pre-commit hook
133133
(again from the ``python/`` subdirectory):
134134
```bash
135-
$ uv run prek install
135+
uv run prek install
136136
```
137137

138138
See the {ref}`sec_development_workflow_git` section for detailed information
@@ -168,14 +168,14 @@ skip to {ref}`sec_development_workflow_anothers_commit`.
168168
[upstream remote](
169169
https://help.github.com/articles/configuring-a-remote-for-a-fork/):
170170
```bash
171-
$ git remote add upstream https://github.com/tskit-dev/tskit.git
171+
git remote add upstream https://github.com/tskit-dev/tskit.git
172172
```
173173

174174
3. Create a "topic branch" to work on. One reliable way to do it
175175
is to follow this recipe:
176176
```bash
177-
$ git fetch upstream
178-
$ git checkout -b topic_branch_name upstream/main
177+
git fetch upstream
178+
git checkout -b topic_branch_name upstream/main
179179
```
180180

181181
4. Write your code following the outline in {ref}`sec_development_best_practices`.
@@ -235,7 +235,7 @@ Then, continuing from above:
235235
3. Fetch the pull request, and store it as a local branch.
236236
For instance, to name the local branch `my_pr_copy`:
237237
```bash
238-
$ git fetch upstream pull/854/head:my_pr_copy
238+
git fetch upstream pull/854/head:my_pr_copy
239239
```
240240
You should probably call the branch something more descriptive,
241241
though. (Also note that you might need to put `origin` instead
@@ -244,7 +244,7 @@ Then, continuing from above:
244244

245245
4. Check out the pull request's local branch:
246246
```bash
247-
$ git checkout my_pr_copy
247+
git checkout my_pr_copy
248248
```
249249

250250
Now, your repository will be in exactly the same state as
@@ -267,7 +267,7 @@ or running `uv run pytest` from this subdirectory.)
267267
After you're done, you should do:
268268

269269
```bash
270-
$ git checkout main
270+
git checkout main
271271
```
272272

273273
to get your repository back to the "main" branch of development.
@@ -289,7 +289,7 @@ and other common problems.
289289
To run checks manually without committing, from the `python/` subdirectory:
290290

291291
```bash
292-
$ uv run prek --all-files
292+
uv run prek --all-files
293293
```
294294

295295
If local results differ from CI, run `uv run prek cache clean` to clear the cache.
@@ -526,20 +526,20 @@ The tests are defined in the `tests` directory, and run using
526526
If you want to run the tests in a particular module (say, `test_tables.py`), use:
527527

528528
```bash
529-
$ uv run pytest tests/test_tables.py
529+
uv run pytest tests/test_tables.py
530530
```
531531

532532
To run all the tests in a particular class in this module (say, `TestNodeTable`)
533533
use:
534534

535535
```bash
536-
$ uv run pytest tests/test_tables.py::TestNodeTable
536+
uv run pytest tests/test_tables.py::TestNodeTable
537537
```
538538

539539
To run a specific test case in this class (say, `test_copy`) use:
540540

541541
```bash
542-
$ uv run pytest tests/test_tables.py::TestNodeTable::test_copy
542+
uv run pytest tests/test_tables.py::TestNodeTable::test_copy
543543
```
544544

545545
In general, you can copy-paste the string describing a failed test from the
@@ -550,7 +550,7 @@ You can also run tests with a keyword expression search. For example this will
550550
run all tests that have `TestNodeTable` but not `copy` in their name:
551551

552552
```bash
553-
$ uv run pytest -k "TestNodeTable and not copy"
553+
uv run pytest -k "TestNodeTable and not copy"
554554
```
555555

556556
When developing your own tests, it is much quicker to run the specific tests
@@ -560,41 +560,41 @@ suite each time.
560560
To run all of the tests, we can use:
561561

562562
```bash
563-
$ uv run pytest
563+
uv run pytest
564564
```
565565

566566
By default the tests are run on 4 cores, if you have more you can specify:
567567

568568
```bash
569-
$ uv run pytest -n8
569+
uv run pytest -n8
570570
```
571571

572572
A few of the tests take most of the time, we can skip the slow tests to get the test run
573573
under 20 seconds on an modern workstation:
574574

575575
```bash
576-
$ uv run pytest --skip-slow
576+
uv run pytest --skip-slow
577577
```
578578

579579
If you have an agent running the tests in a sandboxed environment, you may need to
580580
skip tests thsat require network access or FIFOs:
581581

582582
```bash
583-
$ uv run pytest --skip-network
583+
uv run pytest --skip-network
584584
```
585585

586586
If you have a lot of failing tests it can be useful to have a shorter summary
587587
of the failing lines:
588588

589589
```bash
590-
$ uv run pytest --tb=line
590+
uv run pytest --tb=line
591591
```
592592

593593
If you need to see the output of tests (e.g. `print` statements) then you need to use
594594
these flags to run a single thread and capture output:
595595

596596
```bash
597-
$ uv run pytest -n0 -vs
597+
uv run pytest -n0 -vs
598598
```
599599

600600
All new code must have high test coverage, which will be checked as part of the
@@ -644,7 +644,7 @@ However, if you really need to be on the bleeding edge, you can use
644644
the following command to install:
645645

646646
```bash
647-
$ python3 -m pip install git+https://github.com/tskit-dev/tskit.git#subdirectory=python
647+
python3 -m pip install git+https://github.com/tskit-dev/tskit.git#subdirectory=python
648648
```
649649

650650
(Because the Python package is not defined in the project root directory, using pip to
@@ -689,13 +689,13 @@ to automatically format code.
689689
On Debian/Ubuntu, install the system dependencies with:
690690

691691
```bash
692-
$ sudo apt install libcunit1-dev ninja-build
692+
sudo apt install libcunit1-dev ninja-build
693693
```
694694

695695
Install meson using uv:
696696

697697
```bash
698-
$ uv tool install meson
698+
uv tool install meson
699699
```
700700

701701
An exact version of clang-format is required because formatting rules
@@ -718,7 +718,7 @@ with a custom configuration. This is checked as part of the
718718
{ref}`prek checks <sec_development_workflow_prek>`. To manually format all files run:
719719

720720
```bash
721-
$ uv run prek --all-files
721+
uv run prek --all-files
722722
```
723723

724724
If you are doing this in the ``c`` directory, use
@@ -730,7 +730,7 @@ prek searching for configuration within subdirectories. To avoid this, tell
730730
prek where to find its config explicitly:
731731

732732
```bash
733-
$ uv run prek --all-files -c prek.toml
733+
uv run prek --all-files -c prek.toml
734734
```
735735

736736

@@ -743,8 +743,8 @@ is defined in `meson.build`. To set up the initial build
743743
directory, run
744744

745745
```bash
746-
$ cd c
747-
$ meson setup build
746+
cd c
747+
meson setup build
748748
```
749749

750750
To setup a debug build add `--buildtype=debug` to the above command. This will set the `TSK_TRACE_ERRORS`
@@ -753,15 +753,15 @@ flag, which will print error messages to `stderr` when errors occur which is use
753753
To compile the code run
754754

755755
```bash
756-
$ ninja -C build
756+
ninja -C build
757757
```
758758

759759
All the tests and other artefacts are in the build directory. Individual test
760760
suites can be run, via (e.g.) `./build/test_trees`. To run all of the tests,
761761
run
762762

763763
```bash
764-
$ ninja -C build test
764+
ninja -C build test
765765
```
766766

767767
For vim users, the [mesonic](https://www.vim.org/scripts/script.php?script_id=5378) plugin
@@ -792,14 +792,14 @@ To just run a specific test on its own, provide
792792
this test name as a command line argument, e.g.:
793793

794794
```bash
795-
$ ./build/test_tables test_node_table
795+
./build/test_tables test_node_table
796796
```
797797

798798
After making sure tests pass, you should next run the tests through valgrind,
799799
to check for memory leaks, for instance:
800800

801801
```bash
802-
$ valgrind ./build/test_tables test_node_table
802+
valgrind ./build/test_tables test_node_table
803803
```
804804

805805
While 100% test coverage is not feasible for C code, we aim to cover all code
@@ -814,31 +814,31 @@ To generate and view coverage reports for the C tests locally:
814814

815815
Compile with coverage enabled:
816816
```bash
817-
$ cd c
818-
$ meson build -D b_coverage=true
819-
$ ninja -C build
817+
cd c
818+
meson build -D b_coverage=true
819+
ninja -C build
820820
```
821821

822822
Run the tests:
823823
```bash
824-
$ ninja -C build test
824+
ninja -C build test
825825
```
826826

827827
Generate coverage data:
828828
```bash
829-
$ cd build
830-
$ find ../tskit/*.c -type f -printf "%f\n" | xargs -i gcov -pb libtskit.a.p/tskit_{}.gcno ../tskit/{}
829+
cd build
830+
find ../tskit/*.c -type f -printf "%f\n" | xargs -i gcov -pb libtskit.a.p/tskit_{}.gcno ../tskit/{}
831831
```
832832

833833
The generated `.gcov` files can then be viewed directly with `cat filename.c.gcov`.
834834
Lines prefixed with `#####` were never executed, lines with numbers show execution counts, and lines with `-` are non-executable code.
835835

836836
`lcov` can be used to create browsable HTML coverage reports:
837837
```bash
838-
$ sudo apt-get install lcov # if needed
839-
$ lcov --capture --directory build-gcc --output-file coverage.info
840-
$ genhtml coverage.info --output-directory coverage_html
841-
$ firefox coverage_html/index.html
838+
sudo apt-get install lcov # if needed
839+
lcov --capture --directory build-gcc --output-file coverage.info
840+
genhtml coverage.info --output-directory coverage_html
841+
firefox coverage_html/index.html
842842
```
843843

844844
### Coding conventions
@@ -972,28 +972,28 @@ module and how it is built from source. The module is built automatically by
972972
The simplest way to do this is to run `make` in the `python` directory:
973973

974974
```bash
975-
$ make
975+
make
976976
```
977977

978978
If `make` is not available, you can run the same command manually:
979979

980980
```bash
981-
$ uv run python setup.py build_ext --inplace
981+
uv run python setup.py build_ext --inplace
982982
```
983983

984984
It is sometimes useful to specify compiler flags when building the low
985985
level module. For example, to make a debug build you can use:
986986

987987
```bash
988-
$ CFLAGS='-Wall -O0 -g' make
988+
CFLAGS='-Wall -O0 -g' make
989989
```
990990

991991
If you need to track down a segfault etc, running some code through gdb can
992992
be very useful. For example, to run a particular test case, we can do:
993993

994994

995995
```bash
996-
$ gdb python
996+
gdb python
997997
(gdb) run -m pytest tests/test_python_c.py
998998

999999

docs/export.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If we have a tree sequence file the
4141
convenient way to convert to VCF:
4242

4343
:::{code-block} bash
44-
$ tskit vcf example.trees > example.vcf
44+
tskit vcf example.trees > example.vcf
4545
:::
4646

4747
See the {ref}`sec_export_vcf_compression` section for information
@@ -137,14 +137,14 @@ The simplest way to compress the VCF output is to use the
137137
and pipe the output to `bgzip`:
138138

139139
:::{code-block} bash
140-
$ tskit vcf example.trees | bgzip -c > example.vcf.gz
140+
tskit vcf example.trees | bgzip -c > example.vcf.gz
141141
:::
142142
A general way to convert VCF data to various formats is to pipe the text
143143
produced by ``tskit`` into ``bcftools`` using the command
144144
line interface:
145145

146146
:::{code-block} bash
147-
$ tskit vcf example.trees | bcftools view -O b > example.bcf
147+
tskit vcf example.trees | bcftools view -O b > example.bcf
148148
:::
149149

150150
If you need more control over the form of the output (or want to work

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Packages for recent version of Python are available for Linux, OSX and Windows.
4646
using:
4747

4848
```bash
49-
$ conda install -c conda-forge tskit
49+
conda install -c conda-forge tskit
5050
```
5151

5252
### Quick Start
@@ -75,7 +75,7 @@ may result in code that is (slightly) faster on your specific hardware.
7575
installations. Installation is straightforward:
7676

7777
```bash
78-
$ python3 -m pip install tskit
78+
python3 -m pip install tskit
7979
```
8080

8181
(sec_installation_development_versions)=

docs/provenance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,4 @@ should validate the output JSON against this schema.
251251
```{eval-rst}
252252
.. literalinclude:: ../python/tskit/provenance.schema.json
253253
:language: json
254-
```
254+
```

0 commit comments

Comments
 (0)