diff --git a/README.rst b/README.rst index 1a88a34..5b3908a 100644 --- a/README.rst +++ b/README.rst @@ -97,8 +97,8 @@ modify existing files seamlessly. Installation ************** -At present, we recommend installing Codescribe in a virtual -environment: +Codescribe uses ``pyproject.toml`` to declare its build system and +dependencies. We recommend installing in a virtual environment: .. code:: bash @@ -106,12 +106,19 @@ environment: source env/bin/activate pip install --upgrade pip -And install Codescribe using ``pip`` in editable mode: +Install Codescribe and its core dependencies using ``pip`` in editable +mode: .. code:: bash pip install -e . +To also install the optional Hugging Face / Transformers backend: + +.. code:: bash + + pip install -e ".[transformers]" + Editable mode enables testing of features/updates directly from the source code and is an effective method for debugging. @@ -377,12 +384,6 @@ with a message similar to: export OPENAI_API_KEY="your_openai_api_key_here" - And install the OpenAI library: - - .. code:: bash - - pip install openai - #. **Anthropic Models**: Codescribe supports Anthropic's Claude models (such as ``claude-opus-4-8``, ``claude-sonnet-4-6``, ``claude-haiku-4-5``, etc.) via the Anthropic API. The @@ -398,12 +399,6 @@ with a message similar to: export ANTHROPIC_API_KEY="your_anthropic_api_key_here" - And install the Anthropic library: - - .. code:: bash - - pip install anthropic - Optionally set ``ANTHROPIC_BASE_URL`` to redirect requests to a compatible proxy or private endpoint. @@ -460,11 +455,12 @@ with a message similar to: Face / Transformers checkpoint by passing its path as the model argument. Codescribe supports this through the ``TFModel`` backend. - To use a Hugging Face model, first install the necessary libraries: + To use a Hugging Face model, first install the optional + ``transformers`` extra: .. code:: bash - pip install transformers torch + pip install -e ".[transformers]" Then specify the path to the pre-trained model using the ``-m`` flag. For example, to use a GPT-2 model: diff --git a/requirements/agentic.dev b/dep/agentic.txt.dev similarity index 100% rename from requirements/agentic.dev rename to dep/agentic.txt.dev diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c02b112 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "Codescribe" +version = "2026.dev" +authors = [{ name = "Codescribe Contributors" }] +description = "Coding Agent and Translation Utility" +license = { text = "Apache 2.0" } +readme = "README.rst" +classifiers = [ + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: Apache Software License", +] +dependencies = [ + "click", + "requests", + "toml", + "pyyaml", + "alive-progress==3.1.4", + "openai", + "anthropic", +] + +[project.optional-dependencies] +transformers = ["torch", "transformers"] + +[project.scripts] +code-scribe = "codescribe.cli:code_scribe" + +[tool.setuptools.packages.find] +where = ["."] diff --git a/requirements/core.txt b/requirements/core.txt deleted file mode 100644 index 01b5423..0000000 --- a/requirements/core.txt +++ /dev/null @@ -1,7 +0,0 @@ -click -requests -toml -pyyaml -alive-progress==3.1.4 -openai -anthropic diff --git a/requirements/transformers.txt b/requirements/transformers.txt deleted file mode 100644 index 4f492dd..0000000 --- a/requirements/transformers.txt +++ /dev/null @@ -1,2 +0,0 @@ -torch -transformers diff --git a/setup b/setup deleted file mode 100755 index 55a4f44..0000000 --- a/setup +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 - -"""Setup CLI script""" - -import subprocess -import click - - -@click.group(name="setup") -def setup(): - """Setup toolkit for CodeScribe""" - - -@setup.command(name="develop") -def develop(): - """Development mode""" - subprocess.run("python3 setup.py develop --user", shell=True, check=True) - subprocess.run("cp code_scribe/code-scribe $HOME/.local/bin", shell=True, check=True) - - -@setup.command(name="install") -def install(): - """Installation command""" - subprocess.run("python3 setup.py develop --user", shell=True, check=True) - subprocess.run("python3 setup.py build", shell=True, check=True) - subprocess.run("python3 setup.py install --user", shell=True, check=True) - subprocess.run("cp code_scribe/code-scribe $HOME/.local/bin", shell=True, check=True) - - -@setup.command(name="publish") -def publish(): - """Publish PyPi package""" - subprocess.run("python3 setup.py sdist", shell=True, check=True) - subprocess.run("twine upload --verbose dist/*", shell=True, check=True) - - -@setup.command(name="clean") -def clean(): - """Clean installation artifacts""" - subprocess.run("rm -rf *.egg-info build dist", shell=True, check=True) - -if __name__ == "__main__": - setup() diff --git a/setup.py b/setup.py deleted file mode 100644 index 3edce56..0000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Build and installation script for CodeScribe.""" - -# standard libraries -import re -from setuptools import setup, find_packages - -# get long description from README -with open("README.rst", mode="r") as readme: - long_description = readme.read() - -with open("codescribe/__meta__.py", mode="r") as source: - content = source.read().strip() - metadata = { - key: re.search(key + r'\s*=\s*[\'"]([^\'"]*)[\'"]', content).group(1) - for key in [ - "__pkgname__", - "__version__", - "__authors__", - "__license__", - "__description__", - ] - } - -# core dependencies - click, docker, singularity -DEPENDENCIES = [] - -with open("requirements/core.txt", mode="r", encoding="ascii") as core_reqs: - DEPENDENCIES = core_reqs.read() - - -setup( - name=metadata["__pkgname__"], - version=metadata["__version__"], - author=metadata["__authors__"], - description=metadata["__description__"], - license=metadata["__license__"], - packages=find_packages(where="./"), - package_dir={"": "./"}, - #package_data={ - # "": [ - # "resources/Dockerfile.base", - # "resources/Dockerfile.root", - # "resources/Dockerfile.user", - # ] - #}, - entry_points={"console_scripts": ["code-scribe=codescribe.cli:code_scribe"]}, - include_package_data=True, - long_description=long_description, - classifiers=[ - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: Apache Software License", - ], - install_requires=DEPENDENCIES, -)