firecrawl icon indicating copy to clipboard operation
firecrawl copied to clipboard

Python-SDK transitional build setup for pyproject.toml

Open mattjoyce opened this issue 8 months ago • 1 comments

This is a minor change that does two things. Moves the version value, from being hardcoded in setup.py to init.py

Purpose and Benefits:

  • Separation of Concerns: By moving the version number to init.py, we decouple the version information from the build script. This adheres to the principle of separation of concerns, making the codebase cleaner and easier to maintain.
  • Simplified Version Management: With the version information now located in init.py, updating the version number becomes more straightforward. Developers no longer need to edit setup.py when changing the version, reducing the risk of errors and improving maintainability.
  • Consistent Versioning: The version number is now part of the package source code, ensuring that the version is always in sync with the actual code being executed. This consistency is crucial for debugging and tracking changes across different versions of the package.

Introduces the pyproject.toml file to the project. The pyproject.toml file is a standardized configuration file for Python projects that specifies the build system requirements and project metadata.

Purpose and Benefits:

  • Enables Modern Build Commands: By adding pyproject.toml, the project can now be built using the modern python -m build command. This aligns with current best practices in the Python packaging ecosystem.
  • Maintains Compatibility: This change does not impact the utility of the existing setup.py file. Developers who prefer the traditional build process can continue using setup.py without any disruption.
  • Foundation for Automation: The inclusion of pyproject.toml provides a solid foundation for integrating with other build tools and CI/CD automation systems. It ensures that the project is future-proof and can easily adopt new tools and workflows as they become available.

building with python -m build There are a couple of warning, this are simply because setup.py is specifying dependencies and so is pyproject.toml, pyproject.toml takes precedence. The goal would be to transition away from setup.py, by getting it to read the values from the toml file, and pyproject.toml becomes the source of truth.

(firecrawl) W:\firecrawl\apps\python-sdk>python -m build

  • Creating isolated environment: venv+pip...
  • Installing packages in isolated environment:
    • setuptools>=42
    • wheel
  • Getting build dependencies for sdist... C:\Users\Matt\AppData\Local\Temp\build-env-_zktumxu\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:83: SetuptoolsWarning: install_requires overwritten in pyproject.toml (dependencies) corresp(dist, value, root_dir) running egg_info writing firecrawl_py.egg-info\PKG-INFO writing dependency_links to firecrawl_py.egg-info\dependency_links.txt writing requirements to firecrawl_py.egg-info\requires.txt writing top-level names to firecrawl_py.egg-info\top_level.txt reading manifest file 'firecrawl_py.egg-info\SOURCES.txt' writing manifest file 'firecrawl_py.egg-info\SOURCES.txt'
  • Building sdist... C:\Users\Matt\AppData\Local\Temp\build-env-zktumxu\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:83: SetuptoolsWarning: install_requires overwritten in pyproject.toml (dependencies) corresp(dist, value, root_dir) running sdist running egg_info writing firecrawl_py.egg-info\PKG-INFO writing dependency_links to firecrawl_py.egg-info\dependency_links.txt writing requirements to firecrawl_py.egg-info\requires.txt writing top-level names to firecrawl_py.egg-info\top_level.txt reading manifest file 'firecrawl_py.egg-info\SOURCES.txt' writing manifest file 'firecrawl_py.egg-info\SOURCES.txt' running check creating firecrawl_py-0.0.11 creating firecrawl_py-0.0.11\firecrawl creating firecrawl_py-0.0.11\firecrawl_py.egg-info copying files to firecrawl_py-0.0.11... copying README.md -> firecrawl_py-0.0.11 copying pyproject.toml -> firecrawl_py-0.0.11 copying setup.py -> firecrawl_py-0.0.11 copying firecrawl_init.py -> firecrawl_py-0.0.11\firecrawl copying firecrawl\firecrawl.py -> firecrawl_py-0.0.11\firecrawl copying firecrawl_py.egg-info\PKG-INFO -> firecrawl_py-0.0.11\firecrawl_py.egg-info copying firecrawl_py.egg-info\SOURCES.txt -> firecrawl_py-0.0.11\firecrawl_py.egg-info copying firecrawl_py.egg-info\dependency_links.txt -> firecrawl_py-0.0.11\firecrawl_py.egg-info copying firecrawl_py.egg-info\requires.txt -> firecrawl_py-0.0.11\firecrawl_py.egg-info copying firecrawl_py.egg-info\top_level.txt -> firecrawl_py-0.0.11\firecrawl_py.egg-info copying firecrawl_py.egg-info\SOURCES.txt -> firecrawl_py-0.0.11\firecrawl_py.egg-info Writing firecrawl_py-0.0.11\setup.cfg Creating tar archive removing 'firecrawl_py-0.0.11' (and everything under it)
  • Building wheel from sdist
  • Creating isolated environment: venv+pip...
  • Installing packages in isolated environment:
    • setuptools>=42
    • wheel
  • Getting build dependencies for wheel... C:\Users\Matt\AppData\Local\Temp\build-env-jjli1fj8\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:83: SetuptoolsWarning: install_requires overwritten in pyproject.toml (dependencies) corresp(dist, value, root_dir) running egg_info writing firecrawl_py.egg-info\PKG-INFO writing dependency_links to firecrawl_py.egg-info\dependency_links.txt writing requirements to firecrawl_py.egg-info\requires.txt writing top-level names to firecrawl_py.egg-info\top_level.txt reading manifest file 'firecrawl_py.egg-info\SOURCES.txt' writing manifest file 'firecrawl_py.egg-info\SOURCES.txt'
  • Installing packages in isolated environment:
    • wheel
  • Building wheel... C:\Users\Matt\AppData\Local\Temp\build-env-jjli1fj8\Lib\site-packages\setuptools\config_apply_pyprojecttoml.py:83: SetuptoolsWarning: install_requires overwritten in pyproject.toml (dependencies) corresp(dist, value, root_dir) running bdist_wheel running build running build_py creating build creating build\lib creating build\lib\firecrawl copying firecrawl\firecrawl.py -> build\lib\firecrawl copying firecrawl_init_.py -> build\lib\firecrawl running egg_info writing firecrawl_py.egg-info\PKG-INFO writing dependency_links to firecrawl_py.egg-info\dependency_links.txt writing requirements to firecrawl_py.egg-info\requires.txt writing top-level names to firecrawl_py.egg-info\top_level.txt reading manifest file 'firecrawl_py.egg-info\SOURCES.txt' writing manifest file 'firecrawl_py.egg-info\SOURCES.txt' installing to build\bdist.win-amd64\wheel running install running install_lib creating build\bdist.win-amd64 creating build\bdist.win-amd64\wheel creating build\bdist.win-amd64\wheel\firecrawl copying build\lib\firecrawl\firecrawl.py -> build\bdist.win-amd64\wheel.\firecrawl copying build\lib\firecrawl_init_.py -> build\bdist.win-amd64\wheel.\firecrawl running install_egg_info Copying firecrawl_py.egg-info to build\bdist.win-amd64\wheel.\firecrawl_py-0.0.11-py3.11.egg-info running install_scripts creating build\bdist.win-amd64\wheel\firecrawl_py-0.0.11.dist-info\WHEEL creating 'W:\firecrawl\apps\python-sdk\dist.tmp-6wwpg7qe\firecrawl_py-0.0.11-py3-none-any.whl' and adding 'build\bdist.win-amd64\wheel' to it
    adding 'firecrawl/init.py' adding 'firecrawl/firecrawl.py' adding 'firecrawl_py-0.0.11.dist-info/METADATA' adding 'firecrawl_py-0.0.11.dist-info/WHEEL' adding 'firecrawl_py-0.0.11.dist-info/top_level.txt' adding 'firecrawl_py-0.0.11.dist-info/RECORD' removing build\bdist.win-amd64\wheel Successfully built firecrawl_py-0.0.11.tar.gz and firecrawl_py-0.0.11-py3-none-any.whl

mattjoyce avatar May 28 '24 10:05 mattjoyce