Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more File api functions to Tree #209

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2cb8d9e
Remove travis.yaml
LecrisUT Aug 9, 2023
b76b83b
Switch to PEP621
LecrisUT Aug 9, 2023
3d254b7
Remove python-coveralls dependence
LecrisUT Aug 9, 2023
baadc1a
Fix github action
LecrisUT Aug 9, 2023
c604d4e
Remove makefile dependence
LecrisUT Aug 10, 2023
6dea8f9
Switch to dynamic version
LecrisUT Aug 9, 2023
d263ead
Fix makefile
LecrisUT Aug 10, 2023
17e8f1f
Improve spec file
LecrisUT Aug 9, 2023
c08e0e3
Fix release workflow
LecrisUT Aug 9, 2023
820edd3
Fix spec file for epel 8, 9
LecrisUT Aug 9, 2023
3c1a107
Temporary fix for cli entry_point + test_suite
LecrisUT Aug 9, 2023
2d7b2bb
Bump rtd python version
LecrisUT Aug 9, 2023
1311985
Drop epel-8
LecrisUT Aug 10, 2023
0293623
Fix Epel9 build
LecrisUT Aug 11, 2023
673522f
Use importlib.metadata to get version
LecrisUT Aug 11, 2023
d06a337
Update pyproject metadata and expand github CI tests
LecrisUT Aug 11, 2023
9239e96
Add type_hints to `Tree`
LecrisUT Aug 10, 2023
6aab45a
Narrow down DataType hint
LecrisUT Aug 10, 2023
e6efe10
Add more dict-like interface to `Tree`
LecrisUT Aug 9, 2023
7ce9437
Add `filter` type hints
LecrisUT Aug 9, 2023
75d68b9
type_hint Context
LecrisUT Aug 9, 2023
8f2229f
Add mypy pre-commit
LecrisUT Aug 10, 2023
4b4f8b3
More type hints
LecrisUT Aug 10, 2023
d4e117b
Add py.typed
LecrisUT Aug 11, 2023
5d7d087
Fix test issues
LecrisUT Aug 18, 2023
c7c267e
Path-like API
LecrisUT Aug 15, 2023
a3fa77e
Implement `iterdir` and `walk` api
LecrisUT Aug 15, 2023
1c45048
Implement `keys`, `values`, `items` interface
LecrisUT Aug 15, 2023
7bfef94
Conditional typing
LecrisUT Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
3 changes: 3 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
codecov:
notify:
after_n_builds: 4
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
workflow_dispatch:
inputs:
upload-wheel:
type: boolean
required: false
default: false
description: Upload wheel as an artifact
pull_request:
push:
branches: [ main ]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
uses: ./.github/workflows/step_test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build-wheel:
uses: ./.github/workflows/step_build-wheel.yml
needs: [ tests ]
with:
upload: ${{ inputs.upload-wheel || false }}
14 changes: 0 additions & 14 deletions .github/workflows/pre-commit.yml

This file was deleted.

25 changes: 19 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,30 @@ on:
required: true

jobs:
release:
build-wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
if: ${{ github.event_name == 'release' }}
- uses: actions/checkout@v2
if: ${{ github.event_name == 'workflow_dispatch' }}
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Create dist
run: make wheel
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Build package
run: pipx run build
- uses: actions/upload-artifact@v3
with:
path: dist/*
release:
name: Prepare release
runs-on: ubuntu-latest
needs: [build-wheel]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/step_build-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
workflow_call:
inputs:
upload:
required: false
type: boolean
default: true
description: Upload wheel as artifact

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build package
run: pipx run build
- uses: actions/upload-artifact@v3
with:
path: dist/*
if: ${{ inputs.upload }}
42 changes: 42 additions & 0 deletions .github/workflows/step_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
description: Codecov token

permissions:
contents: read

jobs:
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]

checks:
name:
Check 🐍 ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install package
run: pip install -e.[tests-cov]
- name: Test package
run: pytest --cov --cov-report=xml
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
name: python-${{ matrix.python-version }}
15 changes: 8 additions & 7 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,38 @@ synced_files:
upstream_package_name: fmf
downstream_package_name: fmf

# Epel9 fails to build with dynamic version. Need to create archive with PKG-INFO
# F37 works with setuptools_scm 7.0
actions:
create-archive:
- make tarball
- "python3 -m build --sdist --outdir ."
- "sh -c 'echo fmf-$(hatch version).tar.gz'"
get-current-version:
- make version
- "hatch version"

srpm_build_deps:
- make
- python3-docutils
- python3-build
- hatch
- python3-hatch-vcs

jobs:
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- epel-8
- epel-9

- job: tests
trigger: pull_request
targets:
- fedora-all
- epel-8
- epel-9

- job: copr_build
trigger: commit
branch: main
targets:
- fedora-all
- epel-8
- epel-9
list_on_homepage: True
preserve_project: True
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.4.1"
hooks:
- id: mypy
files: ^(fmf)
additional_dependencies:
- types-jsonschema
6 changes: 6 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Config for building https://fmf.readthedocs.io/
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
sphinx:
configuration: docs/conf.py
python:
install:
- method: pip
Expand Down
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Prepare variables
TMP = $(CURDIR)/tmp
VERSION = $(shell grep ^Version fmf.spec | sed 's/.* //')
COMMIT = $(shell git rev-parse --short HEAD)
REPLACE_VERSION = "s/running from the source/$(VERSION) ($(COMMIT))/"
VERSION = $(hatch version)
PACKAGE = fmf-$(VERSION)
FILES = LICENSE README.rst \
Makefile fmf.spec setup.py \
examples fmf bin tests
Makefile fmf.spec pyproject.toml \
examples fmf tests

# Define special targets
all: docs packages
Expand All @@ -19,11 +17,11 @@ tmp:

# Run the test suite, optionally with coverage
test: tmp
pytest tests/unit -c tests/unit/pytest.ini
pytest tests/unit
smoke: tmp
pytest tests/unit/test_smoke.py -c tests/unit/pytest.ini
pytest tests/unit/test_smoke.py
coverage: tmp
coverage run --source=fmf,bin -m py.test -c tests/unit/pytest.ini tests
coverage run --source=fmf -m py.test tests
coverage report
coverage annotate

Expand All @@ -42,12 +40,9 @@ source: clean tmp
mkdir -p $(TMP)/SOURCES
mkdir -p $(TMP)/$(PACKAGE)
cp -a $(FILES) $(TMP)/$(PACKAGE)
sed -i $(REPLACE_VERSION) $(TMP)/$(PACKAGE)/fmf/__init__.py
tarball: source man
cd $(TMP) && tar cfz SOURCES/$(PACKAGE).tar.gz $(PACKAGE)
@echo ./tmp/SOURCES/$(PACKAGE).tar.gz
version:
@echo "$(VERSION)"
rpm: tarball
rpmbuild --define '_topdir $(TMP)' -bb fmf.spec
srpm: tarball
Expand All @@ -57,8 +52,7 @@ packages: rpm srpm

# Python packaging
wheel:
python setup.py bdist_wheel
python3 setup.py bdist_wheel
python3 -m build
upload:
twine upload dist/*.whl

Expand Down
40 changes: 0 additions & 40 deletions bin/fmf

This file was deleted.

Loading