Skip to content

Commit

Permalink
This commit is an exact copy of oat_python folder in Cmmit 4bc53e2 of…
Browse files Browse the repository at this point in the history
… oat_pnnl (https://github.com/pnnl/oat_pnnl).

It keeps oat_python up-to-date with the latest changes to OAT.
  • Loading branch information
ghproek committed Oct 11, 2024
1 parent 9da9fe8 commit 8e92e6a
Show file tree
Hide file tree
Showing 31 changed files with 6,319 additions and 167 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is the default CI workflow provided by the Rust book.
#
# Maturin will automatically generate a more advanced CI workflow
# that incorporates pytest. To generate that workflow, run
# `maturin generate-ci github --pytest`



name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose
26 changes: 26 additions & 0 deletions ATTRIBUTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Open Applied Topology in Python (OAT-Python) is an extension of the [SOLAR library](https://github.com/ExHACT/solar).
SOLAR is funded under the [ExHACT project](https://github.com/ExHACT).
OAT is made publicly available under the MIT License below.


MIT License

Copyright (c) 2021, 2022, 2023 The OAT Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributor code of conduct

Our shared values as software developers guide us in our day-to-day interactions and decision-making. Our open source projects are no exception. Trust, respect, collaboration and transparency are core values we believe should live and breathe within our projects. Our community welcomes participants from around the world with different experiences, unique perspectives, and great ideas to share.

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Attempting collaboration before conflict
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- Violence, threats of violence, or inciting others to commit self-harm
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, intentionally spreading misinformation, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Abuse of the reporting process to intentionally harass or exclude others
- Advocating for, or encouraging, any of the above behavior
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
version 2.1, available at
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
129 changes: 99 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,82 @@
# Contributor guidelines
# Open Applied Topology


If you have ideas for improving this project, we would love to hear from you!
Welcome to the OAT community! We're glad you're here.

## Report an issue, bug, or feature request
Users can find a great sense of satisfaction and accomplishment in helping fellow users and/or modifying open source software; that includes

Here are the [steps to creating an issue on github](https://docs.github.com/en/issues/tracking-your-work-with-issues/quickstart). When reporting a bug,
- adding, subtracting, or changing the code
- catching typos and clarifying explanations
- joining discussions
- reporting problems
- and more!

Here's some information to get started.

- [Code of conduct](#code-of-conduct)
- [Get help](#get-help)
- [Project overview](#project-overview)
- [How-to](#general-tips)
- [Report an issue or request a feature](#report-an-issue-or-requiest-a-feature)
- [Contribute new code](#contribute-new-code)
- [Introduction to Rust](#general-tips)
- [Introduction to PyO3](#general-tips)



# Code of conduct

Your safety and well being are the top priorities of the OAT community. The same holds for every one of our users. See the [code of conduct](./CODE_OF_CONDUCT.md) for what that means.

# Get help

If you're stuck or don't know where to begin, then you're in good company -- we've all been there! We're here to help, and we'd love to hear from you:

- open a issue report on Github
- email us at <[email protected]>

# Project overview

- OAT
- A high-performance, low-level software package written in pure Rust
- Registered on `crates.io` as `oat_rust`
- OAT-Python
- Powerful tools for interactive visualization and analysis. Provides Python bindings for `oat_rust` using [pyO3](https://pyo3.rs/).
- Registered on `PyPi` as `oat_python`
- Registered on `crates.io` as `oat_python`
- This package has
- a Rust component, stored in `oat_python/src`, and
- a Python component, stored in `oat_python/oat_python`.
- Tutorials
- Jupyter notebook tutorials, available on colab

These components have the following folder structure

```
tutorials <-- Jupyter notebook tutorials
oat_rust
├── src <-- OAT source code, in Rust
└── developer <-- documents and resources for devlopers
oat_python
├── oat_python <-- OAT-Python source code, in Python
└── src <-- OAT-Python source code, in Rust
```

# How to

The world of open source is wide; it can be a lot to take in! If this is your first time working with an open source project, then welcome! If you're an experienced contributor, then welcome back! Either way, this online resource might help you [get oriented, or bursh up](https://opensource.guide/how-to-contribute/) on the process.

## Report an issue or request a feature

Here are the [steps to creating an issue on github](https://docs.github.com/en/issues/tracking-your-work-with-issues/quickstart)

- search for related issues on Github. You might be able to get answer without the hassle of creating an issue
- describe the current behavior and explain which behavior you expected to see instead and why. At this point you can also tell which alternatives do not work for you.
- (if applicable) provide error messages
- (if applicable) provide a step by step description of the problem; if possible include code that others can use to reproduce it
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
- You may want to [include screenshots and animated GIFs](https://www.cockos.com/licecap/) which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
- provide clear, specific title
- include details on your setup (operating system, python version, etc.)
- use the most recent version of this library and the source language (e.g. Rust); that fixes a lot of problems
Expand All @@ -24,39 +89,43 @@ Here is a [step-by-step guide to writing new code, and submiting it to the proje
The more you know about a software library, the easier it is to get started writing code. The best way to learn about this project is its the documentation! See `README.md` to get started.


## Where can I go for help?

If you're stuck or don't know where to begin, then you're in good company -- we've all been there! We're here to help, and we'd love to hear from you:

- open a issue report on Github
- email us at <[email protected]>

# Contributor code of conduct
# Introduction to Rust

Rust is a low-level programming language with powerful features for scientific computing, e.g. memory safety and helpful error messages. It has been voted [most-loved language](https://insights.stackoverflow.com/survey/2021) by the worldwide developer community since 2015.

* **Installation** The [Rust website](https://www.rust-lang.org/learn/get-started) has directions!

* **Search for what you need in the documentation** All Rust documenation has a consistent format, which you can search in a web browser.
- Lists of objects, functions, etc., appear in two places: either the bottom of a page, or in the menu bar on the left.
- You can also use the search bar at the top to pull up a list of related terms.
- The question mark button to the right of the bar gives other helpful tips (for example, you can search for functions based on their type signature).

* **Save up to 90% coding time, with VS Code** If you are new to Rust, we strongly recommend the [VS Code editor](https://code.visualstudio.com/docs/languages/rust), with the [`rust-analyzer`](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) extension. *Everyone we know uses VS code for Rust development*. It has great features for

- highlighting
- smart debugging messages
- command completion
- bracket coloring; since type parameters are defined with `<>` brackets, it may be useful to add these to your `configuration.json` file, as per this [discussion](https://github.com/microsoft/vscode/issues/132476) and [example](https://github.com/microsoft/vscode/blob/997228d528d687fd17cbf3ba117a0d4f668c1393/extensions/javascript/tags-language-configuration.json#L11)

Our [shared values](https://auth0.com/careers/culture) as software developers guide us in our day-to-day interactions and decision-making. Our open source projects are no exception. Trust, respect, collaboration and transparency are core values we believe should live and breathe within our projects. Our community welcomes participants from around the world with different experiences, unique perspectives, and great ideas to share.

## Our Pledge
* **Debugging** Rust is very good about providing helpful error messages, as a rule.
It is often possible to find help just by copying these messages into a web search.
The OAT developers have also collected a short list of [debugging tips and tricks](crate::developer::rust_debugging), which you may find useful.

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
* **Tips**

## Our Standards
- long type definitions: because OAT is highly modular, its type can become quite verbose. The Rust compiler offers a lot of helpful information about types when running your code, but it abbreviates some types when printing to terminal; note however, that whenever it does this, it also writes a full type description in a file, and prints the file path in the command shell.
- the [`debugit`](https://docs.rs/debugit/latest/debugit/) crate is useful for debugging

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Attempting collaboration before conflict
- Focusing on what is best for the community
- Showing empathy towards other community members
# Introduction to PyO3

Examples of unacceptable behavior by participants include:
PyO3 is a software package to link Rust code with Python. There are three good ways to learn about PyO3 for this project:

- Violence, threats of violence, or inciting others to commit self-harm
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, intentionally spreading misinformation, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Abuse of the reporting process to intentionally harass or exclude others
- Advocating for, or encouraging, any of the above behavior
- Other conduct which could reasonably be considered inappropriate in a professional setting
- [PyO3 homepage](https://pyo3.rs/)
- [PyO3 API](https://docs.rs/pyo3) - this contains slightly different information than the homepage
- the [OAT-Python git respository](https://pyo3.rs/) - many examples that aren't covered in the previous two sources can be found and copy/pasted from the source code!
32 changes: 25 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[package]
name = "oat_python"
version = "0.1.0"
edition = "2018"
version = "0.1.0"
authors = ["Gregory Henselman-Petrusek Roek<[email protected]>"]
edition = "2018"
license-file = "LICENSE.md"
description = "User-friendly tools for applied topology in Python"
homepage = "https://openappliedtopology.github.io"
repository = "https://github.com/OpenAppliedTopology/oat_python"
categories = ["mathematics", "science"]
keywords = ["data", "geometry", "machine learning"]

[lib]
name = "oat_python"
Expand All @@ -12,18 +19,29 @@ name = "oat_python"
# crate-type = ["cdylib", "rlib"]
crate-type = ["cdylib"]

[dependencies.pyo3]
version = "0.15.0"
features = ["extension-module"]
# [dependencies.pyo3]
# version = "0.15.0"
# features = ["extension-module"]

[dependencies]
derive-getters = "0.2.0"
indicatif = "0.17.3"
itertools = "0.10.0"
log = "0.4.14"
num = "0.4.0"
# numpy = "0.14"
# ndarray = ">= 0.13, < 0.16"
ordered-float = "3.4.0"
pyo3-log = "0.5.0"
# pyo3-log = "0.5.0"
# polars = "0.28.0"
# pyo3-polars = "0.2.1"
pyo3 = { version = "0.19.2", features = ["extension-module"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
oat_rust = { path = "../oat_rust" }
oat_rust = { path = "../oat_rust" }
sprs = "0.11.0"



[package.metadata.maturin]
requires = ["maturin", "numpy", "pandas", "matplotlib", "scikit-learn", "plotly", "networkx", "scipy", "nbformat", "kaleido"] # Add your Python dependencies here
34 changes: 1 addition & 33 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
LICENSE
-------------------------------------------------------------------------------

Copyright 2024 Battelle Memorial Institute
Copyright 2023 Battelle Memorial Institute

1. Battelle Memorial Institute (hereinafter Battelle) hereby grants permission to any person or entity lawfully obtaining a copy of this software and associated documentation files (hereinafter “the Software”) to redistribute and use the Software in source and binary forms, with or without modification. Such person or entity may use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and may permit others to do so, subject to the following conditions:
• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
• Other than as used herein, neither the name Battelle Memorial Institute or Battelle may be used in any form whatsoever without the express written consent of Battelle.

2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



ATTRIBUTION
-------------------------------------------------------------------------------

This software is an extension/modification of the oat_rust library developed by a joint collaboration between Princeton University, the University of Delaware, and Macalester College. That library was released under the following open source license.

MIT License

Copyright (c) 2021 The oat_rust Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 8e92e6a

Please sign in to comment.