Skip to content

Commit

Permalink
migrate to justfile (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfrg authored Jul 20, 2024
1 parent 68ca9fb commit a1ceb1f
Show file tree
Hide file tree
Showing 21 changed files with 647 additions and 280 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.9, "3.10", 3.11]
jupyter-version: ["5.*", "6.3", "6.4", "6.*", "7.0"]
jupyter-version: ["6.3", "6.4", "6.*", "7.1", "7.*"]

runs-on: ubuntu-latest

Expand All @@ -48,7 +48,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: arduino/setup-task@v1
- uses: extractions/setup-just@v1

# ------------------------------------------------------------------------
# Python
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
curl http://localhost:9000/
- name: Build package
run: task build
run: hatch build

- name: Install package
run: |
Expand All @@ -106,8 +106,8 @@ jobs:
- name: Run tests
run: |
task test-all
task report
pytest . -m "not gcs"
just report
- name: Codecov
uses: codecov/codecov-action@v2
Expand Down
15 changes: 6 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

Requirements:

- [Python Hatch](https://hatch.pypa.io/latest)
- [Rye](https://rye.astral.sh/)

## Create Python env:

```shell
hatch env

# Activate env
hatch shell
rye sync
```

## Iteration
Expand Down Expand Up @@ -44,7 +41,7 @@ c.Application.log_level = "DEBUG"
Start Minio (using docker) in one terminal:

```shell
task minio
just minio
```

Start Jupyter Notebook in another terminal:
Expand All @@ -56,12 +53,12 @@ jupyter lab --config ~/.jupyter/jupyter_notebook_config.py
## Tests

```shell
task test
just test
```

Check linting and format

```shell
task check
task fmt
just check
just fmt
```
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
export VERSION=1.0.0

# Optional reset
task clean
just clean

task build
just build
rye publish

git commit -am "Release ${VERSION}" --allow-empty
Expand Down
93 changes: 0 additions & 93 deletions Taskfile.yml

This file was deleted.

55 changes: 55 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
s3dir := "./tmp-data"

default:
just --list

build:
rye build

check:
rye run isort . --check-only --diff
rye run black . --check
rye run ruff check s3contents
rye run flake8

fmt:
rye run isort .
rye run ruff format

test FILTER="":
rye run pytest -k "{{FILTER}}"

report:
coverage xml
coverage html

publish:
rye publish

# ------------------------------------------------------------------------------
# Minio

minio:
mkdir -p $PWD/notebooks
docker run -p 9000:9000 -p 9001:9001 -v $PWD:/data -e MINIO_ROOT_USER=access-key -e MINIO_ROOT_PASSWORD=secret-key minio/minio:RELEASE.2021-11-09T03-21-45Z server /data --console-address ":9001"

# From https://docs.min.io/minio/baremetal/installation/deploy-minio-distributed.html?ref=con#deploy-distributed-minio
# Run minio server in distributed mode (necessary for versioning)
minio-distributed:
echo "Once running, manually create a versioned 'notebooks' bucket in Minio-console"
mkdir -p "$PWD/mnt/disk1/notebooks"
mkdir -p "$PWD/mnt/disk2/notebooks"
mkdir -p "$PWD/mnt/disk3/notebooks"
mkdir -p "$PWD/mnt/disk4/notebooks"
docker run -p 9000:9000 -p 9001:9001 \
-v "${s3DIR}/mnt/disk1:/data1" \
-v "${s3DIR}/mnt/disk2:/data2" \
-v "${s3DIR}/mnt/disk3:/data3" \
-v "${s3DIR}/mnt/disk4:/data4" \
-e MINIO_ROOT_USER=access-key -e MINIO_ROOT_PASSWORD=secret-key \
minio/minio:RELEASE.2021-11-09T03-21-45Z server \
"/data1" \
"/data2" \
"/data3" \
"/data4" \
--console-address ":9001"
81 changes: 46 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "s3contents"
description = "S3 Contents Manager for Jupyter"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9"
license = "Apache-2.0"
keywords = [
"jupyter",
Expand All @@ -18,10 +18,10 @@ authors = [{ name = "Daniel Rodriguez", email = "[email protected]" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand All @@ -33,13 +33,23 @@ dependencies = [
]
dynamic = ["version"]

[project.urls]
Documentation = "https://github.com/danielfrg/s3contents#readme"
Issues = "https://github.com/danielfrg/s3contents/issues"
Source = "https://github.com/danielfrg/s3contents"

[project.optional-dependencies]
test = ["coverage[toml]", "nose", "pytest", "pytest-cov"]
[tool.rye]
managed = true
dev-dependencies = [
# Testing
"coverage[toml]",
"pymdown-extensions",
"pytest",
"pytest-cov",
# Linting
"black",
"flake8",
"isort",
"pip-tools",
"ruff",
# Development
"jupyterlab",
]

[build-system]
requires = ["hatchling"]
Expand All @@ -52,49 +62,37 @@ exclude = [".github", "docs"]
[tool.hatch.version]
path = "s3contents/__about__.py"

[tool.hatch.envs.default]
features = ["test"]
dependencies = [
# Linting
"black",
"flake8",
"isort",
"pip-tools",
"ruff",
# Development
"jupyterlab",
]

[tool.hatch.envs.default.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=adsctl --cov=tests {args}"
no-cov = "cov --no-cov {args}"

[[tool.hatch.envs.test.matrix]]
python = ["38", "39", "310", "311"]
[tool.hatch.metadata]
allow-direct-references = true

[tool.pytest.ini_options]
testpaths = ["s3contents/tests"]
addopts = [
"-s",
"-vv",
"--strict-config",
"--strict-markers",
"--ignore=dist",
"--ignore=site-packages",
# "--strict-markers",
"--cov=s3contents",
"--cov-report=term",
"--cov-config=pyproject.toml",
]
xfail_strict = true
markers = [
"pkg: package tests",
"minio: requires minio server (deselect with '-m \"not minio\"')",
"gcs: requires gcs creds (deselect with '-m \"not minio\"')",
]
xfail_strict = true
filterwarnings = ["ignore::DeprecationWarning"]

[tool.coverage.report]
show_missing = true
ignore_errors = false
[tool.coverage.run]
branch = true
parallel = true
omit = ["tests/*"]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
Expand All @@ -107,9 +105,14 @@ omit = ["s3contents/tests/*"]
[tool.coverage.paths]
source = ["s3contents", ".venv/lib/python*/site-packages/s3contents"]

[tool.black]
line_length = 79
skip_string_normalization = true
[tool.ruff]
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
# "I", # isort
"B", # flake8-bugbear
]

[tool.isort]
ensure_newline_before_comments = true
Expand All @@ -118,8 +121,16 @@ multi_line_output = 3
include_trailing_comma = true
profile = "black"

[tool.mypy]
strict = true

[tool.pydocstyle]
add_ignore = ["D100", "D101", "D102", "D103", "D104", "D105"]
convention = "numpy"
inherit = false
match_dir = "s3contents"

[project.urls]
Documentation = "https://github.com/danielfrg/s3contents#readme"
Issues = "https://github.com/danielfrg/s3contents/issues"
Source = "https://github.com/danielfrg/s3contents"
Loading

0 comments on commit a1ceb1f

Please sign in to comment.