Skip to content

Commit 33e5e74

Browse files
committed
Initial commit
Files generated using `cookiecutter gh:scientific-python/cookie` based of scientific-python/cookie@dbf83f6e6 See https://learn.scientific-python.org/development/
0 parents  commit 33e5e74

24 files changed

+1033
-0
lines changed

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git_archival.txt export-subst

.github/CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed
2+
description of best practices for developing scientific packages.
3+
4+
[spc-dev-intro]: https://learn.scientific-python.org/development/
5+
6+
# Quick development
7+
8+
The fastest way to start with development is to use nox. If you don't have nox,
9+
you can use `pipx run nox` to run it without installing, or `pipx install nox`.
10+
If you don't have pipx (pip for applications), then you can install with
11+
`pip install pipx` (the only case were installing an application with regular
12+
pip is reasonable). If you use macOS, then pipx and nox are both in brew, use
13+
`brew install pipx nox`.
14+
15+
To use, run `nox`. This will lint and test using every installed version of
16+
Python on your system, skipping ones that are not installed. You can also run
17+
specific jobs:
18+
19+
```console
20+
$ nox -s lint # Lint only
21+
$ nox -s tests # Python tests
22+
$ nox -s docs -- --serve # Build and serve the docs
23+
$ nox -s build # Make an SDist and wheel
24+
```
25+
26+
Nox handles everything for you, including setting up an temporary virtual
27+
environment for each run.
28+
29+
# Setting up a development environment manually
30+
31+
You can set up a development environment by running:
32+
33+
```bash
34+
python3 -m venv .venv
35+
source ./.venv/bin/activate
36+
pip install -v -e .[dev]
37+
```
38+
39+
If you have the
40+
[Python Launcher for Unix](https://github.com/brettcannon/python-launcher), you
41+
can instead do:
42+
43+
```bash
44+
py -m venv .venv
45+
py -m install -v -e .[dev]
46+
```
47+
48+
# Post setup
49+
50+
You should prepare pre-commit, which will help you by checking that commits pass
51+
required checks:
52+
53+
```bash
54+
pip install pre-commit # or brew install pre-commit on macOS
55+
pre-commit install # Will install a pre-commit hook into the git repo
56+
```
57+
58+
You can also/alternatively run `pre-commit run` (changes only) or
59+
`pre-commit run --all-files` to check even without installing the hook.
60+
61+
# Testing
62+
63+
Use pytest to run the unit checks:
64+
65+
```bash
66+
pytest
67+
```
68+
69+
# Coverage
70+
71+
Use pytest-cov to generate coverage reports:
72+
73+
```bash
74+
pytest --cov=s5cmd
75+
```
76+
77+
# Building docs
78+
79+
You can build the docs using:
80+
81+
```bash
82+
nox -s docs
83+
```
84+
85+
You can see a preview with:
86+
87+
```bash
88+
nox -s docs -- --serve
89+
```
90+
91+
# Pre-commit
92+
93+
This project uses pre-commit for all style checking. While you can run it with
94+
nox, this is such an important tool that it deserves to be installed on its own.
95+
Install pre-commit and run:
96+
97+
```bash
98+
pre-commit run -a
99+
```
100+
101+
to check all files.

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

.github/matchers/pylint.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "warning",
5+
"pattern": [
6+
{
7+
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"code": 4,
12+
"message": 5
13+
}
14+
],
15+
"owner": "pylint-warning"
16+
},
17+
{
18+
"severity": "error",
19+
"pattern": [
20+
{
21+
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
22+
"file": 1,
23+
"line": 2,
24+
"column": 3,
25+
"code": 4,
26+
"message": 5
27+
}
28+
],
29+
"owner": "pylint-error"
30+
}
31+
]
32+
}

.github/workflows/cd.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: wheels
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
FORCE_COLOR: 3
15+
16+
jobs:
17+
make_sdist:
18+
name: Make SDist
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Build SDist
26+
run: pipx run build --sdist
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: cibw-sdist
31+
path: dist/*.tar.gz
32+
33+
build_wheels:
34+
name: Wheel on ${{ matrix.os }}
35+
runs-on: ${{ matrix.os }}
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
os: [ubuntu-latest, windows-latest, macos-latest]
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- uses: pypa/[email protected]
47+
48+
- name: Upload wheels
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
52+
path: wheelhouse/*.whl
53+
54+
upload_all:
55+
needs: [build_wheels, make_sdist]
56+
environment: pypi
57+
permissions:
58+
id-token: write
59+
runs-on: ubuntu-latest
60+
if: github.event_name == 'release' && github.event.action == 'published'
61+
62+
steps:
63+
- uses: actions/download-artifact@v4
64+
with:
65+
pattern: cibw-*
66+
path: dist
67+
merge-multiple: true
68+
69+
- uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
# Remember to tell (test-)pypi about this repo before publishing
72+
# Remove this line to publish to PyPI
73+
repository-url: https://test.pypi.org/legacy/

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
FORCE_COLOR: 3
16+
17+
jobs:
18+
pre-commit:
19+
name: Format
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
28+
- uses: pre-commit/[email protected]
29+
with:
30+
extra_args: --hook-stage manual --all-files
31+
- name: Run PyLint
32+
run: |
33+
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
34+
pipx run nox -s pylint
35+
36+
checks:
37+
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
38+
runs-on: ${{ matrix.runs-on }}
39+
needs: [pre-commit]
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
python-version: ["3.8", "3.12"]
44+
runs-on: [ubuntu-latest, macos-latest, windows-latest]
45+
46+
include:
47+
- python-version: pypy-3.10
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
allow-prereleases: true
59+
60+
- name: Install package
61+
run: python -m pip install .[test]
62+
63+
- name: Test package
64+
run: >-
65+
python -m pytest -ra --cov --cov-report=xml --cov-report=term
66+
--durations=20
67+
68+
- name: Upload coverage report
69+
uses: codecov/[email protected]
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)