Debian Codegraph @

doc/developer.rst

raw
1 =================
2 Developer's guide
3 =================
4
5 Code organization
6 =================
7
8 The top level directory is organized in the following
9 directories:
10
11 :file:`pysam`
12 Code specific to pysam.
13
14 :file:`doc`
15 The documentation. To build the latest documentation, first install
16 `Sphinx`_ and then type::
17
18 make -C doc html
19
20 :file:`tests`
21 Code and data for testing and benchmarking.
22
23 :file:`htslib`
24 Source code from `htslib`_ shipped with pysam. See
25 :file:`import.py` about importing.
26
27 :file:`samtools`
28 Source code from `samtools`_ shipped with pysam. See
29 :file:`import.py` about importing.
30
31 :file:`bcftools`
32 Source code from `bcftools`_ shipped with pysam. See
33 :file:`import.py` about importing.
34
35
36 Python language level
37 =====================
38
39 Pysam currently requires Python 3.6 as a minimum language level.
40 For example, this means that the following comparatively recent
41 language features and library functions are available for use:
42
43 * f-strings
44 * ``raise ... from None``
45 * :meth:`str.startswith`, :meth:`str.endswith`, :meth:`str.rstrip`, etc
46
47 However in particular the the following should not be used in
48 pysam source code or infrastructure scripts:
49
50 * :meth:`str.removeprefix`, :meth:`str.removesuffix` (new in 3.9)
51 * walrus ``:=`` operator (new in 3.8)
52
53
54 Importing new versions of htslib and samtools
55 =============================================
56
57 See instructions in :file:`import.py` to import the latest
58 versions of `htslib`_, `samtools`_ and `bcftools`_.
59
60 Unit testing
61 ============
62
63 Unit tests are in the :file:`tests` directory. To run all unit tests,
64 run::
65
66 pytest tests
67
68 Most tests use test data from the :file:`tests/*_data` directories.
69 Some of these test data files are generated from other files in these
70 directories, which is done by running ``make`` in each directory::
71
72 make -C tests/pysam_data
73 # etc
74
75 Alternatively if any :file:`tests/*_data/all.stamp` file is not already
76 present, running the unit tests should generate that directory's data
77 files automatically.
78
79 Benchmarking
80 ============
81
82 To run the benchmarking suite, make sure that `pytest-benchmark
83 <https://github.com/ionelmc/pytest-benchmark>`_ is installed. To run
84 all benchmarks, type::
85
86 pytest tests/*_bench.py
87
88 See :ref:`Benchmarking` for more on this topic.
89
90 Contributors
91 ============
92
93 Please see Github for a list of all contributors:
94
95 https://github.com/pysam-developers/pysam/graphs/contributors
96
97 Many thanks to all contributors for helping in making pysam
98 useful.