Skip to content

Create a unique folder when not specified by the user #55

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

Merged
merged 5 commits into from
Aug 5, 2025
Merged

Conversation

samwaseda
Copy link
Member

I thought it might be neat to automatically generate a working directory:

from pyiron_snippets.files import DirectoryObject
directory = DirectoryObject()
print(directory.path)

Output: PosixPath('data_9d2d9cc5da624d4da95455a12c8cb490')

Copy link

github-actions bot commented Aug 4, 2025

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_snippets/uuid

Copy link

codecov bot commented Aug 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.14%. Comparing base (4ff35e8) to head (784d64f).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   95.11%   95.14%   +0.02%     
==========================================
  Files          13       13              
  Lines         532      535       +3     
==========================================
+ Hits          506      509       +3     
  Misses         26       26              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samwaseda samwaseda requested review from Copilot and liamhuber and removed request for Copilot August 4, 2025 14:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds automatic unique directory generation functionality to the DirectoryObject class. When no specific directory is provided or when explicitly requested, it generates a unique folder name using UUID to avoid conflicts.

  • Adds optional generate_unique_directory parameter to control unique directory creation
  • Implements automatic unique directory naming with "data_" prefix and UUID hex suffix
  • Updates constructor to handle unique directory generation logic

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pyiron_snippets/files.py Adds UUID import, new parameter, documentation, and unique directory generation logic
tests/unit/test_files.py Adds test case to verify unique directory creation with expected naming pattern

Base automatically changed from compress to main August 5, 2025 06:19
@samwaseda samwaseda merged commit 4b26ce9 into main Aug 5, 2025
20 checks passed
@samwaseda samwaseda deleted the uuid branch August 5, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant