-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
280 additions
and
63 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,115 @@ | ||
## This is just an example! | ||
# You probably aren't using most of this tooling! | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
.pytest_cache/ | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Data files | ||
*npy | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
coverage.lcov | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
python/test/unit/plots/* | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# PyCharm project settings | ||
.idea | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
.vscode | ||
deprecated | ||
setup* |
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,4 @@ | ||
This should almost certainly be one of the standard licenses. | ||
|
||
Which one to pick is outside the scope of this session, but may | ||
be discussed in future sessions about distributing your code. |
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,5 @@ | ||
# README | ||
|
||
Note that this would be visible both on GitHub and | ||
on the package distribution network you publish to | ||
(e.g. [PyPI](https://pypi.org/), the Python Package Index). |
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,10 @@ | ||
# Documentation | ||
|
||
For your project would go here. | ||
|
||
Documentation best practices and tooling are outside the | ||
scope of this tutorial, however Sciware has other | ||
presentations on these topics, | ||
[Sciware 20](https://github.com/flatironinstitute/sciware/tree/main/20_Documentation) | ||
in particular. | ||
|
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,27 @@ | ||
[project] | ||
name = "SciwarePackage" | ||
version = "0.0.1" | ||
description = "Example package for Sciware 34" | ||
authors = [ | ||
{ name = "Jeff Soules", email = "[email protected]" } | ||
] | ||
readme = "README.md" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"numpy>=1.24.0", | ||
] | ||
|
||
[project.license] | ||
file = "LICENSE" | ||
|
||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend="setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
package-dir = {"" = "src"} | ||
packages = ["SciwarePackage"] |
1 change: 1 addition & 0 deletions
1
34_PyPackaging/example_project_root/src/SciwarePackage/__init__.py
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 @@ | ||
from SciwarePackage.api import * |
24 changes: 24 additions & 0 deletions
24
34_PyPackaging/example_project_root/src/SciwarePackage/api.py
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,24 @@ | ||
|
||
from SciwarePackage.util.formatting import canonicalize_string | ||
from SciwarePackage.util.enums import Mode | ||
|
||
|
||
def multiply(a: int | float, b: int | float): | ||
return float(a * b) | ||
|
||
|
||
def describe_operation(desc: str, left_operand: int | float, right_operand: int | float): | ||
canonical_string = canonicalize_string(desc) | ||
product = multiply(left_operand, right_operand) | ||
print(f"{canonical_string}\n\t{product}") | ||
|
||
|
||
def main(mode: Mode, l: int | float, r: int | float): | ||
if mode == Mode.SIMPLE: | ||
describe_operation("times", l, r) | ||
else: | ||
describe_operation("multiplication of two numbers", l, r) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(Mode.ADVANCED, 3, 5) |
2 changes: 2 additions & 0 deletions
2
34_PyPackaging/example_project_root/src/SciwarePackage/util/enums/__init__.py
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,2 @@ | ||
from .mode import Mode as Mode | ||
from .precision import Precision as Precision |
5 changes: 5 additions & 0 deletions
5
34_PyPackaging/example_project_root/src/SciwarePackage/util/enums/mode.py
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,5 @@ | ||
from enum import Enum | ||
|
||
class Mode(Enum): | ||
SIMPLE = 'simple' | ||
ADVANCED = 'advanced' |
5 changes: 5 additions & 0 deletions
5
34_PyPackaging/example_project_root/src/SciwarePackage/util/enums/precision.py
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,5 @@ | ||
from enum import Enum | ||
|
||
class Precision(Enum): | ||
LOW = 1 | ||
HIGH = 2 |
4 changes: 4 additions & 0 deletions
4
34_PyPackaging/example_project_root/src/SciwarePackage/util/formatting.py
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,4 @@ | ||
def canonicalize_string(base_string: str) -> str: | ||
if (base_string == ''): | ||
return "[empty string]" | ||
return base_string.capitalize() |
Empty file.
Empty file.
Empty file.
Oops, something went wrong.