Skip to content

Commit

Permalink
Merge pull request #1 from OmerFI/dev
Browse files Browse the repository at this point in the history
Version 1.0.0
  • Loading branch information
OmerFI authored Sep 26, 2022
2 parents d7f056f + e7ecebe commit a2e1a64
Show file tree
Hide file tree
Showing 24 changed files with 438 additions and 227 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflow/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install build
run: python -m pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflow/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on:
push
pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: python -m pip install tox
- name: Run tests
run: tox
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ share/python-wheels/
*.egg
MANIFEST

# Setuptools-scm
src/pyprobs/_version.py

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
PyProbs is a module that has useful functionality that returns True or False based on the given probability.

[![Version](https://img.shields.io/badge/Version-v0.3-orange)]()
[![Python](https://img.shields.io/badge/Python-v3.0%2B-blue)]()
[![Python](https://img.shields.io/badge/Python-v3.6%2B-blue)]()
[![License](https://img.shields.io/badge/License-MIT-green)]()

## Installation

You can install it from [PyPI](https://pypi.org/project/pyprobs/) by running the following command
You can install it from [PyPI](https://pypi.org/project/pyprobs/) by running the following command:

```
pip install pyprobs
```

Or you can manually execute the **setup.py** from [source](https://github.com/OmerFI/PyProbs)
Or you can install it from [source](https://github.com/OmerFI/PyProbs):

```
python setup.py install
pip install .
```

## Examples

Simple Usage:

```py
>>> from PyProbs import Probability as pr
>>> from pyprobs import Probability as pr
>>> # You can pass float (i.e. 0.5, 0.157), int (i.e. 1, 0) or str (i.e. '50%', '3/11')
>>> pr.Prob(50/100)
>>> pr.prob(50/100)
False
>>> pr.Prob(50/100, num=5)
>>> pr.prob(50/100, num=5)
[False, False, False, True, False]
```

Suggested and More Advanced Usage:

```py
>>> from PyProbs import Probability as pr
>>> from pyprobs import Probability as pr
>>> p = pr()
>>> p.iProb('3/7', 0.25, num=2)
>>> p.iprob('3/7', 0.25, num=2)
[[True, True], [False, False]]

>>> p.history
Expand All @@ -59,18 +59,18 @@ Suggested and More Advanced Usage:

## Functions of The Probability Class

- Prob
- iProb
- prob
- iprob
- set_constant
- get
- clear
- count_values

Note: All of them require creating an instance except the Prob function.
Note: All of them require creating an instance except the `prob` function.

### Requirements

- Python _v3.x_
- Python _v3.6+_

### Documentation

Expand Down
7 changes: 0 additions & 7 deletions docs/PyProbs.rst

This file was deleted.

7 changes: 5 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
copyright = '2021, Ömer Furkan İşleyen'
author = 'Ömer Furkan İşleyen'

from pyprobs import __version__

# The full version, including alpha/beta/rc tags
from PyProbs import __version__
release = __version__
# The short X.Y version.
version = '.'.join(release.split('.')[:2])


# -- General configuration ---------------------------------------------------
Expand All @@ -35,6 +38,7 @@
import sphinx_rtd_theme

extensions = [
"sphinx.ext.napoleon",
"sphinx_rtd_theme",
"sphinx.ext.autodoc",
]
Expand All @@ -54,7 +58,6 @@
# a list of builtin themes.
#

# html_theme = 'alabaster'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down
22 changes: 11 additions & 11 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Welcome to PyProbs's documentation!

PyProbs is a module that has useful functionality that returns True or False based on the given probability.

.. toctree::
:maxdepth: 3
:caption: Contents:

modules

Contents
========

..
Indices and tables
==================
.. TODO: Add Contributing section
.. TODO: Add Changelog section
.. toctree::
:maxdepth: 3

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
PyProbs <self>
src/installation
src/examples
src/api-documentation
src/license
7 changes: 0 additions & 7 deletions docs/modules.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Sphinx==4.1.2
sphinx-rtd-theme==0.5.2
Sphinx>=5.2.1
sphinx-rtd-theme>=1.0.0
6 changes: 6 additions & 0 deletions docs/src/api-documentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API Documentation
=================

.. automodule:: pyprobs
:members:
:undoc-members:
37 changes: 37 additions & 0 deletions docs/src/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Examples
========

Simple usage:

.. code-block:: python
>>> from pyprobs import Probability as pr
>>> # You can pass float (i.e. 0.5, 0.157), int (i.e. 1, 0) or str (i.e. '50%', '3/11')
>>> pr.prob(50/100)
False
>>> pr.prob(50/100, num=5)
[False, False, False, True, False]
Suggested and more advanced usage:

.. code-block:: python
>>> from PyProbs import Probability as pr
>>> p = pr()
>>> p.iProb('3/7', 0.25, num=2)
[[True, True], [False, False]]
>>> p.history
{'3/7': [True, True], 0.25: [False, False]}
>>> p.count_values('all')
{True: 2, False: 2}
>>> p.set_constant(1/1000, mutable=True) # If you set the mutable parameter to False, you won't be able to change the constant again.
>>> # You can get the constant and mutable value:
>>> p.get()
{'constant': 0.001, 'mutable': True}
>>> # Also you can use it like "p.get(how='constant')" or "p.get(how='mutable')", this only returns the desired value.
>>> p._constant # You can more easily get the constant value.
0.001
18 changes: 18 additions & 0 deletions docs/src/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Installation
============

You can install it from PyPI_::

pip install pyprobs
Or you can install it from source_::

pip install .

Requirements
~~~~~~~~~~~~

* Python 3.6+

.. _pypi: https://pypi.org/project/pyprobs
.. _source: https://github.com/OmerFI/PyProbs
24 changes: 24 additions & 0 deletions docs/src/license.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
License
=======

MIT License

Copyright (c) 2021 OmerFI

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.
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/pyprobs/_version.py"
54 changes: 54 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[metadata]
name = pyprobs
description = A module that returns True or False output based on given probability
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/OmerFI/PyProbs
author = Ömer Furkan İşleyen
author_email = [email protected]
license = MIT
license_files = LICENSE
platforms = any
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: Libraries
Topic :: Utilities
keywords = probability, chance
project_urls =
Source=https://github.com/OmerFI/PyProbs
Documentation=https://pyprobs.readthedocs.io
Bug Tracker=https://github.com/OmerFI/PyProbs/issues

[options]
packages = find:
python_requires = >=3.6
package_dir =
=src
zip_safe = False

[options.packages.find]
where = src

[options.extras_require]
testing =
pytest>=7.1.3
tox>=3.26.0
docs =
Sphinx>=5.2.1
sphinx-rtd-theme>=1.0.0

# TODO: Add extra requirements for linting, docs, etc. as needed
Loading

0 comments on commit a2e1a64

Please sign in to comment.