Skip to content

Commit 66a3d50

Browse files
committed
Fix: add initial tests content to guide
ENH: fixes from Jonny's review Fix: review edits from Jonny p2 Fix: typos and cleanup Fix: add example to tests ci page
1 parent 062867e commit 66a3d50

File tree

13 files changed

+760
-180
lines changed

13 files changed

+760
-180
lines changed

_static/pyos.css

Lines changed: 12 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,33 @@ html, body {
5252

5353
html, body {
5454
font-size: 1.02rem;
55+
font-family: 'Poppins', sans-serif!important;
5556
}
5657

5758
body p {
5859
}
5960

6061
.admonition {
61-
margin-top: 60px!important;
62-
margin-bottom: 70px!important;
62+
margin-top: 40px;
63+
margin-bottom: 40px;
64+
}
65+
66+
h2, h3, h4 {
67+
font-family: 'Poppins', sans-serif!important;
6368
}
6469

6570
h1 {
6671
margin-top: 10px;
6772
margin-bottom: 40px;
68-
font-family: var(--pyos-font-family-h1) !important;
69-
color: var(--pyos-h1-color);
73+
font-family: 'Itim'!important;
74+
color: #542568;
7075
}
7176
h2 {
72-
margin-top: 80px;
77+
margin-top: 60px;
7378
}
7479

7580
h3 {
76-
margin-top: 60px}
81+
margin-top: 40px}
7782

7883
figcaption .caption-text {
7984
text-align: left!important;
@@ -91,176 +96,7 @@ figcaption {
9196

9297

9398
.admonition p {
94-
font-size: .9em;
95-
}
96-
97-
/* Navbar */
98-
/*
99-
Don't fill all vertical space beneath TOC, which causes
100-
readthedocs version selector to fall off the page and the
101-
ugly scrollbar to show all the time
102-
*/
103-
.bd-sidebar-primary .sidebar-primary-items__end {
104-
margin-bottom: unset;
105-
margin-top: unset;
106-
}
107-
108-
/* Tutorial block page */
109-
.left-div {
110-
background-color: #3498db;
111-
color: #fff;
112-
text-align: center;
113-
padding: 20px;
114-
width: 35%;
115-
border-radius: 10px;
116-
}
117-
118-
.right-div {
119-
margin-top: 10px;
120-
}
121-
122-
.lesson-div {
123-
cursor: pointer;
124-
transition: background-color 0.3s;
125-
margin-bottom: 10px;
126-
padding: 10px;
127-
border-radius: 5px;
128-
text-align: center;
129-
color: #333;
130-
}
131-
132-
.lesson-div a {
133-
color: inherit;
134-
text-decoration: none;
135-
display: block;
136-
height: 100%;
137-
width: 100%;
138-
}
139-
140-
.lesson-div:hover {
141-
background-color: #ccc;
142-
}
143-
144-
/* Different colors and their shades */
145-
.lesson-div:nth-child(1) {
146-
background-color: #216A6B;
147-
color: #fff;
148-
}
149-
150-
.lesson-div:nth-child(2) {
151-
background-color: #6D597A;
152-
color: #fff;
153-
}
154-
155-
.lesson-div:nth-child(3) {
156-
background-color: #B56576;
157-
color: #fff;
158-
}
159-
160-
.lesson-div:nth-child(4) {
161-
background-color: #3A8C8E; /* Shade of #216A6B */
162-
}
163-
164-
.lesson-div:nth-child(5) {
165-
background-color: #8F7B8D; /* Shade of #6D597A */
166-
}
167-
168-
.lesson-div:nth-child(6) {
169-
background-color: #D78287; /* Shade of #B56576 */
170-
}
171-
172-
.lesson-div:nth-child(7) {
173-
background-color: #185355; /* Darker shade of #216A6B */
174-
color: #fff;
175-
}
176-
177-
178-
179-
html[data-theme=light] {
180-
--pst-color-primary: var(--pyos-color-primary);
181-
--pst-color-primary-text: #fff;
182-
--pst-color-primary-highlight: #053f49;
183-
--sd-color-primary: var(--pst-color-primary);
184-
--sd-color-primary-text: var(--pst-color-primary-text);
185-
--sd-color-primary-highlight: var(--pst-color-primary-highlight);
186-
--sd-color-primary-bg: #d0ecf1;
187-
--sd-color-primary-bg-text: #14181e;
188-
--pst-color-secondary: var(--pyos-color-secondary);
189-
--pst-color-secondary-text: #fff;
190-
--pst-color-secondary-highlight: var(--pyos-color-secondary-highlight);
191-
--sd-color-secondary: var(--pst-color-secondary);
192-
--sd-color-secondary-text: var(--pst-color-secondary-text);
193-
--sd-color-secondary-highlight: var(--pst-color-secondary-highlight);
194-
--sd-color-secondary-bg: #e0c7ff;
195-
--sd-color-secondary-bg-text: #14181e;
196-
--pst-color-success: #00843f;
197-
--pst-color-success-text: #fff;
198-
--pst-color-success-highlight: #00381a;
199-
--sd-color-success: var(--pst-color-success);
200-
--sd-color-success-text: var(--pst-color-success-text);
201-
--sd-color-success-highlight: var(--pst-color-success-highlight);
202-
--sd-color-success-bg: #d6ece1;
203-
--sd-color-success-bg-text: #14181e;
204-
--pst-color-info: #A66C98; /* general admonition */
205-
--pst-color-info-bg: #eac8e2;
206-
--pst-heading-color: var(--pyos-color-dark);
207-
--pyos-h1-color: var(--pyos-color-dark);
208-
}
209-
210-
html[data-theme=dark] {
211-
--pst-color-primary: var(--pyos-dm-color-primary);
212-
--pst-color-link: var(--pyos-color-light);
213-
--pst-color-link-hover: var(--pyos-dm-color-primary);
214-
--pyos-h1-color: var(--pyos-color-light);
215-
}
216-
217-
218-
/* -------------------------------------- */
219-
/* Generated by https://gwfh.mranftl.com/ */
220-
221-
/* poppins-regular - latin */
222-
@font-face {
223-
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
224-
font-family: 'Poppins';
225-
font-style: normal;
226-
font-weight: 400;
227-
src: url('./fonts/poppins-v20-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
228-
}
229-
230-
/* poppins-italic - latin */
231-
@font-face {
232-
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
233-
font-family: 'Poppins';
234-
font-style: italic;
235-
font-weight: 400;
236-
src: url('./fonts/poppins-v20-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
237-
}
238-
239-
/* poppins-700 - latin */
240-
@font-face {
241-
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
242-
font-family: 'Poppins';
243-
font-style: normal;
244-
font-weight: 700;
245-
src: url('./fonts/poppins-v20-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
246-
}
247-
248-
/* poppins-700italic - latin */
249-
@font-face {
250-
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
251-
font-family: 'Poppins';
252-
font-style: italic;
253-
font-weight: 700;
254-
src: url('./fonts/poppins-v20-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
255-
}
256-
257-
/* itim-regular - latin */
258-
@font-face {
259-
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
260-
font-family: 'Itim';
261-
font-style: normal;
262-
font-weight: 400;
263-
src: url('./fonts/itim-v14-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
99+
font-size: 1em;
264100
}
265101

266102
/* poppins-500 - latin */

_templates/header.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- custom head content-->
2+
<link rel="preconnect" href="https://fonts.googleapis.com">
3+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4+
<link href="https://fonts.googleapis.com/css2?family=Itim&family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
5+
6+
<!-- END custom head content -->

ci-tests-data/ci.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# What is continuous integration?
2+
3+
When you’re ready to publish your code online, you can setup Continuous Integration (CI). CI is a platform that allows you to specify and run jobs or workflows that you define.
4+
These workflows include:
5+
6+
- Running your test suite
7+
- Running code checkers / linters / spellcheck
8+
- Building your documentation
9+
- Deploying your documentation to GitHub pages
10+
11+
CI also allows you to automate running workflows across a suite of environments including:
12+
13+
- environments containing different Python versions and
14+
- different operating systems (Mac, Linux, Unix).
15+
16+
### What is Continuous Deployment (CD)?
17+
18+
Continuous deployment (CD) extends the CI process by automating the deployment of code changes to production or staging environments. In the case of your open source tool, CD can be used to:
19+
20+
- Automate publishing to PyPI
21+
- Automate publishing your documentation to github pages or Read the Docs.
22+
23+
It is also used once your conda-forge recipe is set up to keep your package up to date on conda-forge.
24+
25+
### Why Use CI
26+
27+
CI can be configured to run a workflow on every commit pushed to GitHub and every pull request opened. This ensures that any changes made to your package are tested across environments before they are merged into the main branch of your code.
28+
29+
These checks are particularly useful if someone new is contributing to your code. Every change a contributor makes will be tested when it’s pushed to your code repository.
30+
31+
Together, CI and CD streamline the process of building, testing, and deploying code. They aim to improve the efficiency, quality, and reliability of software development and publication.
32+
33+
```{note}
34+
All pyOpenSci packages must use some form of continuous integration. Even if you are not planning to go through peer review, we strongly recommend that you use continuous integration too!
35+
```
36+
37+
In the case of GitHub actions (which we will focus on here), CI workflows are running on online servers that support GitHub.
38+
39+
## CI / CD Platforms
40+
41+
There are numerous platforms available for CI/CD. Here, we will focus on GitHub Actions (GHA) which is built into GitHub. GitHub is the most commonly used platform to store scientific open source software.
42+
43+
:::{note}
44+
If you are using GitLab CI/CD many of the principles described here will apply, however the workflow files may look different.
45+
:::
46+
47+
### If you aren't sure, use GitHub Actions
48+
49+
While you are welcome to use the continuous integration platform of your choice,
50+
we recommend Github actions because it is free-to-use and integrated tightly
51+
into the GitHub user interface. There is also an entire store of GitHub action
52+
templates that you can easily use and adapt to your own needs.
53+
54+
:::{admonition} Other platforms that you may run into
55+
:class: info
56+
57+
- [Appveyor:](https://www.appveyor.com/) used to be a goto for running tests on Windows operating systems until GitHub actions evolved to support Windows. AppVeyor has evolved to support other operating systems since Microsoft acquired GitHub.
58+
- [Travis CI:](https://www.travis-ci.com/) Used to be the most common CI platform used in our ecosystem until they dropped free support for open source.
59+
- [CircleCI:](https://circleci.com/) You will still see some people using CircleCI for specific tasks. CircleCi can be useful for automated builds of websites and documentation allowing you to preview the changes to that website in your browser.
60+
:::
61+
62+
## Embrace automation
63+
64+
By embracing CI/CD, you can ensure that your code runs as you expect it to across the diverse landscapes of user environments. Further you can
65+
automate certain checks (and in some cases code fixes) including linting and code style. You can even automate spell checking your documentation
66+
and docstrings!

ci-tests-data/code-cov.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Code coverage
2+
3+
Code coverage is the amount of your package's codebase that is run as a part of running your project's tests. A good rule of thumb is to ensure that every line of your code is run at least once during testing. However, note that good code coverage does not guarantee that your package is well-tested. For example, you may run all of your lines of code, but not account for many edge-cases that users may have. Ultimately, you should think carefully about the way your package will be used, and decide whether your tests adequately cover all of that usage.
4+
5+
A common service for analyzing code coverage is [codecov.io](https://codecov.io/). This project is free for open source tools, and will provide dashboards that tell you how much of your codebase is covered during your tests. We recommend setting up an account, and using codecov to keep track of your code coverage.
6+
7+
```{figure} ../images/code-cov-stravalib.png
8+
:height: 450px
9+
:alt: Screenshot of the code cov service - showing test coverage for the stravalib package. in this image you can see a list of package modules and the associated number of lines and % lines covered by tests. at the top of the image you can see what branch is being evaluated and the path to the repository being shown.
10+
11+
the Code cov platform is a useful tool if you wish to visually track code coverage. Using it you can not only get the same summary information that you can get with **pytest-cov** extension. You can also get a visual representation of what lines are covered by your tests and what lines are not covered. Code cove is mostly useful for evaluating unit tests and/or how much of your package code is "covered. It however will not evaluate things like integration tests and end-to-end workflows. b
12+
13+
```

ci-tests-data/data.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Data for packaging

0 commit comments

Comments
 (0)