Skip to main content

Antipathy – for those tired of os.path

Tired of calling a function for every path manipulation you need to do?

Is:

>>> path, filename = os.path.split(some_name)
>>> basename, ext = os.path.splitext(filename)
>>> basename = basename + '_01'
>>> new_name = os.path.join(path, basename+ext)

wearing on your nerves?

In short, are you filled with antipathy [1] for os.path?

Then get antipathy and work with Path:

>>> from antipathy import Path
>>> some_name = Path('/home/ethan/source/my_file.txt')
>>> backups = Path('/home/ethan/backup/')
>>> print some_name.path
'/home/ethan/source/'
>>> print some_name.ext
'.txt'
>>> print some_name.exists()
True  # (well, if it happens to exist at this moment ;)
>>> backup = backups / some_name.filename + '_01' + some_name.ext
>>> print backup
'/home/ethan/backup/my_file_01.txt'
>>> some_name.copy(backup)

Because Path is a subclass of bytes/str/unicode, it can still be passed to other functions that expect a bytes/str/unicode object and work seamlessly [2].

[1] https://www.google.com/#q=antipathy

[2] in most cases – there are a few places that do a type check instead of an isinstance check.

Metadata

Release files for antipathy 0.85.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for antipathy 0.85.4
File Size Uploaded
antipathy-0.85.4.tar.gz 24.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for antipathy 0.85.4
File Interpreter ABI Platform
antipathy-0.85.4-py3-none-any.whl Python 3 none any Details
antipathy-0.85.4-py2-none-any.whl Python 2 none any Details

Total release size: 73.8 kB

Release files / antipathy-0.85.4.tar.gz

Download URL antipathy-0.85.4.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c3cd2500f342a08d282be66fb64239a97e893120dcc6ac80818a31d0f4bc3c70
BLAKE2b-256 checksum
How to use checksums
3bf5521943df43aff62607823712874542113346f2c425011a5c8aeea74eb24a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.13+

Release files / antipathy-0.85.4-py3-none-any.whl

Download URL antipathy-0.85.4-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3eecc7cfec2a5162502f60fda4b47b5595fbf41d1dc7808f4882bb447fdd2058
BLAKE2b-256 checksum
How to use checksums
62872b28f193e6b74cd71e94dc0fd4f81719bd9d344a4540c5ecef7812f43488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.13+

Release files / antipathy-0.85.4-py2-none-any.whl

Download URL antipathy-0.85.4-py2-none-any.whl
Size 24.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
0fad030872aca697b3529530a3d80863603716666f479083cd9e19151ab05319
BLAKE2b-256 checksum
How to use checksums
0fcd1e663f69a9e2db78a48e69998bb325f80369070e44aa2cd93c28bb1879ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.13+

Release history Release notifications | RSS feed

This release

0.85.4 This release

3 release files

0.85.3

3 release files

0.85.1

3 release files

0.84.0

3 release files

0.83.7

3 release files

0.83.6

3 release files

0.83.5

3 release files

0.83.4

3 release files

0.83.2

3 release files

0.83.1

3 release files

0.83.0

3 release files

0.82.5

3 release files

0.82.4

3 release files

0.82.3

2 release files

0.82.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page