-
Notifications
You must be signed in to change notification settings - Fork 4
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
Closes #20. Added some dependencies #38
Closed
gpcureton
wants to merge
1
commit into
pyOpenSci:main
from
gpcureton:add_code_requiring_dep_upstream_issue20
Closed
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,18 +11,16 @@ dynamic = ["version"] | |
requires-python = ">=3.10" | ||
license = "MIT" | ||
keywords = [] | ||
authors = [ | ||
{ name = "Leah Wasser", email = "[email protected]" }, | ||
] | ||
authors = [{ name = "Leah Wasser", email = "[email protected]" }] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
|
||
dependencies = [] | ||
dependencies = ["numpy", "pandas", "altair", "vl-convert-python"] | ||
|
||
[project.urls] | ||
Homepage = "https://pypi.org/project/pyospackage/" | ||
|
@@ -32,18 +30,18 @@ Source = "https://github.com/pyopensci/pyospackage" | |
|
||
[project.optional-dependencies] | ||
docs = [ | ||
"sphinx", | ||
"sphinx-autobuild", | ||
"sphinx-inline-tabs", | ||
# Note that the tool you install has dashes- between the name, vs _underscores | ||
# when you call the theme in sphinx's conf.py | ||
"pydata-sphinx-theme", | ||
"sphinx-design", | ||
"sphinx-copybutton", | ||
"myst-nb", | ||
"myst-parser", | ||
# Create beautiful api docs automatically | ||
"sphinx-autoapi", | ||
"sphinx", | ||
"sphinx-autobuild", | ||
"sphinx-inline-tabs", | ||
# Note that the tool you install has dashes- between the name, vs _underscores | ||
# when you call the theme in sphinx's conf.py | ||
"pydata-sphinx-theme", | ||
"sphinx-design", | ||
"sphinx-copybutton", | ||
"myst-nb", | ||
"myst-parser", | ||
# Create beautiful api docs automatically | ||
"sphinx-autoapi", | ||
] | ||
|
||
# ******* Hatch configuration here ******* # | ||
|
@@ -69,16 +67,13 @@ docs-live = "sphinx-autobuild docs/ docs/_build" | |
|
||
|
||
[tool.hatch.envs.test] | ||
dependencies = [ | ||
"pytest", | ||
"pytest-cov" | ||
] | ||
dependencies = ["pytest", "pytest-cov"] | ||
|
||
|
||
[tool.ruff] | ||
lint.select = [ | ||
"F", # pyflakes | ||
"I", # isort | ||
"F", # pyflakes | ||
"I", # isort | ||
] | ||
lint.ignore = ["F841"] | ||
line-length = 79 |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""A module that performs basic math operations.""" | ||
|
||
import altair as alt | ||
import pandas as pd | ||
|
||
alt.renderers.enable("png", scale_factor=2, ppi=144) | ||
|
||
|
||
def plot_pyramid(): | ||
category = ["Sky", "Shady side of a pyramid", "Sunny side of a pyramid"] | ||
color = ["#416D9D", "#674028", "#DEAC58"] | ||
df = pd.DataFrame({"category": category, "value": [75, 10, 15]}) | ||
|
||
alt.Chart(df, width=150, height=150).mark_arc(outerRadius=80).encode( | ||
alt.Theta("value:Q").scale(range=[2.356, 8.639]), | ||
alt.Color("category:N") | ||
.title(None) | ||
.scale(domain=category, range=color) | ||
.legend(orient="none", legendX=160, legendY=50), | ||
order="value:Q", | ||
).configure_view(strokeOpacity=0).save("pyramid.png") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
"""A module that performs basic math operations.""" | ||
|
||
import numpy as np | ||
import numpy.typing as npt | ||
|
||
|
||
def add_integers( | ||
a: int, | ||
b: int, | ||
) -> int: | ||
"""A function that adds two integers together | ||
|
||
Parameters | ||
---------- | ||
a : int | ||
The first integer to be added. | ||
b : int | ||
The second integer to be added. | ||
|
||
Returns | ||
------- | ||
int | ||
The sum of the two provided integers. | ||
""" | ||
|
||
if not np.isscalar(a): | ||
raise TypeError(f"Expected a scalar, got {a}") | ||
if not isinstance(a, int): | ||
raise TypeError(f"Expected a integer, got {a}") | ||
if not np.isscalar(b): | ||
raise TypeError(f"Expected a scalar, got {b}") | ||
if not isinstance(b, int): | ||
raise TypeError(f"Expected a integer, got {b}") | ||
|
||
return a + b | ||
|
||
|
||
def multiply_integers( | ||
a: int, | ||
b: int, | ||
) -> int: | ||
"""A function that multiplies two integers together | ||
|
||
Parameters | ||
---------- | ||
a : int | ||
The first integer to be multiplied. | ||
b : int | ||
The second integer to be multiplied. | ||
|
||
Returns | ||
------- | ||
int | ||
The product of the two provided integers. | ||
""" | ||
if not np.isscalar(a): | ||
raise TypeError(f"Expected a scalar, got {a}") | ||
if not isinstance(a, int): | ||
raise TypeError(f"Expected an integer, got {a}") | ||
if not np.isscalar(b): | ||
raise TypeError(f"Expected a scalar, got {b}") | ||
if not isinstance(b, int): | ||
raise TypeError(f"Expected an integer, got {b}") | ||
|
||
return a * b | ||
|
||
|
||
def create_int_vector( | ||
a: int, | ||
b: int, | ||
) -> npt.NDArray[np.int32]: | ||
"""Create a numpy 1-D array | ||
|
||
Parameters | ||
---------- | ||
a : int | ||
The length of the 1-D array. | ||
b : int | ||
The integer with which to populate the array. | ||
|
||
Returns | ||
------- | ||
ndarray[int] | ||
The sum of the two provided integers. | ||
""" | ||
|
||
if not np.isscalar(a): | ||
raise TypeError(f"Expected a scalar, got {a}") | ||
if not isinstance(a, int): | ||
raise TypeError(f"Expected an integer, got {a}") | ||
if not np.isscalar(b): | ||
raise TypeError(f"Expected a scalar, got {b}") | ||
if not isinstance(b, int): | ||
raise TypeError(f"Expected an integer, got {b}") | ||
|
||
return np.ones(a, dtype=int) * b |
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.
hey there @gpcureton thank you for this PR! the one challenge here that we need to think through is we can't delete this add_numbers.py module. this is because we use it in our trainings as an example module that people make. And in our tutorials as well. it's a core simple module that people can quickly make without thinking much about the code within the function there.
So we want user to be able to access this
add_numbers.py
module.I'd prefer to keep the add_numbers module as is. BUT we can then rename your simple_arithmetic module to be something more specific that includes numpy or another package.
Let me know what you think.