Skip to content

Commit 813ac6d

Browse files
committed
adding better linting and docs for checks install
it was not clear pip install with the checks variant was needed for check Signed-off-by: vsoch <[email protected]>
1 parent e301c95 commit 813ac6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1186
-1109
lines changed

.docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../CHANGELOG.md
1+
../CHANGELOG.md

.docs/conf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import os
2121
import sys
2222

23+
from recommonmark.parser import CommonMarkParser
24+
2325
sys.path.insert(0, os.path.abspath("."))
2426

2527
# -- General configuration ------------------------------------------------
@@ -51,12 +53,6 @@
5153
# Add any paths that contain templates here, relative to this directory.
5254
templates_path = ["_templates"]
5355

54-
# The suffix(es) of source filenames.
55-
# You can specify multiple suffix as a list of string:
56-
#
57-
# source_suffix = ['.rst', '.md']
58-
from recommonmark.parser import CommonMarkParser
59-
6056
source_parsers = {
6157
".md": CommonMarkParser,
6258
}
@@ -91,6 +87,11 @@
9187
# Usually you set "language" from the command line for these cases.
9288
language = None
9389

90+
# The suffix(es) of source filenames.
91+
# You can specify multiple suffix as a list of string:
92+
#
93+
# source_suffix = ['.rst', '.md']
94+
9495
# There are two options for replacing |today|: either, you set today to some
9596
# non-false value, then it is used:
9697
#

.github/dev-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pre-commit
2+
black
3+
isort
4+
flake8

.github/workflows/main.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,19 @@ jobs:
1111
formatting:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

16-
- name: Setup black environment
17-
run: conda create --quiet --name black
16+
- name: Setup black linter
17+
run: conda create --quiet --name black pyflakes
1818

19-
- name: Check formatting with black
20-
run: |
21-
export PATH="/usr/share/miniconda/bin:$PATH"
22-
source activate black
23-
pip install black
24-
black --check scompose
19+
- name: Check Spelling
20+
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
21+
with:
22+
files: ./docs/getting_started/ ./docs/index.rst
2523

26-
- name: Check imports with pyflakes
27-
run: |
28-
export PATH="/usr/share/miniconda/bin:$PATH"
29-
source activate black
30-
pip install pyflakes==2.4.0
31-
pyflakes scompose/utils
32-
# Will have some issues
33-
pyflakes scompose/client scompose/project scompose/config || true
24+
- name: Lint and format Python code
25+
run: |
26+
export PATH="/usr/share/miniconda/bin:$PATH"
27+
source activate black
28+
pip install -r .github/dev-requirements.txt
29+
pre-commit run --all-files

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
env
12
.eggs
23
.docs/_build
34
dist

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-docstring-first
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- id: mixed-line-ending
11+
12+
- repo: local
13+
hooks:
14+
- id: black
15+
name: black
16+
language: python
17+
types: [python]
18+
entry: black
19+
20+
- id: isort
21+
name: isort
22+
args: [--filter-files]
23+
language: python
24+
types: [python]
25+
entry: isort
26+
27+
- id: flake8
28+
name: flake8
29+
language: python
30+
types: [python]
31+
entry: flake8

CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CHANGELOG
22

3-
This is a manually generated log to track changes to the repository for each release.
4-
Each section should include general headers such as **Implemented enhancements**
3+
This is a manually generated log to track changes to the repository for each release.
4+
Each section should include general headers such as **Implemented enhancements**
55
and **Merged pull requests**. Critical items to know are:
66

77
- renamed commands
@@ -14,21 +14,22 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pypi.
1515

1616
## [0.1.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.1.x)
17+
- improve linting and docs on jsonschma (checks install) (0.1.18)
1718
- add support for instance replicas (0.1.17)
1819
- fix check command validation (0.1.16)
1920
- fix a bug triggered when using startoptions in conjunction with network=false (0.1.15)
2021
- bind volumes can handle tilde expansion (0.1.14)
2122
- fix module import used by check command (0.1.13)
2223
- adding jsonschema validation and check command (0.1.12)
2324
- implement configuration override feature
24-
- implement `--preview` argument for the `check` command
25+
- implement `--preview` argument for the `check` command
2526
- add network->enable option on composer file (0.1.11)
2627
- add network->allocate_ip option on composer file (0.1.10)
2728
- version 2.0 of the spec with added fakeroot network, start, exec, and run options (0.1.0)
28-
- stop option added (equivalent functionality to down)
29+
- stop option added (equivalent functionality to down)
2930
- spython version 0.1.0 with Singularity 3.x or greater required
3031

31-
## [0.0.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.0.x)
32+
## [0.0.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.0.x)
3233
- removed check for sudo when adding network flags (0.0.21)
3334
- singularity-compose down supporting timeout (0.0.20)
3435
- command, ability to associate arguments to the instance's startscript (0.0.19)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![DOI](https://zenodo.org/badge/188852712.svg)](https://zenodo.org/badge/latestdoi/188852712)
55

66
This is a simple orchestration library for Singularity containers, akin to
7-
Docker Compose. See the [specification](https://singularityhub.github.io/singularity-compose/#/spec/spec-1.0)
7+
Docker Compose. See the [specification](https://singularityhub.github.io/singularity-compose/#/spec/spec-1.0)
88
and the [documentation](https://singularityhub.github.io/singularity-compose) for
99
details, or more examples below.
1010

docs/README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ or services.
1414

1515
Singularity compose uses Singularity on the backend, so anything that would require sudo (root)
1616
permissions for Singularity is also required for Singularity compose. This includes most
17-
networking commands (e.g., asking to allocate ports) and builds from recipe files.
18-
However, if you are using Singularity v3.3 or higher, you can take advantage of
17+
networking commands (e.g., asking to allocate ports) and builds from recipe files.
18+
However, if you are using Singularity v3.3 or higher, you can take advantage of
1919
[fakeroot](https://sylabs.io/guides/3.3/user-guide/fakeroot.html) to try and get around this.
2020
The snippet below shows how to add fakeroot as an option under a build section:
2121

@@ -32,17 +32,38 @@ And a complete example is provided [here](https://github.com/singularityhub/sing
3232
3333
## Getting Started
3434
35+
### Install
36+
37+
Note that you can install from pip:
38+
39+
```bash
40+
$ pip install singularity-compose
41+
```
42+
43+
If you want to run `singularity-compose check` you'll need jsonschema:
44+
45+
```bash
46+
$ pip install singularity-compose[checks]
47+
```
48+
49+
To get full dependencies including those for testing and the above:
50+
51+
```bash
52+
$ pip install singularity-compose[all]
53+
```
54+
55+
3556
### Dependencies
3657

37-
Singularity Compose *must* use a version of [Singularity](https://sylabs.io/guides/latest/user-guide/)
58+
Singularity Compose *must* use a version of [Singularity](https://sylabs.io/guides/latest/user-guide/)
3859
3.2.1 or greater. It's recommended to use the latest (3.3.0 release at the time of this writing) otherwise there was
3960
a bug with some versions of 3.2.1. Singularity 2.x absolutely will not work.
4061
Python 3 is also required, as Python 2 is at end of life.
4162

4263
### singularity-compose.yml
4364

4465
For a singularity-compose project, it's expected to have a `singularity-compose.yml`
45-
in the present working directory. You can look at a simple example here, here is a
66+
in the present working directory. You can look at a simple example here, here is a
4667
version 1.0 spec (before we added networking and exec options):
4768

4869
```yaml
@@ -60,7 +81,7 @@ instances:
6081
- 80:80
6182
```
6283
63-
and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
84+
and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
6485
is a version 2.0 spec that shows adding networking and exec options:
6586
6687
```yaml
@@ -77,7 +98,7 @@ instances:
7798
options:
7899
- fakeroot
79100
exec:
80-
options:
101+
options:
81102
- "env-file=myvars.env"
82103
command: printenv SUPERHERO
83104
alp2:
@@ -95,17 +116,17 @@ instances:
95116
- alp1
96117
```
97118
98-
If you are familiar with [docker-compose](https://docs.docker.com/compose/)
99-
the file should look very familiar. A key difference is that instead of
100-
"services" we have "instances." And you guessed correctly - each
101-
section there corresponds to a
119+
If you are familiar with [docker-compose](https://docs.docker.com/compose/)
120+
the file should look very familiar. A key difference is that instead of
121+
"services" we have "instances." And you guessed correctly - each
122+
section there corresponds to a
102123
[Singularity instance](https://sylabs.io/guides/3.2/user-guide/running_services.html)
103124
that will be created. In this guide, we will walk through each of the sections
104125
in detail.
105126
106127
### Instance folders
107128
108-
Generally, each section in the yaml file corresponds with a container instance to be run,
129+
Generally, each section in the yaml file corresponds with a container instance to be run,
109130
and each container instance is matched to a folder in the present working directory.
110131
For example, if I give instruction to build an `nginx` instance from
111132
a `nginx/Singularity.nginx` file, I should have the
@@ -155,15 +176,15 @@ This will pull a container `nginx.sif` into a `nginx` context folder:
155176
```
156177

157178
It's less likely that you will be able to pull a container that is ready to
158-
go, as typically you will want to customize the
159-
[startscript](https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript)
179+
go, as typically you will want to customize the
180+
[startscript](https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript)
160181
for the instance. Now that we understand the basic organization, let's
161182
bring up some instances.
162183

163184
## Quick Start
164185

165-
For this quick start, we are going to use the
166-
[singularity-compose-simple](https://www.github.com/singularityhub/singularity-compose-simple)
186+
For this quick start, we are going to use the
187+
[singularity-compose-simple](https://www.github.com/singularityhub/singularity-compose-simple)
167188
example. Singularity has a networking issue that currently doesn't allow communication
168189
between multiple containers (due to iptables and firewall issues) so for now the most we
169190
can do is show you one container. First, install singularity-compose from pip:
@@ -255,7 +276,7 @@ $ singularity-compose exec app uname -a
255276
```
256277

257278
When you open your browser to [http://127.0.0.1](http://127.0.0.1)
258-
you should see the upload interface.
279+
you should see the upload interface.
259280

260281
![img/upload.png](img/upload.png)
261282

@@ -277,7 +298,7 @@ The images that you upload are stored in `images` at the root:
277298

278299
```bash
279300
$ ls images/
280-
2018-02-20-172617.jpg 40-acos.png _upload
301+
2018-02-20-172617.jpg 40-acos.png _upload
281302
```
282303

283304
And static files are in `static`.
@@ -360,7 +381,7 @@ Python API, see [here](/singularity-compose/api/).
360381

361382
The [specification](spec/) describes in more detail the sections of the singularity-compose.yml.
362383
For example, in the quick start above, we have a post command for the app instance
363-
that creates a series of folders on the host.
384+
that creates a series of folders on the host.
364385

365386
## Examples
366387

docs/api/_sources/changelog.md.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../CHANGELOG.md
1+
../CHANGELOG.md

docs/api/assets/basic.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,4 +903,4 @@ div.math:hover a.headerlink {
903903
#top-link {
904904
display: none;
905905
}
906-
}
906+
}

docs/api/assets/css/badge_only.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)