{"id":24573,"library":"selfies","title":"SELFIES","description":"SELFIES (SELF-referencIng Embedded Strings) is a general-purpose, sequence-based, robust representation of semantically constrained graphs, primarily used for molecular structures in cheminformatics and ML. Current version 2.2.0, releases every few months.","status":"active","version":"2.2.0","language":"python","source_language":"en","source_url":"https://github.com/aspuru-guzik-group/selfies","tags":["cheminformatics","molecular representation","SMILES","generative chemistry","SELFIES"],"install":[{"cmd":"pip install selfies","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for SMILES/SELFIES conversion and validity checks","package":"rdkit","optional":true}],"imports":[{"note":"No common wrong import; just import the function.","symbol":"encoder","correct":"from selfies import encoder"},{"note":"No common wrong import; just import the function.","symbol":"decoder","correct":"from selfies import decoder"}],"quickstart":{"code":"from selfies import encoder, decoder\n\nsmiles = \"CCO\"  # ethanol\nselfies_str = encoder(smiles)\nprint(selfies_str)  # [C][C][O]\n\nsmiles_back = decoder(selfies_str)\nprint(smiles_back)  # CCO","lang":"python","description":"Basic encode/decode a SMILES string."},"warnings":[{"fix":"Use encoder(smiles, strict=False) to mimic old behavior, or ensure input SMILES are valid.","message":"In v2.0.0, the encoder now defaults to strict=True, raising errors for SMILES violating bond constraints. Previously, invalid SMILES were silently allowed.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade to Python >=3.7.","message":"Support for Python 3.5-3.6 dropped in v2.1.0.","severity":"deprecated","affected_versions":">=2.1.0"}],"env_vars":null,"search_vec":"'2.2.0':33 'base':15 'cheminformat':28,38 'chemistri':43 'constrain':20 'current':31 'embed':6 'everi':35 'general':11 'general-purpos':10 'generat':42 'graph':21 'ml':30 'molecular':25,39 'month':37 'primarili':22 'purpos':12 'referenc':5 'releas':34 'represent':17,40 'robust':16 'self':4 'self-referenc':3 'selfi':1,2,44 'semant':19 'sequenc':14 'sequence-bas':13 'smile':41 'string':7 'structur':26 'use':23 'version':32","created_at":"2026-05-01T08:13:47.688793+00:00","updated_at":"2026-05-01T08:13:47.688793+00:00","problems":[{"fix":"Use from selfies import encoder, decoder directly.","cause":"Wrong import style: trying to access selfies.selfies.","error":"AttributeError: module 'selfies' has no attribute 'selfies'"},{"fix":"Either fix the SMILES or pass strict=False to encoder.","cause":"SMILES violates bond constraints (e.g., hypervalent atoms) and strict=True is default.","error":"RuntimeError: The input SMILES could not be parsed due to semantic constraints."},{"fix":"Upgrade selfies: pip install --upgrade selfies","cause":"Using version <2.0.0 where strict parameter didn't exist.","error":"TypeError: encoder() got an unexpected keyword argument 'strict'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.2.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://selfies.mit.edu","github":"https://github.com/aspuru-guzik-group/selfies","docs":null,"changelog":null,"pypi":"https://pypi.org/project/selfies/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}