-
Notifications
You must be signed in to change notification settings - Fork 42
Use uv for CI build and deploy on GitHub action and CircleCI #618
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
Open
willingc
wants to merge
20
commits into
napari:main
Choose a base branch
from
willingc:ci-uv-security
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bca6174
Update ci files
willingc 11569c4
remove step in uv action
willingc 3c149ed
add venv
willingc 54042df
set python version
willingc c15f0fa
set fetch depth to 0
willingc d2c82ec
time to sleep
willingc d0a74bc
edit the installation order
willingc 4484a2a
remove stray comment
willingc 67ea940
change to docs directory before make fallback-videos
willingc f8fdd2e
Configure uv cache and prune
willingc bdbb629
Annotate scripts for debug
willingc fbedbc6
add logging to scripts for debug
willingc 655d5ff
more logging
willingc 6f3c1e9
remove cache glob
willingc d7227dd
use uv in circleci
willingc 8e2a0c8
Try to use pip to install uv in the circleci docker container
willingc 54f9b42
comment out cruft
willingc 776c8e9
try to install uv into container
willingc af983fa
Add comment to remove uv install step when image includes uv
willingc ebeb49b
Change log level from DEBUG to INFO in scripts logger
willingc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"""Create a logger for a directory of scripts to aid in debugging.""" | ||
|
||
import logging | ||
import os | ||
import sys | ||
|
||
|
||
def setup_logger(script_name, log_directory="logs"): | ||
"""Sets up a logger for a specific script. | ||
|
||
Args: | ||
script_name (str): The name of the script (e.g., "my_script.py"). | ||
log_directory (str, optional): The directory to store log files. Defaults to "logs". | ||
|
||
Returns: | ||
logging.Logger: A configured logger instance. | ||
""" | ||
# Create log directory if it doesn't exist | ||
if not os.path.exists(log_directory): | ||
os.makedirs(log_directory) | ||
|
||
# Extract the script name without the extension | ||
script_name_no_ext = os.path.splitext(script_name)[0] | ||
|
||
# Create a logger | ||
logger = logging.getLogger(script_name_no_ext) | ||
logger.setLevel(logging.INFO) # Set the minimum logging level | ||
|
||
# Create a file handler | ||
# log_file_path = os.path.join(log_directory, f"{script_name_no_ext}.log") | ||
# file_handler = logging.FileHandler(log_file_path) | ||
# file_handler.setLevel(logging.DEBUG) | ||
|
||
handler = logging.StreamHandler(sys.stdout) | ||
|
||
# Create a formatter | ||
formatter = logging.Formatter( | ||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s" | ||
) | ||
# file_handler.setFormatter(formatter) | ||
handler.setFormatter(formatter) | ||
|
||
# Add the file handler to the logger | ||
# logger.addHandler(file_handler) | ||
logger.addHandler(handler) | ||
return logger | ||
|
||
|
||
if __name__ == "__main__": | ||
# Example usage within a script | ||
current_script_name = os.path.basename(__file__) | ||
# Get the name of the current script | ||
logger = setup_logger(current_script_name) | ||
|
||
logger.debug("This is a debug message.") | ||
logger.info("This is an info message.") | ||
logger.warning("This is a warning message.") | ||
logger.error("This is an error message.") | ||
logger.critical("This is a critical message.") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does uv is available on more modern images (3.11 or 3.12)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR adding uv was merged into the image 3 days ago (thanks @psobolewskiPhD). Unfortunately, it has been over a month since the images have been updated on docker hub. There are a few other issues that may prevent quick release https://github.com/CircleCI-Public/cimg-python/issues so I think this is a reasonable approach until the release happens in the future.