|
7 | 7 |  |
8 | 8 |  |
9 | 9 |
|
10 | | - |
11 | | - |
12 | | -## Usage |
13 | | - - To use this template, click the green `Use this template` button and `Create new repository`. |
14 | | - - After github initially creates the new repository, please wait an extra minute for the initialization scripts to finish organizing the repo. |
15 | | - - To enable the automatic semantic version increments: in the repository go to `Settings` and `Collaborators and teams`. Click the green `Add people` button. Add `svc-aindscicomp` as an admin. Modify the file in `.github/workflows/tag_and_publish.yml` and remove the if statement in line 65. The semantic version will now be incremented every time a code is committed into the main branch. |
16 | | - - To publish to PyPI, enable semantic versioning and uncomment the publish block in `.github/workflows/tag_and_publish.yml`. The code will now be published to PyPI every time the code is committed into the main branch. |
17 | | - - The `.github/workflows/test_and_lint.yml` file will run automated tests and style checks every time a Pull Request is opened. If the checks are undesired, the `test_and_lint.yml` can be deleted. The strictness of the code coverage level, etc., can be modified by altering the configurations in the `pyproject.toml` file and the `.flake8` file. |
18 | | - |
19 | | -## Installation |
20 | | -To use the software, in the root directory, run |
21 | | -```bash |
22 | | -pip install -e . |
23 | | -``` |
24 | | - |
25 | | -To develop the code, run |
26 | | -```bash |
27 | | -pip install -e .[dev] |
28 | | -``` |
29 | | - |
30 | | -## Contributing |
31 | | - |
32 | | -### Linters and testing |
33 | | - |
34 | | -There are several libraries used to run linters, check documentation, and run tests. |
35 | | - |
36 | | -- Please test your changes using the **coverage** library, which will run the tests and log a coverage report: |
37 | | - |
38 | | -```bash |
39 | | -coverage run -m unittest discover && coverage report |
40 | | -``` |
41 | | - |
42 | | -- Use **interrogate** to check that modules, methods, etc. have been documented thoroughly: |
43 | | - |
44 | | -```bash |
45 | | -interrogate . |
46 | | -``` |
47 | | - |
48 | | -- Use **flake8** to check that code is up to standards (no unused imports, etc.): |
49 | | -```bash |
50 | | -flake8 . |
51 | | -``` |
52 | | - |
53 | | -- Use **black** to automatically format the code into PEP standards: |
54 | | -```bash |
55 | | -black . |
56 | | -``` |
57 | | - |
58 | | -- Use **isort** to automatically sort import statements: |
59 | | -```bash |
60 | | -isort . |
61 | | -``` |
62 | | - |
63 | | -### Pull requests |
64 | | - |
65 | | -For internal members, please create a branch. For external members, please fork the repository and open a pull request from the fork. We'll primarily use [Angular](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit) style for commit messages. Roughly, they should follow the pattern: |
66 | | -```text |
67 | | -<type>(<scope>): <short summary> |
68 | | -``` |
69 | | - |
70 | | -where scope (optional) describes the packages affected by the code changes and type (mandatory) is one of: |
71 | | - |
72 | | -- **build**: Changes that affect build tools or external dependencies (example scopes: pyproject.toml, setup.py) |
73 | | -- **ci**: Changes to our CI configuration files and scripts (examples: .github/workflows/ci.yml) |
74 | | -- **docs**: Documentation only changes |
75 | | -- **feat**: A new feature |
76 | | -- **fix**: A bugfix |
77 | | -- **perf**: A code change that improves performance |
78 | | -- **refactor**: A code change that neither fixes a bug nor adds a feature |
79 | | -- **test**: Adding missing tests or correcting existing tests |
80 | | - |
81 | | -### Semantic Release |
82 | | - |
83 | | -The table below, from [semantic release](https://github.com/semantic-release/semantic-release), shows which commit message gets you which release type when `semantic-release` runs (using the default configuration): |
84 | | - |
85 | | -| Commit message | Release type | |
86 | | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | |
87 | | -| `fix(pencil): stop graphite breaking when too much pressure applied` | ~~Patch~~ Fix Release, Default release | |
88 | | -| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release | |
89 | | -| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release <br /> (Note that the `BREAKING CHANGE: ` token must be in the footer of the commit) | |
90 | | - |
91 | | -### Documentation |
92 | | -To generate the rst files source files for documentation, run |
93 | | -```bash |
94 | | -sphinx-apidoc -o docs/source/ src |
95 | | -``` |
96 | | -Then to create the documentation HTML files, run |
97 | | -```bash |
98 | | -sphinx-build -b html docs/source/ docs/build/html |
99 | | -``` |
100 | | -More info on sphinx installation can be found [here](https://www.sphinx-doc.org/en/master/usage/installation.html). |
101 | | - |
102 | | -### Read the Docs Deployment |
103 | | -Note: Private repositories require **Read the Docs for Business** account. The following instructions are for a public repo. |
104 | | - |
105 | | -The following are required to import and build documentations on *Read the Docs*: |
106 | | -- A *Read the Docs* user account connected to Github. See [here](https://docs.readthedocs.com/platform/stable/guides/connecting-git-account.html) for more details. |
107 | | -- *Read the Docs* needs elevated permissions to perform certain operations that ensure that the workflow is as smooth as possible, like installing webhooks. If you are not the owner of the repo, you may have to request elevated permissions from the owner/admin. |
108 | | -- A **.readthedocs.yaml** file in the root directory of the repo. Here is a basic template: |
109 | | -```yaml |
110 | | -# Read the Docs configuration file |
111 | | -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details |
112 | | - |
113 | | -# Required |
114 | | -version: 2 |
115 | | - |
116 | | -# Set the OS, Python version, and other tools you might need |
117 | | -build: |
118 | | - os: ubuntu-24.04 |
119 | | - tools: |
120 | | - python: "3.13" |
121 | | - |
122 | | -# Path to a Sphinx configuration file. |
123 | | -sphinx: |
124 | | - configuration: docs/source/conf.py |
125 | | - |
126 | | -# Declare the Python requirements required to build your documentation |
127 | | -python: |
128 | | - install: |
129 | | - - method: pip |
130 | | - path: . |
131 | | - extra_requirements: |
132 | | - - dev |
133 | | -``` |
134 | | -
|
135 | | -Here are the steps for building docs in *Read the Docs*. See [here](https://docs.readthedocs.com/platform/stable/intro/add-project.html) for detailed instructions: |
136 | | -- From *Read the Docs* dashboard, click on **Add project**. |
137 | | -- For automatic configuration, select **Configure automatically** and type the name of the repo. A repo with public visibility should appear as you type. |
138 | | -- Follow the subsequent steps. |
139 | | -- For manual configuration, select **Configure manually** and follow the subsequent steps |
140 | | -
|
141 | | -Once a project is created successfully, you will be able to configure/modify the project's settings; such as **Default version**, **Default branch** etc. |
0 commit comments