Skip to content

Commit

Permalink
Added setup.py, updated gitignore. Fixed deprecation in config.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsch420 committed Oct 24, 2023
1 parent b5aa63d commit b79fa76
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
doc/build
doc/static
.idea
.idea
.pytest_cache
build
dist
src/random_events.egg-info
44 changes: 44 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from setuptools import setup
import os
import codecs

long_description = """Probabilistic Machine Learning frequently requires descriptions of random variables and events
that are shared among many packages.This package provides a common interface for describing random variables and events,
providing usable and easily extensible classes."""


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()


def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


def requirements():
with open('requirements.txt', 'r') as f:
return [_.strip() for _ in f.readlines() if _.strip()]


setup(name='random_events',
version=get_version(os.path.join("src", "random_events", "__init__.py")),
description='Define random events for probabilistic reasoning',
long_description=long_description,
long_description_content_type='text/plain',
author='Tom Schierenbeck',
author_email='[email protected]',
url='https://github.com/tomsch420/random-events',
packages=['random_events'],
install_requires=['setuptools'] + requirements(),
keywords='random events probabilistic machine learning probability theory variables',
project_urls={'Source': 'https://github.com/tomsch420/random-events',
'Documentation': 'TODO'},
python_requires='>=3.6',
package_dir={'': 'src'},)
1 change: 1 addition & 0 deletions src/random_events/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '1.0.0'
3 changes: 1 addition & 2 deletions src/random_events/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class Continuous(Variable):
Class for real valued random variables.
"""

class Config:
arbitrary_types_allowed = True
model_config = pydantic.ConfigDict(arbitrary_types_allowed=True)

domain: portion.Interval = portion.open(-portion.inf, portion.inf)

Expand Down

0 comments on commit b79fa76

Please sign in to comment.