diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..179dfba --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# Editor Configuration (http://editorconfig.org) +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 88 + +[*.{json,yml,yaml}] +indent_size = 2 + +[*.{md,rst}] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore index 82f9275..b90ccff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,87 @@ +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### JupyterNotebooks template +# gitignore template for Jupyter Notebooks +# website: http://jupyter.org/ + +.ipynb_checkpoints +*/.ipynb_checkpoints/* + +# IPython +profile_default/ +ipython_config.py + +# Remove previous ipynb_checkpoints +# git rm -r .ipynb_checkpoints/ + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -70,17 +154,15 @@ instance/ # Sphinx documentation docs/_build/ +docs/api # PyBuilder .pybuilder/ target/ # Jupyter Notebook -.ipynb_checkpoints # IPython -profile_default/ -ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is @@ -106,10 +188,8 @@ ipython_config.py #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. -# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +# https://pdm.fming.dev/#use-with-ide .pdm.toml -.pdm-python -.pdm-build/ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ @@ -160,3 +240,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +# Hatch-VCS +_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..18f0463 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +repos: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c8f40ae --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +- Upcoming features and fixes + +## [0.1.0] - (1979-01-01) + +- First release diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..a77211d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,130 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible 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. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +[//]: # (TODO: You need to choose whom and how to contact them.) + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +\[INSERT CONTACT METHOD\]. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..81b5d11 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,108 @@ +# Contributing + +Contributions are welcome, and they are greatly appreciated! Every little bit +helps, and credit will always be given. + +## Example Contributions + +You can contribute in many ways, for example: + +* [Report bugs](#report-bugs) +* [Fix Bugs](#fix-bugs) +* [Implement Features](#implement-features) +* [Write Documentation](#write-documentation) +* [Submit Feedback](#submit-feedback) + +### Report Bugs + +Report bugs at https://github.com//supernormal/issues. + +**If you are reporting a bug, please follow the template guidelines. The more +detailed your report, the easier and thus faster we can help you.** + +### Fix Bugs + +Look through the GitHub issues for bugs. Anything labelled with `bug` and +`help wanted` is open to whoever wants to implement it. When you decide to work on such +an issue, please assign yourself to it and add a comment that you'll be working on that, +too. If you see another issue without the `help wanted` label, just post a comment, the +maintainers are usually happy for any support that they can get. + +### Implement Features + +Look through the GitHub issues for features. Anything labelled with +`enhancement` and `help wanted` is open to whoever wants to implement it. As +for [fixing bugs](#fix-bugs), please assign yourself to the issue and add a comment that +you'll be working on that, too. If another enhancement catches your fancy, but it +doesn't have the `help wanted` label, just post a comment, the maintainers are usually +happy for any support that they can get. + +### Write Documentation + +superNormal could always use more documentation, whether as +part of the official documentation, in docstrings, or even on the web in blog +posts, articles, and such. Just [open an issue](https://github.com// +supernormal/issues) to let us know what you will be working on +so that we can provide you with guidance. + +### Submit Feedback + +The best way to send feedback is to file an issue at https://github.com/ +/supernormal/issues. If your feedback fits the format of one of +the issue templates, please use that. Remember that this is a volunteer-driven +project and everybody has limited time. + +## Get Started! + +Ready to contribute? Here's how to set up superNormal for +local development. + +1. Fork the https://github.com//supernormal + repository on GitHub. +2. Clone your fork locally + + ```shell + git clone git@github.com:your_name_here/supernormal.git + ``` + +3. [Install hatch](https://hatch.pypa.io/latest/install/). + +4. Create a branch for local development using the default branch (typically `main`) + as a starting + point. Use `fix` or `feat` as a prefix for your branch name. + + ```shell + git checkout main + git checkout -b fix-name-of-your-bugfix + ``` + + Now you can make your changes locally. + +5. When you're done making changes, apply the quality assurance tools and check + that your changes pass our test suite. This is all included with tox + + ```shell + hatch run test:run + ``` + +6. Commit your changes and push your branch to GitHub. Please use [semantic + commit messages](https://www.conventionalcommits.org/). + + ```shell + git add . + git commit -m "fix: summarize your changes" + git push -u origin fix-name-of-your-bugfix + ``` + +7. Open the link displayed in the message when pushing your new branch in order + to submit a pull request. + +### Pull Request Guidelines + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. +2. If the pull request adds functionality, the docs should be updated. Put your + new functionality into a function with a docstring. +3. Your pull request will automatically be checked by the full test suite. + It needs to pass all of them before it can be considered for merging. diff --git a/LICENSE b/LICENSE index c6420e7..b3d61d0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,28 +1,21 @@ -BSD 3-Clause License +MIT License -Copyright (c) 2024, pyOpenSci +Copyright (c) 2024 pyOpenSci -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +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: -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. -2. 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. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -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 THE COPYRIGHT HOLDER 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. +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. diff --git a/README.md b/README.md index 9b8eab5..476ee55 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,15 @@ -# 2024 pyOpenSci Fall Festival: Create Your First Python Package +# superNormal -This repo is set up for the pyOpenSci 2024 Open Science Festival. Create a Python Package & share your code workshops. +| | | +|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Package | [![Latest PyPI Version](https://img.shields.io/pypi/v/supernormal.svg)](https://pypi.org/project/supernormal/) [![Supported Python Versions](https://img.shields.io/pypi/pyversions/supernormal.svg)](https://pypi.org/project/supernormal/) [![Documentation](https://readthedocs.org/projects/supernormal/badge/?version=latest)](https://supernormal.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14019657.svg)](https://doi.org/10.5281/zenodo.14019656) | +| Meta | [![MIT](https://img.shields.io/pypi/l/supernormal.svg)](LICENSE) [![Code of Conduct](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](.github/CODE_OF_CONDUCT.md) [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/) [![Code Style Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Linting: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) | +| Automation | | -[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/pyOpenSci/ff-2024-create-python-package) +_a package that crunches numbers_ -## Create a new package using copier +## Copyright -`copier copy gh:pyopensci/pyos-package-template .` +- Copyright © 2024 pyOpenSci. +- Free software distributed under the [MIT License](./LICENSE). -## Create a new codespace - -1. Click on badge above **Open in GitHub Codespaces**. - -2. Select **Create new codespace**. - - create-codespace diff --git a/TESTS/test numberCruncher.py b/TESTS/test numberCruncher.py new file mode 100644 index 0000000..8b2f106 --- /dev/null +++ b/TESTS/test numberCruncher.py @@ -0,0 +1,8 @@ +"""TEST to check module numberCruncher""" + +from supernormal.numberCruncher import crunch + + +def testCrucher(): + """test output of the crunch""" + assert crunch(1, 2) == 3 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3cdfbfe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,90 @@ +################################################################################ +# Build Configuration +################################################################################ + +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + +################################################################################ +# Project Configuration +################################################################################ + +[project] +name = "supernormal" + +version = "0.1.2" + +description = "a package that crunches numbers" +authors = [ + { name = "0FAUXS", email = "msdslumin@gmail.com" }, +] +license = "MIT" +readme = {"file" = "README.md", "content-type" = "text/markdown"} + +# Please consult https://pypi.org/classifiers/ for a full list. +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Scientific/Engineering", +] +# TODO: add keywords +keywords = [] +# TODO: add dependencies +dependencies = [] + +[project.urls] +Documentation = "https://supernormal.readthedocs.io" +Download = "https://pypi.org/project/supernormal/#files" + +[project.optional-dependencies] +dev = [ + "hatch", + "pre-commit", +] + +################################################################################ +# Tool Configuration +################################################################################ + +[tool.hatch.build] +only-packages = true + +[tool.hatch.build.targets.wheel] +packages = ["src/supernormal"] + +# Create Hatch environment +[tool.hatch.envs.test] +description = """Environment that runs the test suite""" +extra-dependencies = [ + "pytest", + "pytest-cov", +] + +[[tool.hatch.envs.test.matrix]] +python = ["5.4.0","3.9","3.10", "3.11"] + +[tool.hatch.envs.test.scripts] +run_test = "pytest TESTS {args:--cov=supernormal --cov-report=term-missing}" + + +[tool.hatch.envs.format] +description = """Environment that runs the code formatters.""" +extra-dependencies = [ + "black", + "isort", +] + +[tool.hatch.envs.format.scripts] +format_code = [ + "isort .", + "black ." +] \ No newline at end of file diff --git a/src/supernormal/__init__.py b/src/supernormal/__init__.py new file mode 100644 index 0000000..86b5127 --- /dev/null +++ b/src/supernormal/__init__.py @@ -0,0 +1,25 @@ +# MIT License +# +# Copyright (c) 2024 pyOpenSci +# +# 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 (including the next +# paragraph) 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. + + +"""Provide top level symbols.""" diff --git a/src/supernormal/numberCruncher.py b/src/supernormal/numberCruncher.py new file mode 100644 index 0000000..384e641 --- /dev/null +++ b/src/supernormal/numberCruncher.py @@ -0,0 +1,16 @@ +"""A module that processes numbers""" + + +def crunch(x, y): + """A function to do fancy math + + Parameters + ---------- + x : int + add first + y : int + add second + Returns + summation + """ + return x + y, x * y, x**y