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

Dev/1.3.6 #155

Merged
merged 41 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
55e26cb
initial support for UNIX special permission codes in Path.chmod
Erotemic May 5, 2024
bc99487
dedup reqs
Erotemic May 14, 2024
3e8bbe6
Make windows requirements optional
Erotemic May 14, 2024
56c38b8
Handle the case where jaraco is not installed
Erotemic May 15, 2024
7eead9d
Fix win32 issue
Erotemic May 15, 2024
cbb147b
Attempt fix
Erotemic May 15, 2024
83a99fd
Add notes about symlink
Erotemic May 15, 2024
ef9c6b2
Update xcookie
Erotemic May 15, 2024
5db8ecd
win32 fix
Erotemic May 15, 2024
b5df614
Somehow tests dependencies were not specified?
Erotemic May 15, 2024
4a8b523
Add dependencless _is_reparse_point for win32
Erotemic May 15, 2024
6c80b18
Bump pypy to 3.9
Erotemic May 15, 2024
a96b78f
Use new _is_reparse_point
Erotemic May 15, 2024
a5c3adb
Skip troublesome windows tests for now
Erotemic May 16, 2024
9ab4be4
wip - Squashed 2 commits
Erotemic May 15, 2024
2c7d398
Dont require custom win32 rmtree on Python >= 3.8
Erotemic May 16, 2024
45e1cf0
Monkey patch stats module for win32 pypy
Erotemic May 16, 2024
5d40ee0
Correct name
Erotemic May 16, 2024
ebe7282
spelling
Erotemic May 16, 2024
47cd57c
Fix for pypy
Erotemic May 17, 2024
7e7cfe5
Attempt to vendor jaraco
Erotemic May 17, 2024
19f9b27
Vendor jaraco
Erotemic May 17, 2024
26ebe9c
Correct checks for pypy
Erotemic May 17, 2024
7487f1f
Make mypy happy
Erotemic May 17, 2024
9e749a6
Always use vendored version of jaraco
Erotemic May 17, 2024
5775fac
Only patch stats on pypy in special case
Erotemic May 17, 2024
830d260
Revert to use real jaraco when available
Erotemic May 17, 2024
8c19e39
Attempt pypy fix
Erotemic May 18, 2024
b685651
wip
Erotemic May 19, 2024
af23752
Add IndexableWalker.diff and Nested alias
Erotemic May 23, 2024
04b39d1
Fix some issues
Erotemic May 23, 2024
2eb5eb2
wip
Erotemic May 23, 2024
c4e9c2e
Fix tests, remove Nested
Erotemic May 31, 2024
924da17
notes and better error message
Erotemic Jun 2, 2024
f1f7f25
More debug info for failing win32 tests
Erotemic Jun 7, 2024
88a6462
Fix issue where editable finders with type annotations broke util import
Erotemic Jun 7, 2024
b723699
Debug pypy win32 links
Erotemic Jun 7, 2024
f0efc23
Avoid the use of partials for shutil copy_function when possible
Erotemic Jun 8, 2024
7f70605
Attempt new workaround
Erotemic Jun 9, 2024
071a6e0
Fix readlink problem with PyPy
Erotemic Jun 9, 2024
3e9903d
Allow run_tests to be run from different directories
Erotemic Jun 8, 2024
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
56 changes: 22 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v4.1.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v3.0.0
if: runner.os == 'Linux' && matrix.arch != 'auto'
with:
platforms: all
Expand Down Expand Up @@ -183,75 +183,75 @@ jobs:
arch: auto
- python-version: '3.12'
install-extras: tests
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.12'
install-extras: tests
os: windows-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
os: windows-latest
os: ubuntu-20.04
arch: auto
- python-version: '3.7'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.8'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.9'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.10'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.11'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.12'
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
os: ubuntu-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
os: windows-latest
os: macos-13
arch: auto
- python-version: '3.7'
install-extras: tests,optional
os: windows-latest
os: macos-13
arch: auto
- python-version: '3.8'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.9'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.10'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.11'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.12'
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
os: macOS-latest
arch: auto
- python-version: '3.6'
install-extras: tests,optional
Expand Down Expand Up @@ -281,19 +281,7 @@ jobs:
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
install-extras: tests,optional
os: windows-latest
arch: auto
- python-version: pypy-3.7
- python-version: pypy-3.9
install-extras: tests,optional
os: windows-latest
arch: auto
Expand All @@ -304,7 +292,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v3.0.0
if: runner.os == 'Linux' && matrix.arch != 'auto'
with:
platforms: all
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ This project (loosely) adheres to [Semantic Versioning](https://semver.org/spec/

## Version 1.3.6 -

### Added:
* Add `ub.IndexableWalker.diff`

### Fixed:
* `ub.import_module_from_path` now correctly accepts `PathLike` objects.
* `ub.modname_to_modpath` fixed in cases where editable installs use type
annotations in their MAPPING definition.

### Added
* Support for UNIX special permission (suid/sgid/svtx) codes in `Path.chmod`.

### Changed
* Moved windows dependencies from requires to optional. Windows users that make
use of these will need to update their ubelt install or explicitly depend on
them as well.

## Version 1.3.5 - Released 2024-03-20

Expand Down
5 changes: 5 additions & 0 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ colorama>=0.4.3;platform_system=="Windows"
python_dateutil>=2.8.1

packaging>=21.0

jaraco.windows>=3.9.1;platform_system=="Windows"

# Transative dependency from pydantic>=1.9.1->inflect->jaraco.text->jaraco.windows->ubelt
pydantic<2.0;platform_system=="Windows" and platform_python_implementation == "PyPy"
4 changes: 0 additions & 4 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
jaraco.windows>=3.9.1;platform_system=="Windows"

# Transative dependency from pydantic>=1.9.1->inflect->jaraco.text->jaraco.windows->ubelt
pydantic<2.0;platform_system=="Windows" and platform_python_implementation == "PyPy"
43 changes: 36 additions & 7 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
#!/usr/bin/env python
if __name__ == '__main__':
import sys


def get_this_script_fpath():
import pathlib
try:
fpath = pathlib.Path(__file__)
except NameError:
# This is not being run from a script, thus the developer is doing some
# IPython hacking, so we will assume a path on the developer machine.
fpath = pathlib.Path('~/code/ubelt/run_tests.py').expanduser()
if not fpath.exists():
raise Exception(
'Unable to determine the file path that this script '
'should correspond to')
return fpath


def main():
import pytest
import sys
import os

repo_dpath = get_this_script_fpath().parent

package_name = 'ubelt'
mod_dpath = 'ubelt'
test_dpath = 'tests'
mod_dpath = repo_dpath / 'ubelt'
test_dpath = repo_dpath / 'tests'
config_fpath = repo_dpath / 'pyproject.toml'

pytest_args = [
'--cov-config', 'pyproject.toml',
'--cov-config', os.fspath(config_fpath),
'--cov-report', 'html',
'--cov-report', 'term',
'--durations', '100',
'--xdoctest',
'--cov=' + package_name,
mod_dpath, test_dpath
os.fspath(mod_dpath),
os.fspath(test_dpath)
]
pytest_args = pytest_args + sys.argv[1:]
sys.exit(pytest.main(pytest_args))
ret = pytest.main(pytest_args)
return ret


if __name__ == '__main__':
sys.exit(main())
31 changes: 12 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,18 @@ def gen_packages_items():
"requirements/runtime.txt", versions="loose"
)
setupkw["extras_require"] = {
"all": parse_requirements("requirements.txt", versions="loose"),
"tests": parse_requirements("requirements/tests.txt", versions="loose"),
"optional": parse_requirements("requirements/optional.txt", versions="loose"),
"all": parse_requirements("requirements.txt", versions="loose"),
"runtime": parse_requirements("requirements/runtime.txt", versions="loose"),
"tests": parse_requirements("requirements/tests.txt", versions="loose"),
"optional": parse_requirements("requirements/optional.txt", versions="loose"),
"docs": parse_requirements("requirements/docs.txt", versions="loose"),
"types": parse_requirements("requirements/types.txt", versions="loose"),
"all-strict": parse_requirements("requirements.txt", versions="strict"),
"runtime-strict": parse_requirements(
"requirements/runtime.txt", versions="strict"
),
"tests-strict": parse_requirements("requirements/tests.txt", versions="strict"),
"optional-strict": parse_requirements(
"requirements/optional.txt", versions="strict"
),
"docs-strict": parse_requirements("requirements/docs.txt", versions="strict"),
"types-strict": parse_requirements("requirements/types.txt", versions="strict"),
"all" : parse_requirements("requirements.txt", versions="loose"),
"all-strict" : parse_requirements("requirements.txt", versions="strict"),
"docs" : parse_requirements("requirements/docs.txt", versions="loose"),
"docs-strict" : parse_requirements("requirements/docs.txt", versions="strict"),
"optional" : parse_requirements("requirements/optional.txt", versions="loose"),
"optional-strict" : parse_requirements("requirements/optional.txt", versions="strict"),
"runtime" : parse_requirements("requirements/runtime.txt", versions="loose"),
"runtime-strict" : parse_requirements("requirements/runtime.txt", versions="strict"),
"tests" : parse_requirements("requirements/tests.txt", versions="loose"),
"tests-strict" : parse_requirements("requirements/tests.txt", versions="strict"),
"types" : parse_requirements("requirements/types.txt", versions="loose"),
"types-strict" : parse_requirements("requirements/types.txt", versions="strict"),
}
setupkw["name"] = NAME
setupkw["version"] = VERSION
Expand Down
11 changes: 11 additions & 0 deletions tests/test_editable_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,20 @@ def teardown_module(module):

def test_import_of_editable_install():
_check_skip_editable_module_tests()
print('Testing ediable installs')
import ubelt as ub
for PROJ in GLOBAL_PROJECTS:
result = ub.modname_to_modpath(PROJ.mod_name)
print(f'result={result}')
assert result is not None
assert PROJ.mod_dpath == ub.Path(result)


if __name__ == '__main__':
"""
CommandLine:
UBELT_DO_EDITABLE_TESTS=1 python ~/code/ubelt/tests/test_editable_modules.py
"""
setup_module(None)
test_import_of_editable_install()
teardown_module(None)
37 changes: 37 additions & 0 deletions tests/test_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@
import pytest
import os
from ubelt import util_links
import sys


if sys.platform.startswith('win32'):
try:
import jaraco.windows.filesystem as jwfs
except ImportError:
jwfs = None


def test_rel_dir_link():
"""
xdoctest ~/code/ubelt/tests/test_links.py test_rel_dir_link
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.

dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_rel_dir_link').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -64,6 +77,10 @@ def test_rel_dir_link():


def test_rel_file_link():
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_rel_file_link').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -119,6 +136,10 @@ def test_delete_symlinks():
CommandLine:
python -m ubelt.tests.test_links test_delete_symlinks
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_delete_links').ensuredir()

Expand Down Expand Up @@ -224,6 +245,10 @@ def assert_broken_link(path, want=True):


def test_modify_directory_symlinks():
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_modify_symlinks').ensuredir()
ub.delete(dpath, verbose=2)
ub.ensuredir(dpath, verbose=2)
Expand Down Expand Up @@ -283,6 +308,10 @@ def test_modify_file_symlinks():
CommandLine:
python -m ubelt.tests.test_links test_modify_symlinks
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_modify_symlinks').ensuredir()
happy_fpath = dpath / 'happy_fpath.txt'
Expand All @@ -306,6 +335,10 @@ def test_broken_link():
CommandLine:
python -m ubelt.tests.test_links test_broken_link
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_broken_link').ensuredir()

ub.delete(dpath, verbose=2)
Expand Down Expand Up @@ -370,6 +403,10 @@ def test_overwrite_symlink():
CommandLine:
python ~/code/ubelt/tests/test_links.py test_overwrite_symlink
"""
import pytest
import ubelt as ub
if ub.WIN32 and jwfs is None:
pytest.skip() # hack for windows for now.

# TODO: test that we handle broken links
dpath = ub.Path.appdir('ubelt/tests/test_links', 'test_overwrite_symlink').ensuredir()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def test_move_to_nested_non_existing():
base = _demo_directory_structure()
root = base / 'root'

import platform
if ub.WIN32 and platform.python_implementation() == 'PyPy':
ub.util_path._patch_win32_stats_on_pypy()

if ub.LINUX:
root2 = root.copy(root.augment(tail='2'))
root3 = root.copy(root.augment(tail='3'))
Expand Down
Loading
Loading