Skip to content

Commit 282207b

Browse files
Move Documentation from reST to Markdown (#114)
1 parent 1d4e99b commit 282207b

33 files changed

Lines changed: 747 additions & 789 deletions

docs/source/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
"sphinxcontrib_django",
4444
]
4545

46+
myst_enable_extensions = [
47+
"amsmath",
48+
"colon_fence",
49+
"dollarmath",
50+
"html_admonition",
51+
"linkify",
52+
]
53+
4654
add_function_parentheses = False
4755

4856
# Automatically generate stub pages when using the .. autosummary directive
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
##############
2-
Contacting Tin
3-
##############
1+
# Contacting Tin
42

53
If you need to get in touch with the Tin team, you can email us at tin@tjhsst.edu
64

docs/source/contributing.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Contributing
2+
3+
```{note}
4+
Tin is a django project. As such, some knowledge of
5+
python and django is recommended to contribute anything
6+
more than a trivial patch.
7+
```
8+
9+
Thank you for your interest in contributing to Tin!
10+
We accept contributions in various areas, some of which are
11+
detailed below:
12+
13+
- Code Maintenance
14+
- New Features
15+
- Writing Tests
16+
- Website and Graphical Design
17+
18+
Contributing to projects can often be a little confusing,
19+
so here are some guides to help you get started with whatever
20+
you're interested in contributing!
21+
22+
```{toctree}
23+
:maxdepth: 2
24+
25+
contributing/setup
26+
contributing/docs
27+
contributing/tests
28+
contributing/conventions
29+
```

docs/source/contributing.rst

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,47 @@
1-
###########
2-
Conventions
3-
###########
4-
5-
Pre-Commit
6-
----------
7-
Tin uses ``pre-commit`` to ensure similarly formatted code
8-
across the codebase. Once you have installed pre-commit (see :ref:`dev-setup`),
9-
run
1+
# Conventions
2+
3+
## Pre-Commit
104

11-
.. code-block:: bash
5+
Tin uses `pre-commit` to ensure similarly formatted code
6+
across the codebase. Once you have installed pre-commit (see {ref}`dev-setup`),
7+
run
128

13-
pre-commit install
9+
```bash
10+
pre-commit install
11+
```
1412

15-
To install ``pre-commit`` hooks into git. Now, every time you commit, ``pre-commit``
13+
To install `pre-commit` hooks into git. Now, every time you commit, `pre-commit`
1614
will run your code against a formatter and linter, making your contribution
1715
easier to review.
1816

19-
Commits
20-
-------
17+
## Commits
18+
19+
### Content
2120

22-
Content
23-
~~~~~~~
2421
Tin doesn't follow a specific naming convention for commits; however,
2522
if your commits are named well and are easy to review individually,
2623
you are likely to receive a response faster. For example, a PR with commits like
2724

28-
* Add CI + Config for Javascript Formatter
29-
* Autoformatted Javascript code
25+
- Add CI + Config for Javascript Formatter
26+
- Autoformatted Javascript code
3027

3128
Will likely be reviewed faster than a PR with a single commit like
3229

33-
* Add Javascript Formatter and format code
30+
- Add Javascript Formatter and format code
31+
32+
### Syncing with master
3433

35-
Syncing with master
36-
~~~~~~~~~~~~~~~~~~~
3734
At some point in your PR, it's likely your branch and the master branch will diverge,
3835
and at this point you'll have to either merge master into your branch, or rebase your changes
3936
on top of master. *Tin prefers that you rebase*, in order to preserve linear history.
4037

4138
As a quick review on how to rebase with upstream, you can do
4239

43-
.. code-block:: bash
40+
```bash
41+
git pull --rebase https://github.com/tjcsl/tin master
42+
```
4443

45-
git pull --rebase https://github.com/tjcsl/tin master
44+
### Signing Commits
4645

47-
Signing Commits
48-
~~~~~~~~~~~~~~~
4946
This is not strictly a requirement, but it's highly recommended to sign commits.
5047
It's a good developer habit, and makes it a little nicer to review your changes.

docs/source/contributing/docs.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Docs
2+
3+
Tin uses [Sphinx](https://www.sphinx-doc.org/) to build its documentation.
4+
The actual content is written in reStructuredText (`.rst`) format, and can
5+
be found in the `docs/source` folder at the [Tin Github](https://github.com/tjcsl/tin).
6+
7+
## Building Docs
8+
9+
First, you must have a local copy of Tin on your computer (see {ref}`dev-setup`).
10+
After that, `cd` into the `docs` folder.
11+
12+
Next, run the following commands based on your operating system
13+
14+
```bash
15+
make.bat html # Windows
16+
make html # *nix
17+
```
18+
19+
The first time you build the docs, it may take some time. On future builds,
20+
the html will be cached.
21+
22+
## Writing Documentation
23+
24+
Written documentation is in the Markdown format.
25+
26+
When writing a docstring for a method, attribute, or a function, we use the [Google style docstrings](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods).
27+
Do NOT include the type of a parameter in the docstring: that's redundant and harder to maintain. Instead,
28+
prefer typehinting the actual typehint in the function, and sphinx will automatically parse that.
29+
30+
For example,
31+
32+
```python
33+
# BAD
34+
def my_function(x):
35+
"""
36+
A BAD docstring for my_function
37+
38+
Args:
39+
x (int): the first parameter
40+
"""
41+
return x+1
42+
43+
# GOOD! Note how the parameter has the typehint, not the docstring
44+
def my_function(x: int):
45+
"""
46+
A good docstring for my_function
47+
48+
Args:
49+
x : the first parameter
50+
"""
51+
return x+1
52+
```
53+
54+
## Tips and Tricks
55+
56+
Sometimes Sphinx will do some weird stuff and things will stop working nicely.
57+
In this case, a simple `make cleanall` (or `make.bat cleanall` for Windows) should do the trick.
58+
59+
```{warning}
60+
`make.bat cleanall` is \_untested\_ on Windows, be careful when using it. You can alternatively
61+
use `make.bat clean` and remove the contents of `docs/source/reference`.
62+
```

docs/source/contributing/docs.rst

Lines changed: 0 additions & 70 deletions
This file was deleted.

docs/source/contributing/setup.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
(dev-setup)=
2+
3+
# Setting up a development environment
4+
5+
To begin with, you will need to have [git](https://git-scm.com/) installed on your computer.
6+
You will also need a GitHub account.
7+
8+
First, [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo#forking-a-repository)
9+
tin. Then you can clone tin onto your computer with
10+
11+
```bash
12+
git clone https://github.com/YOUR_GITHUB_USERNAME/tin
13+
```
14+
15+
From here, you can either use a local setup, or use Docker. Check out the
16+
relevant sections.
17+
18+
## Docker
19+
20+
If you prefer, you can run the development setup with [Docker](https://www.docker.com/). To do so,
21+
`cd` into the project directory and run:
22+
23+
```
24+
docker compose build
25+
docker compose up
26+
```
27+
28+
To create testing users and apply migrations, run the below command in a separate terminal:
29+
30+
```
31+
./scripts/docker_setup.sh
32+
```
33+
34+
## Local Setup
35+
36+
To set up your environment locally, you will need to install the following:
37+
38+
- [python](https://www.python.org/downloads/) (3.11)
39+
- [uv](https://docs.astral.sh/uv/)
40+
41+
Then, run these commands:
42+
43+
```
44+
uv run manage.py migrate
45+
uv run manage.py create_debug_users
46+
```
47+
48+
Now you're all set! Try running the development server
49+
50+
```bash
51+
uv run manage.py runserver
52+
```
53+
54+
Head on over to [http://127.0.0.1:8000](http://127.0.0.1:8000), and login
55+
as `admin` and the password you just entered.
56+
57+
In order to actually submit code, there are some more steps. First,
58+
you'll need to install [redis](https://redis.io/download).
59+
60+
You'll also need to start the celery worker. This can be done
61+
by running the following command in a separate terminal:
62+
63+
```
64+
uv run celery -A tin worker --loglevel=info
65+
```
66+
67+
## Final Steps
68+
69+
After that, you'll want to create a course and an assignment in the course.
70+
After saving the assignment, you can hit "Upload grader" to add a grader -
71+
the simplest example of a grader is located in `scripts/sample_grader.py`.
72+
73+
Now you can try making a submission, and as long as your submission doesn't throw an error you
74+
should get a 100%! Congrats on your brand new 5.0 GPA!

0 commit comments

Comments
 (0)