Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docs/changelogs/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
-|-|-
[No ref] | Adding flag to detect OneCode Cloud env | Useful flag to handle local vs cloud env when running code using display (e.g. plot show).
[No Ref] | Python version 3.13 now supported | All Python versions ranging from 3.10 through 3.13 are now supported.
[No Ref] | No longer checking modules at startup | `ONECODE_FLAG_CHECK_MODULES` not set to False by default as verbosity is annoying, especially combined with #45.
[No Ref] | Avoid warnings on duplicate files with `onecode-zip` | `onecode-zip` checks first if file already added to the archive (in case of duplicates entry in MANIFEST).


## New Features
Expand Down
2 changes: 1 addition & 1 deletion onecode/base/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def reset(
ConfigOption.FLUSH_STDOUT: False,
ConfigOption.LOGGER_COLOR: True,
ConfigOption.LOGGER_TIMESTAMP: True,
ConfigOption.CHECK_MODULES: True,
ConfigOption.CHECK_MODULES: False,
ConfigOption.CLOUD_ENV: False,
**{k[len("ONECODE_CONFIG_"):]: os.environ[k]
for k in os.environ if k.startswith("ONECODE_CONFIG_")},
Expand Down
6 changes: 6 additions & 0 deletions onecode/cli/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def zip_output(
"""

compression = zipfile.ZIP_STORED if compression_level == 0 else zipfile.ZIP_DEFLATED
files_in_archive = set()
with zipfile.ZipFile(
to_file,
"w",
Expand All @@ -52,6 +53,11 @@ def zip_output(
os.path.relpath(output_file, os.path.join(data_path, "outputs"))
)

if arcpath in files_in_archive: # pragma: no cover
continue

files_in_archive.add(arcpath)

if verbose:
print(f"Archiving {output['key']}: {output_file} => {arcpath}")

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/base/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_empty_project():
ConfigOption.FLUSH_STDOUT: False,
ConfigOption.LOGGER_COLOR: True,
ConfigOption.LOGGER_TIMESTAMP: True,
ConfigOption.CHECK_MODULES: True,
ConfigOption.CHECK_MODULES: False,
ConfigOption.CLOUD_ENV: False,
}
assert p.data_root == os.getcwd()
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_project_reset():
ConfigOption.FLUSH_STDOUT: True,
ConfigOption.LOGGER_COLOR: True,
ConfigOption.LOGGER_TIMESTAMP: True,
ConfigOption.CHECK_MODULES: True,
ConfigOption.CHECK_MODULES: False,
ConfigOption.CLOUD_ENV: False,
}
assert p.data_root == data_path
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_project_reset():
ConfigOption.FLUSH_STDOUT: False,
ConfigOption.LOGGER_COLOR: True,
ConfigOption.LOGGER_TIMESTAMP: True,
ConfigOption.CHECK_MODULES: True,
ConfigOption.CHECK_MODULES: False,
ConfigOption.CLOUD_ENV: False,
}
assert p.data_root == os.getcwd()
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_config_option():
ConfigOption.FLUSH_STDOUT: False,
ConfigOption.LOGGER_COLOR: True,
ConfigOption.LOGGER_TIMESTAMP: True,
ConfigOption.CHECK_MODULES: True,
ConfigOption.CHECK_MODULES: False,
ConfigOption.CLOUD_ENV: False,
'XX': 56.4
}
Expand Down