Skip to content

Commit

Permalink
Add CPU-based rules for dependency choice
Browse files Browse the repository at this point in the history
Fixes #75
  • Loading branch information
light-weaver committed Dec 14, 2023
1 parent 9d03e5d commit b31224c
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 4 deletions.
139 changes: 138 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,142 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot



# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy


# 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
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# NOTE: We should have git ignore poetry.lock as we install different versions of polars.
poetry.lock
site/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# 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/

.DS_Store
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# DESDEO2: restructuring and refactoring of the DESDEO framework
Everything in this repository is currently subject to change. Stay tuned for updates.


## Installation instructions

### Prerequisites
- Python 3.12 or newer
- Poetry (https://python-poetry.org/docs/#installation)

### Getting and running DESDEO
- Clone this repository (`git clone https://github.com/industrial-optimization-group/DESDEO.git`)
- Create a virtual environment for DESDEO (For example, with `python -m venv .venv`)
- Activate the virtual environment (For example, with `source .venv/bin/activate`)
- Install DESDEO with Poetry (`poetry install -E standard` or `poetry install -E legacy`)
- Note that the `standard` extra includes the `polars` dependency which may not work on older CPUs or in an Apple
Silicon environment under Rosseta 2. In this case, use the `legacy` extra instead.
- Run tests? Run Notebooks? Profit?


73 changes: 70 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,85 @@ license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.12"
numpy = "^1.26.2"
scipy = "^1.11.4"
polars-lts-cpu = "^0.19.19"
polars = { version = "^0.19.19", optional = true }
polars-lts-cpu = { version = "^0.19.19", optional = true }

[tool.poetry.extras]
standard = ["polars"]
legacy = ["polars-lts-cpu"]

[tool.poetry.group.dev.dependencies]
ruff = "^0.1.6"
pytest = "^7.4.3"
black = "^23.11.0"
mkdocs = "^1.5.3"


[tool.ruff]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
"E",
"F",
"W",
"C901",
#"D",
"UP",
"S",
"B",
"A",
"C4",
"T20",
"PIE",
#"FIX",
"SIM",
#"TD",
"NPY",
"RUF",
]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = []
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
per-file-ignores = {}

line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.11.
target-version = "py312"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit b31224c

Please sign in to comment.