Skip to content

Commit 0b1b89b

Browse files
authored
2.2.0rc1 (#73)
1 parent b075836 commit 0b1b89b

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Changelog / Release notes
22

33

4+
## [2.2.0](https://github.com/mikeqfu/pyhelpers/releases/tag/2.1.0)
5+
6+
(*17 March 2025*)
7+
8+
### Notable [changes](https://github.com/mikeqfu/pyhelpers/compare/2.1.0...2.2.0) since [2.1.0](https://pypi.org/project/pyhelpers/2.1.0/):
9+
10+
- **Code enhancements:** Refactored multiple submodules for better maintainability.
11+
- **Testing:** Improved test cases and updated test data for better coverage.
12+
- **Bug fixes:** Fixed various issues.
13+
- **Documentation:** Enhanced docstrings for clarity.
14+
15+
**For more information and detailed specifications, check out the [PyHelpers 2.2.0 documentation](https://pyhelpers.readthedocs.io/en/2.2.0/).**
16+
17+
418
## [2.1.0](https://github.com/mikeqfu/pyhelpers/releases/tag/2.1.0)
519

620
(*10 January 2025*)

docs/source/quick-start.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ The :mod:`pyhelpers.dirs` module aids in manipulating directories. For instance,
169169
>>> cwd = cd() # The current working directory
170170
>>> # Relative path of `cwd` to the current working directory
171171
>>> rel_path_cwd = os.path.relpath(cwd)
172-
>>> print(rel_path_cwd)
172+
>>> print(rel_path_cwd) # (on Windows)
173173
.
174174
175175
To specify a path to a temporary folder named ``"pyhelpers_tutorial"``:
@@ -182,7 +182,7 @@ To specify a path to a temporary folder named ``"pyhelpers_tutorial"``:
182182
>>> path_to_dir = cd(dir_name)
183183
>>> # Relative path of the directory
184184
>>> rel_dir_path = os.path.relpath(path_to_dir)
185-
>>> print(rel_dir_path)
185+
>>> print(rel_dir_path) # (on Windows)
186186
pyhelpers_tutorial
187187
188188
Check whether the directory ``"pyhelpers_tutorial\"`` exists:
@@ -212,7 +212,7 @@ When we specify a sequence of names (in order with a filename being the last), t
212212
>>> path_to_file = cd(dir_name, filename) # path_to_file = cd(path_to_dir, filename)
213213
>>> # Relative path of the file "quick_start.dat"
214214
>>> rel_file_path = os.path.relpath(path_to_file)
215-
>>> print(rel_file_path)
215+
>>> print(rel_file_path) # (on Windows)
216216
pyhelpers_tutorial\quick_start.dat
217217
218218
If any directories in the specified path do not exist, setting ``mkdir=True`` will create them. For example, to specify a data directory named ``"data"`` within the ``"pyhelpers_tutorial"`` folder:
@@ -223,7 +223,7 @@ If any directories in the specified path do not exist, setting ``mkdir=True`` wi
223223
>>> data_dir = cd(dir_name, "data") # equivalent to `cd(path_to_dir, "data")`
224224
>>> # Relative path of the data directory
225225
>>> rel_data_dir = os.path.relpath(data_dir)
226-
>>> print(rel_data_dir)
226+
>>> print(rel_data_dir) # (on Windows)
227227
pyhelpers_tutorial\data
228228
229229
We can then use the :func:`~pyhelpers.dirs.is_dir` function to check if ``data_dir`` (or ``rel_data_dir``) is a directory:
@@ -250,7 +250,7 @@ For another example, to specify a path to a Pickle file, named ``"dat.pkl"``, in
250250
>>> path_to_pickle = cd(data_dir, pickle_filename)
251251
>>> # Relative path of the Pickle file
252252
>>> rel_pickle_path = os.path.relpath(path_to_pickle)
253-
>>> print(rel_pickle_path)
253+
>>> print(rel_pickle_path) # (on Windows)
254254
pyhelpers_tutorial\data\dat.pkl
255255
256256
Check ``rel_pickle_path`` (or ``path_to_pickle``):
@@ -286,9 +286,9 @@ To delete the directory ``"pyhelpers_tutorial\"`` (including all its contents),
286286
>>> from pyhelpers.dirs import delete_dir
287287
>>> # Delete the "pyhelpers_tutorial" directory
288288
>>> delete_dir(path_to_dir, verbose=True)
289-
To delete the directory "pyhelpers_tutorial\" (Not empty)
289+
To delete the directory "./pyhelpers_tutorial/" (Not empty)
290290
? [No]|Yes: yes
291-
Deleting "pyhelpers_tutorial\" ... Done.
291+
Deleting "./pyhelpers_tutorial/" ... Done.
292292
293293
.. _quickstart-store-examples:
294294

@@ -308,14 +308,14 @@ To demonstrate, let's save the ``data_frame`` created earlier (see :ref:`Prepara
308308
>>> from pyhelpers.store import save_pickle, load_pickle
309309
>>> # Save `data_frame` to "dat.pkl"
310310
>>> save_pickle(data_frame, path_to_pickle, verbose=True)
311-
Saving "dat.pkl" to "pyhelpers_tutorial\data\" ... Done.
311+
Saving "dat.pkl" to "./pyhelpers_tutorial/data/" ... Done.
312312
313313
We can now retrieve/load the data from ``path_to_pickle`` and store it as ``df_retrieved``:
314314

315315
.. code-block:: python
316316
317317
>>> df_retrieved = load_pickle(path_to_pickle, verbose=True)
318-
Loading "pyhelpers_tutorial\data\dat.pkl" ... Done.
318+
Loading "./pyhelpers_tutorial/data/dat.pkl" ... Done.
319319
320320
To verify if ``df_retrieved`` matches ``data_frame``:
321321

@@ -329,9 +329,9 @@ Before proceeding, let's delete the Pickle file (i.e. ``path_to_pickle``) and th
329329
.. code-block:: python
330330
331331
>>> delete_dir(path_to_dir, verbose=True)
332-
To delete the directory "pyhelpers_tutorial\" (Not empty)
332+
To delete the directory "./pyhelpers_tutorial/" (Not empty)
333333
? [No]|Yes: yes
334-
Deleting "pyhelpers_tutorial\" ... Done.
334+
Deleting "./pyhelpers_tutorial/" ... Done.
335335
336336
.. note::
337337

@@ -481,11 +481,12 @@ If we set ``verbose=True`` (given that `tqdm`_ is available in our working envir
481481
.. code-block:: python
482482
483483
>>> download_file_from_url(url, python_logo_file_path, if_exists='replace', verbose=True)
484-
"pyhelpers_tutorial\images\python-logo.png": 81.6kB [00:00, 10.8MB/s]
484+
Downloading "python-logo.png" 100%|██████████| 83.6k/83.6k | 403kB/s | ETA: 00:00
485+
Saving "python-logo.png" to "./pyhelpers_tutorial/images/" ... Done.
485486
486487
.. note::
487488

488-
- *'10.8MB/s'* shown at the end of the output is an estimated speed of downloading the file, which varies depending on network conditions at the time of running the function.
489+
- *'403kB/s'* shown at the end of the output is an estimated speed of downloading the file, which varies depending on network conditions at the time of running the function.
489490
- Setting ``if_exists='replace'`` (default) allows us to replace the image file that already exists at the specified destination.
490491

491492
Now let's have a look at the downloaded image file using `Pillow`_:
@@ -512,7 +513,7 @@ To delete ``"pyhelpers_tutorial\"`` and its subdirectories (including ``"pyhelpe
512513
.. code-block:: python
513514
514515
>>> delete_dir(path_to_dir, confirmation_required=False, verbose=True)
515-
Deleting "pyhelpers_tutorial\" ... Done.
516+
Deleting "./pyhelpers_tutorial/" ... Done.
516517
517518
Setting the parameter ``confirmation_required=False`` can allow us to delete the directory straightaway without typing a ``yes`` to confirm the action. The confirmation prompt is actually implemented through the :func:`~pyhelpers.ops.confirmed` function, which is also from the :mod:`pyhelpers.ops` module and can be helpful especially when we'd like to impose a manual confirmation before proceeding with certain actions. For example:
518519

pyhelpers/data/.metadata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Author": "Qian Fu",
66
"Affiliation": "School of Engineering, University of Birmingham",
77
"Email": "q.fu@bham.ac.uk",
8-
"Version": "2.2.0dev",
8+
"Version": "2.2.0rc1",
99
"License": "MIT License",
1010
"First release": "September 2019"
1111
}

0 commit comments

Comments
 (0)