Skip to content
Open
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
44 changes: 36 additions & 8 deletions examples/pure-setuptools/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "examplePy"
authors = [
Expand All @@ -10,15 +6,47 @@ authors = [
maintainers = [
{name = "All the contributors"},
]
description = "An example Python package used to support Python packaging tutorials"
description = "A setuptools example Python package used to support Python packaging tutorials"
keywords = ["pyOpenSci", "python packaging"]
readme = "README.md"
license = "BSD-3-Clause"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
]
dependencies = [
"dependency-package-name-1",
"dependency-package-name-2",
dependencies = []
dynamic = [
"version",
]


[build-system]
requires = [
"setuptools>=61",
"wheel",
]
build-backend = "setuptools.build_meta"


[tool.setuptools]
zip-safe = true
include-package-data = false

[tool.setuptools_scm]
write_to = "src/examplePy/_version.py"
version_scheme = "release-branch-semver"


[project.optional-dependencies]

test = [
"pytest",
"numpy",
"pandas",
"ruff",
]

contrib = [
"pre-commit>=4.1.0",
]
Empty file.
26 changes: 26 additions & 0 deletions examples/pure-setuptools/src/examplePy/temperature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def celsius_to_fahrenheit(celsius):
"""
Convert temperature from Celsius to Fahrenheit.

Parameters:
celsius (float): Temperature in Celsius.

Returns:
float: Temperature in Fahrenheit.
"""
fahrenheit = (celsius * 9 / 5) + 32
return fahrenheit


def fahrenheit_to_celsius(fahrenheit):
"""
Convert temperature from Fahrenheit to Celsius.

Parameters:
fahrenheit (float): Temperature in Fahrenheit.

Returns:
float: Temperature in Celsius.
"""
celsius = (fahrenheit - 32) * 5 / 9
return celsius
18 changes: 18 additions & 0 deletions examples/pure-setuptools/src/examplePy/temporal-raw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Sequence

import pandas

from examplePy.temperature import fahrenheit_to_celsius


def calc_annual_mean(df: pandas.DataFrame):
"""Function to calculate the mean temperature for each year and the final mean"""
# TODO: make this a bit more robust so we can write integration test examples??
# Calculate the mean temperature for each year
yearly_means = df.groupby("Year").mean()

# Calculate the final mean temperature across all years
final_mean = yearly_means.mean()

# Return a converted value
return fahrenheit_to_celsius(yearly_means), fahrenheit_to_celsius(final_mean)
18 changes: 18 additions & 0 deletions examples/pure-setuptools/src/examplePy/temporal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Sequence

import pandas

from examplePy.temperature import fahrenheit_to_celsius


def calc_annual_mean(df: pandas.DataFrame):
"""Function to calculate the mean temperature for each year and the final mean"""
# TODO: make this a bit more robust so we can write integration test examples??
# Calculate the mean temperature for each year
yearly_means = df.groupby("Year").mean()

# Calculate the final mean temperature across all years
final_mean = yearly_means.mean()

# Return a converted value
return fahrenheit_to_celsius(yearly_means), fahrenheit_to_celsius(final_mean)
Loading
Loading