Skip to content

Commit

Permalink
Merge pull request #326 from tfeldmann/v3
Browse files Browse the repository at this point in the history
organize v3
  • Loading branch information
tfeldmann committed Dec 31, 2023
2 parents b36a679 + 21294e2 commit 881ab51
Show file tree
Hide file tree
Showing 131 changed files with 6,122 additions and 5,576 deletions.
66 changes: 9 additions & 57 deletions .dockerignore
@@ -1,59 +1,11 @@
# Git
.git
.gitignore
.gitattributes
# ignore everything
*

# Settings and CI
.editorconfig
.envrc
.readthedocs.yml
# except pyproject files
!poetry.lock
!pyproject.toml
!README.md

# Docker
docker-compose.yml
Dockerfile
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
.ruff_cache
nosetests.xml
coverage.xml

# Docs and tests
docs/
tests/

# Virtual environment
.env
.venv/
venv/

# Vim swap files
**/*.swp

# VS Code
.vscode/
# and python scripts
!**/*.py
!**/py.typed
25 changes: 14 additions & 11 deletions .github/workflows/tests.yml
Expand Up @@ -12,40 +12,43 @@ on:
- main
workflow_dispatch:

# https://github.com/python-poetry/poetry/issues/8623
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python-version }}'
python-version: "${{ matrix.python-version }}"

- name: Setup Environment
run: |
python3 -m pip install --upgrade pip setuptools wheel "poetry<1.4.0"
poetry run python -m pip install -U pip setuptools wheel
- name: Install dependencies
run: |
python3 -m pip install -U pip setuptools
python3 -m pip install poetry==1.7.1 lxml
poetry config virtualenvs.create false
poetry install --with=dev --extras=textract
- name: Version info
run: |
poetry run python main.py --version
python main.py --version
- name: Test with pytest
run: |
poetry run pytest
pytest
- name: Check with MyPy
run: |
poetry run mypy organize main.py
mypy .
40 changes: 38 additions & 2 deletions .gitignore
@@ -1,5 +1,6 @@
.configs
.pytest_cache/
**/.ruff_cache/

# Created by https://www.gitignore.io/api/python

Expand Down Expand Up @@ -117,5 +118,40 @@ venv.bak/
# End of https://www.gitignore.io/api/visualstudiocode
.idea

# ruff
**/.ruff_cache/
# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

# End of https://www.toptal.com/developers/gitignore/api/macos
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,32 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- --fix=lf
- id: trailing-whitespace
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: ["--profile=black"]
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/python-poetry/poetry
rev: "1.7.0"
hooks:
- id: poetry-check
- id: poetry-lock
args: ["--no-update"]
- id: poetry-install
21 changes: 21 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,26 @@
# Changelog

## v3.0.0a0 (2023-12-31)

- New action: `write` to write lines into a file.
- New filter: `date_lastused` (macOS only).
- You can now specify the timezone in all time based filters.
- Removed hidden (deprecated) CLI option `--config-file`.
- Lots of new tests and some bugfixes.
- `exif` filter now supports the simplematch syntax.
- Placeholder`{now}` must be `{now()}` now.
- Multiple `path`s per location are now supported.
- Locations now support a `min_depth` option
- Duplicate filter: `detect_original_by` now supports `last_seen`.
- New command line interface (added `new`, `show` and `list` commands).
- `JSONL` output (`organize run --format=JSONL`)
- `move` and `copy` now intelligently autodetect if you mean to move to a folder
(This autodetection can be deactivated).
- `copy` action: You can now specify whether you want to continue with the original
or with the copy.
- Completely removes the `pyfilesystem` dependency.
- At least a 4x speed up. Often more than 10x.

## v2.4.3 (2023-10-14)

- Modified filter: `exif`. Enabled datetime fields on exif data (Issue #266) (Thanks @FlorianFritz)
Expand Down
21 changes: 10 additions & 11 deletions Dockerfile
Expand Up @@ -2,29 +2,28 @@ FROM python:3.12-slim as base

ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1 \
POETRY_VERSION=1.5.1 \
VIRTUAL_ENV="/venv" \
PATH="${VIRTUAL_ENV}/bin:$PATH"
VIRTUAL_ENV="/venv"
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"

WORKDIR /app
COPY pyproject.toml poetry.lock ./


FROM base as pydeps

RUN pip install "poetry==${POETRY_VERSION}" && \
RUN pip install "poetry==1.7.1" && \
python -m venv ${VIRTUAL_ENV}

COPY pyproject.toml poetry.lock ./
RUN poetry install --no-interaction --compile --only=main --extras=textract --no-root
RUN poetry install --only=main --extras=textract --no-interaction


FROM base as final

ENV PATH="${VIRTUAL_ENV}/bin:$PATH" \
ORGANIZE_CONFIG=/config/config.yml
ENV ORGANIZE_CONFIG=/config/config.yml

RUN mkdir /config
RUN mkdir /config && touch ./README.md
COPY --from=pydeps ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY . .
COPY ./organize ./organize
RUN python -m pip install .

ENTRYPOINT ["python", "main.py"]
ENTRYPOINT ["organize"]

0 comments on commit 881ab51

Please sign in to comment.