-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add some diagnostic plots + enhance phrasing in Demo notebook #183
Open
navidcy
wants to merge
6
commits into
main
Choose a base branch
from
ncc/enhance-demo
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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cb60926
adds some diagnostic plots in demo
navidcy 7909ff8
import matplotlib
navidcy 2bc3dca
fix typo
navidcy b3e35a3
use first person to make it read more inclusive
navidcy 2098081
drop matplotlib
navidcy 94852b3
Update demos/reanalysis-forced.ipynb
navidcy 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 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
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.
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.
I think it's easiest to just include matplotlib in the package. No, it's not needed by the package, but it's the first thing people will install when they make a new env and realise it's missing
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.
I don't think we should have matplotlib as a dependency.
But I was googling this a bit and saw that there is a way to have "optional dependencies"? See the
extras_require
kwarg:https://stackoverflow.com/questions/41268863/what-is-the-difference-between-extras-require-and-install-requires-in-se/45043494#45043494
That might be a nice way? @angus-g have you seen this before? You familiar with how it works?
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.
from chatGPT:
If you want to use optional dependencies with
setuptools
but without asetup.py
file, you can still achieve this by using thepyproject.toml
configuration. This is in line with the modern PEP 517 and PEP 518 standards, which define the use ofpyproject.toml
to manage build tools likesetuptools
.Here’s how you can set it up using
setuptools
inpyproject.toml
:Step-by-Step Setup Using
pyproject.toml
withsetuptools
Create or Update
pyproject.toml
:You need to configure
setuptools
as your build backend in thepyproject.toml
file.Here's an example:
[build-system]
specifies that you're usingsetuptools
andwheel
for your package's build system.[project]
defines the core metadata of your project (name, version, etc.).dependencies
lists the required dependencies for your package.[project.optional-dependencies]
is where you define optional features likevisualization
with its corresponding dependencies.Instruct Users:
After setting up
pyproject.toml
, users can install the package with optional dependencies as follows:This command will install the core package plus the optional
matplotlib
dependency under thevisualization
group.Handle Conditional Imports:
In your code, you can use
try-except
to conditionally import the optional dependency:Benefits of Using
pyproject.toml
withsetuptools
:setup.py
needed:pyproject.toml
serves as the modern alternative tosetup.py
and provides a clean way to configure optional dependencies.visualization
,testing
,docs
), and users can choose which extras to install.Example for Multiple Optional Dependencies
If you want to define multiple optional features (e.g.,
visualization
,docs
,dev
), you can do it like this:Now, users can install specific extras by running:
pip install yourpackage[visualization] # or pip install yourpackage[dev,docs]
This setup with
pyproject.toml
usingsetuptools
provides flexibility and avoids the need forsetup.py
while still giving you full control over your optional dependencies. Let me know if you need help with any specific part!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.
Agreed.
I have used this a few times before, but I'm not sure how it interacts with conda... I don't think it's unreasonable that somebody would already have matplotlib installed if they wanted to plot stuff anyway? Plotting isn't really the job of this package?
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.
hm.... probably need to have different environment yml files and mix and match... oh well..