@devries-cameron20 / composio-1 / commits / 5f683250f
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

add python sdk ref generator

balyan.sid@gmail.com committed Jun 18, 2025 at 00:18 UTC 5f683250f47e5f343a3067b706a43a4c368dbfc4
19 files changed +3317 -667
.gitignore
+1 -1
@@ -50,7 +50,7 @@ fern/docs/sdk/
50 __pycache__/
51 *.py[cod]
52 *.pyo
53 -
53 +*.egg-info/
54
55 # wrangler
56 .wrangler
fern/docs.yml
+611 -606
@@ -254,614 +254,619 @@ navigation:
254 contents:
255 - page: Introduction
256 path: tools/introduction.mdx
257 - # - page: Ably
258 - # path: tools/ably.mdx
259 - # - page: Accelo
260 - # path: tools/accelo.mdx
261 - # - page: Acculynx
262 - # path: tools/acculynx.mdx
263 - # - page: Active Campaign
264 - # path: tools/active_campaign.mdx
265 - # - page: Adobe
266 - # path: tools/adobe.mdx
267 - # - page: Aero Workflow
268 - # path: tools/aero_workflow.mdx
269 - # - page: Affinity
270 - # path: tools/affinity.mdx
271 - # - page: Agencyzoom
272 - # path: tools/agencyzoom.mdx
273 - # - page: Ahrefs
274 - # path: tools/ahrefs.mdx
275 - # - page: Airtable
276 - # path: tools/airtable.mdx
277 - # - page: Alchemy
278 - # path: tools/alchemy.mdx
279 - # - page: Altoviz
280 - # path: tools/altoviz.mdx
281 - # - page: Amazon
282 - # path: tools/amazon.mdx
283 - # - page: Amcards
284 - # path: tools/amcards.mdx
285 - # - page: Amplitude
286 - # path: tools/amplitude.mdx
287 - # - page: Apaleo
288 - # path: tools/apaleo.mdx
289 - # - page: Apollo
290 - # path: tools/apollo.mdx
291 - # - page: Appdrag
292 - # path: tools/appdrag.mdx
293 - # - page: Appsflyer
294 - # path: tools/appsflyer.mdx
295 - # - page: Asana
296 - # path: tools/asana.mdx
297 - # - page: Ashby
298 - # path: tools/ashby.mdx
299 - # - page: Atlassian
300 - # path: tools/atlassian.mdx
301 - # - page: Attio
302 - # path: tools/attio.mdx
303 - # - page: Auth0
304 - # path: tools/auth0.mdx
305 - # - page: Axonaut
306 - # path: tools/axonaut.mdx
307 - # - page: Bamboohr
308 - # path: tools/bamboohr.mdx
309 - # - page: Bannerbear
310 - # path: tools/bannerbear.mdx
311 - # - page: Baserow
312 - # path: tools/baserow.mdx
313 - # - page: Battlenet
314 - # path: tools/battlenet.mdx
315 - # - page: Beeminder
316 - # path: tools/beeminder.mdx
317 - # - page: Bigmailer
318 - # path: tools/bigmailer.mdx
319 - # - page: Bitbucket
320 - # path: tools/bitbucket.mdx
321 - # - page: Bitwarden
322 - # path: tools/bitwarden.mdx
323 - # - page: Blackbaud
324 - # path: tools/blackbaud.mdx
325 - # - page: Blackboard
326 - # path: tools/blackboard.mdx
327 - # - page: Boldsign
328 - # path: tools/boldsign.mdx
329 - # - page: Bolna
330 - # path: tools/bolna.mdx
331 - # - page: Borneo
332 - # path: tools/borneo.mdx
333 - # - page: Botbaba
334 - # path: tools/botbaba.mdx
335 - # - page: Box
336 - # path: tools/box.mdx
337 - # - page: Braintree
338 - # path: tools/braintree.mdx
339 - # - page: Brandfetch
340 - # path: tools/brandfetch.mdx
341 - # - page: Breezy Hr
342 - # path: tools/breezy_hr.mdx
343 - # - page: Brevo
344 - # path: tools/brevo.mdx
345 - # - page: Brex
346 - # path: tools/brex.mdx
347 - # - page: Brex Staging
348 - # path: tools/brex_staging.mdx
349 - # - page: Brightpearl
350 - # path: tools/brightpearl.mdx
351 - # - page: Brilliant Directories
352 - # path: tools/brilliant_directories.mdx
353 - # - page: Browseai
354 - # path: tools/browseai.mdx
355 - # - page: Browserbase Tool
356 - # path: tools/browserbase_tool.mdx
357 - # - page: Browserhub
358 - # path: tools/browserhub.mdx
359 - # - page: Browserless
360 - # path: tools/browserless.mdx
361 - # - page: Bubble
362 - # path: tools/bubble.mdx
363 - # - page: Bugbug
364 - # path: tools/bugbug.mdx
365 - # - page: Cal
366 - # path: tools/cal.mdx
367 - # - page: Calendly
368 - # path: tools/calendly.mdx
369 - # - page: Canva
370 - # path: tools/canva.mdx
371 - # - page: Canvas
372 - # path: tools/canvas.mdx
373 - # - page: Chatwork
374 - # path: tools/chatwork.mdx
375 - # - page: Chmeetings
376 - # path: tools/chmeetings.mdx
377 - # - page: Clickup
378 - # path: tools/clickup.mdx
379 - # - page: Clockify
380 - # path: tools/clockify.mdx
381 - # - page: Close
382 - # path: tools/close.mdx
383 - # - page: Cloudflare
384 - # path: tools/cloudflare.mdx
385 - # - page: Coda
386 - # path: tools/coda.mdx
387 - # - page: Codeinterpreter
388 - # path: tools/codeinterpreter.mdx
389 - # - page: Coinbase
390 - # path: tools/coinbase.mdx
391 - # - page: Coinmarketcal
392 - # path: tools/coinmarketcal.mdx
393 - # - page: Composio
394 - # path: tools/composio.mdx
395 - # - page: Composio Search
396 - # path: tools/composio_search.mdx
397 - # - page: Confluence
398 - # path: tools/confluence.mdx
399 - # - page: Contentful
400 - # path: tools/contentful.mdx
401 - # - page: Crustdata
402 - # path: tools/crustdata.mdx
403 - # - page: Customer Io
404 - # path: tools/customer_io.mdx
405 - # - page: Cutt Ly
406 - # path: tools/cutt_ly.mdx
407 - # - page: D2Lbrightspace
408 - # path: tools/d2lbrightspace.mdx
409 - # - page: Dailybot
410 - # path: tools/dailybot.mdx
411 - # - page: Datadog
412 - # path: tools/datadog.mdx
413 - # - page: Datagma
414 - # path: tools/datagma.mdx
415 - # - page: Datarobot
416 - # path: tools/datarobot.mdx
417 - # - page: Deel
418 - # path: tools/deel.mdx
419 - # - page: Demio
420 - # path: tools/demio.mdx
421 - # - page: Dialpad
422 - # path: tools/dialpad.mdx
423 - # - page: Digicert
424 - # path: tools/digicert.mdx
425 - # - page: Discord
426 - # path: tools/discord.mdx
427 - # - page: Discordbot
428 - # path: tools/discordbot.mdx
429 - # - page: Docmosis
430 - # path: tools/docmosis.mdx
431 - # - page: Docusign
432 - # path: tools/docusign.mdx
433 - # - page: Dropbox
434 - # path: tools/dropbox.mdx
435 - # - page: Dropbox Sign
436 - # path: tools/dropbox_sign.mdx
437 - # - page: Dynamics365
438 - # path: tools/dynamics365.mdx
439 - # - page: Echtpost
440 - # path: tools/echtpost.mdx
441 - # - page: Elevenlabs
442 - # path: tools/elevenlabs.mdx
443 - # - page: Emailoctopus
444 - # path: tools/emailoctopus.mdx
445 - # - page: Enigma
446 - # path: tools/enigma.mdx
447 - # - page: Entelligence
448 - # path: tools/entelligence.mdx
449 - # - page: Epic Games
450 - # path: tools/epic_games.mdx
451 - # - page: Eventbrite
452 - # path: tools/eventbrite.mdx
453 - # - page: Exa
454 - # path: tools/exa.mdx
455 - # - page: Excel
456 - # path: tools/excel.mdx
457 - # - page: Exist
458 - # path: tools/exist.mdx
459 - # - page: Facebook
460 - # path: tools/facebook.mdx
461 - # - page: Factorial
462 - # path: tools/factorial.mdx
463 - # - page: Figma
464 - # path: tools/figma.mdx
465 - # - page: Finage
466 - # path: tools/finage.mdx
467 - # - page: Firecrawl
468 - # path: tools/firecrawl.mdx
469 - # - page: Fireflies
470 - # path: tools/fireflies.mdx
471 - # - page: Fitbit
472 - # path: tools/fitbit.mdx
473 - # - page: Flutterwave
474 - # path: tools/flutterwave.mdx
475 - # - page: Fomo
476 - # path: tools/fomo.mdx
477 - # - page: Formcarry
478 - # path: tools/formcarry.mdx
479 - # - page: Formsite
480 - # path: tools/formsite.mdx
481 - # - page: Foursquare
482 - # path: tools/foursquare.mdx
483 - # - page: Freshbooks
484 - # path: tools/freshbooks.mdx
485 - # - page: Freshdesk
486 - # path: tools/freshdesk.mdx
487 - # - page: Front
488 - # path: tools/front.mdx
489 - # - page: Github
490 - # path: tools/github.mdx
491 - # - page: Gmail
492 - # path: tools/gmail.mdx
493 - # - page: Go To Webinar
494 - # path: tools/go_to_webinar.mdx
495 - # - page: Gong
496 - # path: tools/gong.mdx
497 - # - page: Google Analytics
498 - # path: tools/google_analytics.mdx
499 - # - page: Google Maps
500 - # path: tools/google_maps.mdx
501 - # - page: Googleads
502 - # path: tools/googleads.mdx
503 - # - page: Googlebigquery
504 - # path: tools/googlebigquery.mdx
505 - # - page: Googlecalendar
506 - # path: tools/googlecalendar.mdx
507 - # - page: Googledocs
508 - # path: tools/googledocs.mdx
509 - # - page: Googledrive
510 - # path: tools/googledrive.mdx
511 - # - page: Googlemeet
512 - # path: tools/googlemeet.mdx
513 - # - page: Googlephotos
514 - # path: tools/googlephotos.mdx
515 - # - page: Googlesheets
516 - # path: tools/googlesheets.mdx
517 - # - page: Googleslides
518 - # path: tools/googleslides.mdx
519 - # - page: Googlesuper
520 - # path: tools/googlesuper.mdx
521 - # - page: Googletasks
522 - # path: tools/googletasks.mdx
523 - # - page: Gorgias
524 - # path: tools/gorgias.mdx
525 - # - page: Gumroad
526 - # path: tools/gumroad.mdx
527 - # - page: Guru
528 - # path: tools/guru.mdx
529 - # - page: Hackernews
530 - # path: tools/hackernews.mdx
531 - # - page: Hackerrank Work
532 - # path: tools/hackerrank_work.mdx
533 - # - page: Harvest
534 - # path: tools/harvest.mdx
535 - # - page: Helcim
536 - # path: tools/helcim.mdx
537 - # - page: Heygen
538 - # path: tools/heygen.mdx
539 - # - page: Highlevel
540 - # path: tools/highlevel.mdx
541 - # - page: Hubspot
542 - # path: tools/hubspot.mdx
543 - # - page: Humanloop
544 - # path: tools/humanloop.mdx
545 - # - page: Icims Talent Cloud
546 - # path: tools/icims_talent_cloud.mdx
547 - # - page: Idea Scale
548 - # path: tools/idea_scale.mdx
549 - # - page: Intercom
550 - # path: tools/intercom.mdx
551 - # - page: Interzoid
552 - # path: tools/interzoid.mdx
553 - # - page: Jira
554 - # path: tools/jira.mdx
555 - # - page: Junglescout
556 - # path: tools/junglescout.mdx
557 - # - page: Keap
558 - # path: tools/keap.mdx
559 - # - page: Klaviyo
560 - # path: tools/klaviyo.mdx
561 - # - page: Klipfolio
562 - # path: tools/klipfolio.mdx
563 - # - page: Kommo
564 - # path: tools/kommo.mdx
565 - # - page: Lastpass
566 - # path: tools/lastpass.mdx
567 - # - page: Launch Darkly
568 - # path: tools/launch_darkly.mdx
569 - # - page: Leadfeeder
570 - # path: tools/leadfeeder.mdx
571 - # - page: Leadoku
572 - # path: tools/leadoku.mdx
573 - # - page: Lever
574 - # path: tools/lever.mdx
575 - # - page: Lever Sandbox
576 - # path: tools/lever_sandbox.mdx
577 - # - page: Lexoffice
578 - # path: tools/lexoffice.mdx
579 - # - page: Linear
580 - # path: tools/linear.mdx
581 - # - page: Linkedin
582 - # path: tools/linkedin.mdx
583 - # - page: Linkhut
584 - # path: tools/linkhut.mdx
585 - # - page: Linkup
586 - # path: tools/linkup.mdx
587 - # - page: Listennotes
588 - # path: tools/listennotes.mdx
589 - # - page: Lmnt
590 - # path: tools/lmnt.mdx
591 - # - page: Lodgify
592 - # path: tools/lodgify.mdx
593 - # - page: Mailchimp
594 - # path: tools/mailchimp.mdx
595 - # - page: Mailerlite
596 - # path: tools/mailerlite.mdx
597 - # - page: Maintainx
598 - # path: tools/maintainx.mdx
599 - # - page: Mboum
600 - # path: tools/mboum.mdx
601 - # - page: Mem0
602 - # path: tools/mem0.mdx
603 - # - page: Metaads
604 - # path: tools/metaads.mdx
605 - # - page: Metatextai
606 - # path: tools/metatextai.mdx
607 - # - page: Microsoft Clarity
608 - # path: tools/microsoft_clarity.mdx
609 - # - page: Microsoft Teams
610 - # path: tools/microsoft_teams.mdx
611 - # - page: Microsoft Tenant
612 - # path: tools/microsoft_tenant.mdx
613 - # - page: Miro
614 - # path: tools/miro.mdx
615 - # - page: Mixpanel
616 - # path: tools/mixpanel.mdx
617 - # - page: Mocean
618 - # path: tools/mocean.mdx
619 - # - page: Monday
620 - # path: tools/monday.mdx
621 - # - page: Mopinion
622 - # path: tools/mopinion.mdx
623 - # - page: More Trees
624 - # path: tools/more_trees.mdx
625 - # - page: Moxie
626 - # path: tools/moxie.mdx
627 - # - page: Moz
628 - # path: tools/moz.mdx
629 - # - page: Mural
630 - # path: tools/mural.mdx
631 - # - page: Ncscale
632 - # path: tools/ncscale.mdx
633 - # - page: Neon
634 - # path: tools/neon.mdx
635 - # - page: Netsuite
636 - # path: tools/netsuite.mdx
637 - # - page: Nextdns
638 - # path: tools/nextdns.mdx
639 - # - page: Ngrok
640 - # path: tools/ngrok.mdx
641 - # - page: Notion
642 - # path: tools/notion.mdx
643 - # - page: Oncehub
644 - # path: tools/oncehub.mdx
645 - # - page: One Drive
646 - # path: tools/one_drive.mdx
647 - # - page: Onepage
648 - # path: tools/onepage.mdx
649 - # - page: Open Sea
650 - # path: tools/open_sea.mdx
651 - # - page: Outlook
652 - # path: tools/outlook.mdx
653 - # - page: Pagerduty
654 - # path: tools/pagerduty.mdx
655 - # - page: Pandadoc
656 - # path: tools/pandadoc.mdx
657 - # - page: Peopledatalabs
658 - # path: tools/peopledatalabs.mdx
659 - # - page: Perplexityai
660 - # path: tools/perplexityai.mdx
661 - # - page: Piggy
662 - # path: tools/piggy.mdx
663 - # - page: Pipedrive
664 - # path: tools/pipedrive.mdx
665 - # - page: Placekey
666 - # path: tools/placekey.mdx
667 - # - page: Posthog
668 - # path: tools/posthog.mdx
669 - # - page: Precoro
670 - # path: tools/precoro.mdx
671 - # - page: Printnode
672 - # path: tools/printnode.mdx
673 - # - page: Process Street
674 - # path: tools/process_street.mdx
675 - # - page: Productboard
676 - # path: tools/productboard.mdx
677 - # - page: Qualaroo
678 - # path: tools/qualaroo.mdx
679 - # - page: Quickbooks
680 - # path: tools/quickbooks.mdx
681 - # - page: Rafflys
682 - # path: tools/rafflys.mdx
683 - # - page: Ragic
684 - # path: tools/ragic.mdx
685 - # - page: Ramp
686 - # path: tools/ramp.mdx
687 - # - page: Ravenseotools
688 - # path: tools/ravenseotools.mdx
689 - # - page: Recallai
690 - # path: tools/recallai.mdx
691 - # - page: Reddit
692 - # path: tools/reddit.mdx
693 - # - page: Resend
694 - # path: tools/resend.mdx
695 - # - page: Retellai
696 - # path: tools/retellai.mdx
697 - # - page: Ring Central
698 - # path: tools/ring_central.mdx
699 - # - page: Rippling
700 - # path: tools/rippling.mdx
701 - # - page: Rocket Reach
702 - # path: tools/rocket_reach.mdx
703 - # - page: Rocketlane
704 - # path: tools/rocketlane.mdx
705 - # - page: Rootly
706 - # path: tools/rootly.mdx
707 - # - page: Rosette Text Analytics
708 - # path: tools/rosette_text_analytics.mdx
709 - # - page: Sage
710 - # path: tools/sage.mdx
711 - # - page: Salesforce
712 - # path: tools/salesforce.mdx
713 - # - page: Scrape Do
714 - # path: tools/scrape_do.mdx
715 - # - page: Scrapingant
716 - # path: tools/scrapingant.mdx
717 - # - page: Screenshotone
718 - # path: tools/screenshotone.mdx
719 - # - page: Seismic
720 - # path: tools/seismic.mdx
721 - # - page: Semanticscholar
722 - # path: tools/semanticscholar.mdx
723 - # - page: Semrush
724 - # path: tools/semrush.mdx
725 - # - page: Sendgrid
726 - # path: tools/sendgrid.mdx
727 - # - page: Sentry
728 - # path: tools/sentry.mdx
729 - # - page: Serpapi
730 - # path: tools/serpapi.mdx
731 - # - page: Servicem8
732 - # path: tools/servicem8.mdx
733 - # - page: Servicenow
734 - # path: tools/servicenow.mdx
735 - # - page: Share Point
736 - # path: tools/share_point.mdx
737 - # - page: Shopify
738 - # path: tools/shopify.mdx
739 - # - page: Shortcut
740 - # path: tools/shortcut.mdx
741 - # - page: Simplesat
742 - # path: tools/simplesat.mdx
743 - # - page: Slack
744 - # path: tools/slack.mdx
745 - # - page: Slackbot
746 - # path: tools/slackbot.mdx
747 - # - page: Smartrecruiters
748 - # path: tools/smartrecruiters.mdx
749 - # - page: Smugmug
750 - # path: tools/smugmug.mdx
751 - # - page: Snowflake
752 - # path: tools/snowflake.mdx
753 - # - page: Square
754 - # path: tools/square.mdx
755 - # - page: Stack Exchange
756 - # path: tools/stack_exchange.mdx
757 - # - page: Starton
758 - # path: tools/starton.mdx
759 - # - page: Stripe
760 - # path: tools/stripe.mdx
761 - # - page: Supabase
762 - # path: tools/supabase.mdx
763 - # - page: Survey Monkey
764 - # path: tools/survey_monkey.mdx
765 - # - page: Tapform
766 - # path: tools/tapform.mdx
767 - # - page: Tavily
768 - # path: tools/tavily.mdx
769 - # - page: Terminus
770 - # path: tools/terminus.mdx
771 - # - page: Text To Pdf
772 - # path: tools/text_to_pdf.mdx
773 - # - page: Textrazor
774 - # path: tools/textrazor.mdx
775 - # - page: Timecamp
776 - # path: tools/timecamp.mdx
777 - # - page: Timekit
778 - # path: tools/timekit.mdx
779 - # - page: Timely
780 - # path: tools/timely.mdx
781 - # - page: Tinypng
782 - # path: tools/tinypng.mdx
783 - # - page: Tinyurl
784 - # path: tools/tinyurl.mdx
785 - # - page: Tisane
786 - # path: tools/tisane.mdx
787 - # - page: Todoist
788 - # path: tools/todoist.mdx
789 - # - page: Toneden
790 - # path: tools/toneden.mdx
791 - # - page: Tpscheck
792 - # path: tools/tpscheck.mdx
793 - # - page: Trello
794 - # path: tools/trello.mdx
795 - # - page: Twitch
796 - # path: tools/twitch.mdx
797 - # - page: Twitter
798 - # path: tools/twitter.mdx
799 - # - page: Twitter Media
800 - # path: tools/twitter_media.mdx
801 - # - page: Typefully
802 - # path: tools/typefully.mdx
803 - # - page: Venly
804 - # path: tools/venly.mdx
805 - # - page: Vero
806 - # path: tools/vero.mdx
807 - # - page: Visme
808 - # path: tools/visme.mdx
809 - # - page: Waboxapp
810 - # path: tools/waboxapp.mdx
811 - # - page: Wakatime
812 - # path: tools/wakatime.mdx
813 - # - page: Wave Accounting
814 - # path: tools/wave_accounting.mdx
815 - # - page: Weathermap
816 - # path: tools/weathermap.mdx
817 - # - page: Webex
818 - # path: tools/webex.mdx
819 - # - page: Webflow
820 - # path: tools/webflow.mdx
821 - # - page: Whatsapp
822 - # path: tools/whatsapp.mdx
823 - # - page: Wiz
824 - # path: tools/wiz.mdx
825 - # - page: Workiom
826 - # path: tools/workiom.mdx
827 - # - page: Wrike
828 - # path: tools/wrike.mdx
829 - # - page: Xero
830 - # path: tools/xero.mdx
831 - # - page: Yandex
832 - # path: tools/yandex.mdx
833 - # - page: Ynab
834 - # path: tools/ynab.mdx
835 - # - page: Yousearch
836 - # path: tools/yousearch.mdx
837 - # - page: Youtube
838 - # path: tools/youtube.mdx
839 - # - page: Zendesk
840 - # path: tools/zendesk.mdx
841 - # - page: Zenrows
842 - # path: tools/zenrows.mdx
843 - # - page: Zenserp
844 - # path: tools/zenserp.mdx
845 - # - page: Zoho
846 - # path: tools/zoho.mdx
847 - # - page: Zoho Bigin
848 - # path: tools/zoho_bigin.mdx
849 - # - page: Zoho Books
850 - # path: tools/zoho_books.mdx
851 - # - page: Zoho Desk
852 - # path: tools/zoho_desk.mdx
853 - # - page: Zoho Inventory
854 - # path: tools/zoho_inventory.mdx
855 - # - page: Zoho Invoice
856 - # path: tools/zoho_invoice.mdx
857 - # - page: Zoho Mail
858 - # path: tools/zoho_mail.mdx
859 - # - page: Zoom
860 - # path: tools/zoom.mdx
861 - # - page: Zoominfo
862 - # path: tools/zoominfo.mdx
257 + - page: Ably
258 + path: tools/ably.mdx
259 + - page: Accelo
260 + path: tools/accelo.mdx
261 + - page: Acculynx
262 + path: tools/acculynx.mdx
263 + - page: Active Campaign
264 + path: tools/active_campaign.mdx
265 + - page: Adobe
266 + path: tools/adobe.mdx
267 + - page: Aero Workflow
268 + path: tools/aero_workflow.mdx
269 + - page: Affinity
270 + path: tools/affinity.mdx
271 + - page: Agencyzoom
272 + path: tools/agencyzoom.mdx
273 + - page: Ahrefs
274 + path: tools/ahrefs.mdx
275 + - page: Airtable
276 + path: tools/airtable.mdx
277 + - page: Alchemy
278 + path: tools/alchemy.mdx
279 + - page: Altoviz
280 + path: tools/altoviz.mdx
281 + - page: Amazon
282 + path: tools/amazon.mdx
283 + - page: Amcards
284 + path: tools/amcards.mdx
285 + - page: Amplitude
286 + path: tools/amplitude.mdx
287 + - page: Apaleo
288 + path: tools/apaleo.mdx
289 + - page: Apollo
290 + path: tools/apollo.mdx
291 + - page: Appdrag
292 + path: tools/appdrag.mdx
293 + - page: Appsflyer
294 + path: tools/appsflyer.mdx
295 + - page: Asana
296 + path: tools/asana.mdx
297 + - page: Ashby
298 + path: tools/ashby.mdx
299 + - page: Atlassian
300 + path: tools/atlassian.mdx
301 + - page: Attio
302 + path: tools/attio.mdx
303 + - page: Auth0
304 + path: tools/auth0.mdx
305 + - page: Axonaut
306 + path: tools/axonaut.mdx
307 + - page: Bamboohr
308 + path: tools/bamboohr.mdx
309 + - page: Bannerbear
310 + path: tools/bannerbear.mdx
311 + - page: Baserow
312 + path: tools/baserow.mdx
313 + - page: Battlenet
314 + path: tools/battlenet.mdx
315 + - page: Beeminder
316 + path: tools/beeminder.mdx
317 + - page: Bigmailer
318 + path: tools/bigmailer.mdx
319 + - page: Bitbucket
320 + path: tools/bitbucket.mdx
321 + - page: Bitwarden
322 + path: tools/bitwarden.mdx
323 + - page: Blackbaud
324 + path: tools/blackbaud.mdx
325 + - page: Blackboard
326 + path: tools/blackboard.mdx
327 + - page: Boldsign
328 + path: tools/boldsign.mdx
329 + - page: Bolna
330 + path: tools/bolna.mdx
331 + - page: Borneo
332 + path: tools/borneo.mdx
333 + - page: Botbaba
334 + path: tools/botbaba.mdx
335 + - page: Box
336 + path: tools/box.mdx
337 + - page: Braintree
338 + path: tools/braintree.mdx
339 + - page: Brandfetch
340 + path: tools/brandfetch.mdx
341 + - page: Breezy Hr
342 + path: tools/breezy_hr.mdx
343 + - page: Brevo
344 + path: tools/brevo.mdx
345 + - page: Brex
346 + path: tools/brex.mdx
347 + - page: Brex Staging
348 + path: tools/brex_staging.mdx
349 + - page: Brightpearl
350 + path: tools/brightpearl.mdx
351 + - page: Brilliant Directories
352 + path: tools/brilliant_directories.mdx
353 + - page: Browseai
354 + path: tools/browseai.mdx
355 + - page: Browserbase Tool
356 + path: tools/browserbase_tool.mdx
357 + - page: Browserhub
358 + path: tools/browserhub.mdx
359 + - page: Browserless
360 + path: tools/browserless.mdx
361 + - page: Bubble
362 + path: tools/bubble.mdx
363 + - page: Bugbug
364 + path: tools/bugbug.mdx
365 + - page: Cal
366 + path: tools/cal.mdx
367 + - page: Calendly
368 + path: tools/calendly.mdx
369 + - page: Canva
370 + path: tools/canva.mdx
371 + - page: Canvas
372 + path: tools/canvas.mdx
373 + - page: Chatwork
374 + path: tools/chatwork.mdx
375 + - page: Chmeetings
376 + path: tools/chmeetings.mdx
377 + - page: Clickup
378 + path: tools/clickup.mdx
379 + - page: Clockify
380 + path: tools/clockify.mdx
381 + - page: Close
382 + path: tools/close.mdx
383 + - page: Cloudflare
384 + path: tools/cloudflare.mdx
385 + - page: Coda
386 + path: tools/coda.mdx
387 + - page: Codeinterpreter
388 + path: tools/codeinterpreter.mdx
389 + - page: Coinbase
390 + path: tools/coinbase.mdx
391 + - page: Coinmarketcal
392 + path: tools/coinmarketcal.mdx
393 + - page: Composio
394 + path: tools/composio.mdx
395 + - page: Composio Search
396 + path: tools/composio_search.mdx
397 + - page: Confluence
398 + path: tools/confluence.mdx
399 + - page: Contentful
400 + path: tools/contentful.mdx
401 + - page: Crustdata
402 + path: tools/crustdata.mdx
403 + - page: Customer Io
404 + path: tools/customer_io.mdx
405 + - page: Cutt Ly
406 + path: tools/cutt_ly.mdx
407 + - page: D2Lbrightspace
408 + path: tools/d2lbrightspace.mdx
409 + - page: Dailybot
410 + path: tools/dailybot.mdx
411 + - page: Datadog
412 + path: tools/datadog.mdx
413 + - page: Datagma
414 + path: tools/datagma.mdx
415 + - page: Datarobot
416 + path: tools/datarobot.mdx
417 + - page: Deel
418 + path: tools/deel.mdx
419 + - page: Demio
420 + path: tools/demio.mdx
421 + - page: Dialpad
422 + path: tools/dialpad.mdx
423 + - page: Digicert
424 + path: tools/digicert.mdx
425 + - page: Discord
426 + path: tools/discord.mdx
427 + - page: Discordbot
428 + path: tools/discordbot.mdx
429 + - page: Docmosis
430 + path: tools/docmosis.mdx
431 + - page: Docusign
432 + path: tools/docusign.mdx
433 + - page: Dropbox
434 + path: tools/dropbox.mdx
435 + - page: Dropbox Sign
436 + path: tools/dropbox_sign.mdx
437 + - page: Dynamics365
438 + path: tools/dynamics365.mdx
439 + - page: Echtpost
440 + path: tools/echtpost.mdx
441 + - page: Elevenlabs
442 + path: tools/elevenlabs.mdx
443 + - page: Emailoctopus
444 + path: tools/emailoctopus.mdx
445 + - page: Enigma
446 + path: tools/enigma.mdx
447 + - page: Entelligence
448 + path: tools/entelligence.mdx
449 + - page: Epic Games
450 + path: tools/epic_games.mdx
451 + - page: Eventbrite
452 + path: tools/eventbrite.mdx
453 + - page: Exa
454 + path: tools/exa.mdx
455 + - page: Excel
456 + path: tools/excel.mdx
457 + - page: Exist
458 + path: tools/exist.mdx
459 + - page: Facebook
460 + path: tools/facebook.mdx
461 + - page: Factorial
462 + path: tools/factorial.mdx
463 + - page: Figma
464 + path: tools/figma.mdx
465 + - page: Finage
466 + path: tools/finage.mdx
467 + - page: Firecrawl
468 + path: tools/firecrawl.mdx
469 + - page: Fireflies
470 + path: tools/fireflies.mdx
471 + - page: Fitbit
472 + path: tools/fitbit.mdx
473 + - page: Flutterwave
474 + path: tools/flutterwave.mdx
475 + - page: Fomo
476 + path: tools/fomo.mdx
477 + - page: Formcarry
478 + path: tools/formcarry.mdx
479 + - page: Formsite
480 + path: tools/formsite.mdx
481 + - page: Foursquare
482 + path: tools/foursquare.mdx
483 + - page: Freshbooks
484 + path: tools/freshbooks.mdx
485 + - page: Freshdesk
486 + path: tools/freshdesk.mdx
487 + - page: Front
488 + path: tools/front.mdx
489 + - page: Github
490 + path: tools/github.mdx
491 + - page: Gmail
492 + path: tools/gmail.mdx
493 + - page: Go To Webinar
494 + path: tools/go_to_webinar.mdx
495 + - page: Gong
496 + path: tools/gong.mdx
497 + - page: Google Analytics
498 + path: tools/google_analytics.mdx
499 + - page: Google Maps
500 + path: tools/google_maps.mdx
501 + - page: Googleads
502 + path: tools/googleads.mdx
503 + - page: Googlebigquery
504 + path: tools/googlebigquery.mdx
505 + - page: Googlecalendar
506 + path: tools/googlecalendar.mdx
507 + - page: Googledocs
508 + path: tools/googledocs.mdx
509 + - page: Googledrive
510 + path: tools/googledrive.mdx
511 + - page: Googlemeet
512 + path: tools/googlemeet.mdx
513 + - page: Googlephotos
514 + path: tools/googlephotos.mdx
515 + - page: Googlesheets
516 + path: tools/googlesheets.mdx
517 + - page: Googleslides
518 + path: tools/googleslides.mdx
519 + - page: Googlesuper
520 + path: tools/googlesuper.mdx
521 + - page: Googletasks
522 + path: tools/googletasks.mdx
523 + - page: Gorgias
524 + path: tools/gorgias.mdx
525 + - page: Gumroad
526 + path: tools/gumroad.mdx
527 + - page: Guru
528 + path: tools/guru.mdx
529 + - page: Hackernews
530 + path: tools/hackernews.mdx
531 + - page: Hackerrank Work
532 + path: tools/hackerrank_work.mdx
533 + - page: Harvest
534 + path: tools/harvest.mdx
535 + - page: Helcim
536 + path: tools/helcim.mdx
537 + - page: Heygen
538 + path: tools/heygen.mdx
539 + - page: Highlevel
540 + path: tools/highlevel.mdx
541 + - page: Hubspot
542 + path: tools/hubspot.mdx
543 + - page: Humanloop
544 + path: tools/humanloop.mdx
545 + - page: Icims Talent Cloud
546 + path: tools/icims_talent_cloud.mdx
547 + - page: Idea Scale
548 + path: tools/idea_scale.mdx
549 + - page: Intercom
550 + path: tools/intercom.mdx
551 + - page: Interzoid
552 + path: tools/interzoid.mdx
553 + - page: Jira
554 + path: tools/jira.mdx
555 + - page: Junglescout
556 + path: tools/junglescout.mdx
557 + - page: Keap
558 + path: tools/keap.mdx
559 + - page: Klaviyo
560 + path: tools/klaviyo.mdx
561 + - page: Klipfolio
562 + path: tools/klipfolio.mdx
563 + - page: Kommo
564 + path: tools/kommo.mdx
565 + - page: Lastpass
566 + path: tools/lastpass.mdx
567 + - page: Launch Darkly
568 + path: tools/launch_darkly.mdx
569 + - page: Leadfeeder
570 + path: tools/leadfeeder.mdx
571 + - page: Leadoku
572 + path: tools/leadoku.mdx
573 + - page: Lever
574 + path: tools/lever.mdx
575 + - page: Lever Sandbox
576 + path: tools/lever_sandbox.mdx
577 + - page: Lexoffice
578 + path: tools/lexoffice.mdx
579 + - page: Linear
580 + path: tools/linear.mdx
581 + - page: Linkedin
582 + path: tools/linkedin.mdx
583 + - page: Linkhut
584 + path: tools/linkhut.mdx
585 + - page: Linkup
586 + path: tools/linkup.mdx
587 + - page: Listennotes
588 + path: tools/listennotes.mdx
589 + - page: Lmnt
590 + path: tools/lmnt.mdx
591 + - page: Lodgify
592 + path: tools/lodgify.mdx
593 + - page: Mailchimp
594 + path: tools/mailchimp.mdx
595 + - page: Mailerlite
596 + path: tools/mailerlite.mdx
597 + - page: Maintainx
598 + path: tools/maintainx.mdx
599 + - page: Mboum
600 + path: tools/mboum.mdx
601 + - page: Mem0
602 + path: tools/mem0.mdx
603 + - page: Metaads
604 + path: tools/metaads.mdx
605 + - page: Metatextai
606 + path: tools/metatextai.mdx
607 + - page: Microsoft Clarity
608 + path: tools/microsoft_clarity.mdx
609 + - page: Microsoft Teams
610 + path: tools/microsoft_teams.mdx
611 + - page: Microsoft Tenant
612 + path: tools/microsoft_tenant.mdx
613 + - page: Miro
614 + path: tools/miro.mdx
615 + - page: Mixpanel
616 + path: tools/mixpanel.mdx
617 + - page: Mocean
618 + path: tools/mocean.mdx
619 + - page: Monday
620 + path: tools/monday.mdx
621 + - page: Mopinion
622 + path: tools/mopinion.mdx
623 + - page: More Trees
624 + path: tools/more_trees.mdx
625 + - page: Moxie
626 + path: tools/moxie.mdx
627 + - page: Moz
628 + path: tools/moz.mdx
629 + - page: Mural
630 + path: tools/mural.mdx
631 + - page: Ncscale
632 + path: tools/ncscale.mdx
633 + - page: Neon
634 + path: tools/neon.mdx
635 + - page: Netsuite
636 + path: tools/netsuite.mdx
637 + - page: Nextdns
638 + path: tools/nextdns.mdx
639 + - page: Ngrok
640 + path: tools/ngrok.mdx
641 + - page: Notion
642 + path: tools/notion.mdx
643 + - page: Oncehub
644 + path: tools/oncehub.mdx
645 + - page: One Drive
646 + path: tools/one_drive.mdx
647 + - page: Onepage
648 + path: tools/onepage.mdx
649 + - page: Open Sea
650 + path: tools/open_sea.mdx
651 + - page: Outlook
652 + path: tools/outlook.mdx
653 + - page: Pagerduty
654 + path: tools/pagerduty.mdx
655 + - page: Pandadoc
656 + path: tools/pandadoc.mdx
657 + - page: Peopledatalabs
658 + path: tools/peopledatalabs.mdx
659 + - page: Perplexityai
660 + path: tools/perplexityai.mdx
661 + - page: Piggy
662 + path: tools/piggy.mdx
663 + - page: Pipedrive
664 + path: tools/pipedrive.mdx
665 + - page: Placekey
666 + path: tools/placekey.mdx
667 + - page: Posthog
668 + path: tools/posthog.mdx
669 + - page: Precoro
670 + path: tools/precoro.mdx
671 + - page: Printnode
672 + path: tools/printnode.mdx
673 + - page: Process Street
674 + path: tools/process_street.mdx
675 + - page: Productboard
676 + path: tools/productboard.mdx
677 + - page: Qualaroo
678 + path: tools/qualaroo.mdx
679 + - page: Quickbooks
680 + path: tools/quickbooks.mdx
681 + - page: Rafflys
682 + path: tools/rafflys.mdx
683 + - page: Ragic
684 + path: tools/ragic.mdx
685 + - page: Ramp
686 + path: tools/ramp.mdx
687 + - page: Ravenseotools
688 + path: tools/ravenseotools.mdx
689 + - page: Recallai
690 + path: tools/recallai.mdx
691 + - page: Reddit
692 + path: tools/reddit.mdx
693 + - page: Resend
694 + path: tools/resend.mdx
695 + - page: Retellai
696 + path: tools/retellai.mdx
697 + - page: Ring Central
698 + path: tools/ring_central.mdx
699 + - page: Rippling
700 + path: tools/rippling.mdx
701 + - page: Rocket Reach
702 + path: tools/rocket_reach.mdx
703 + - page: Rocketlane
704 + path: tools/rocketlane.mdx
705 + - page: Rootly
706 + path: tools/rootly.mdx
707 + - page: Rosette Text Analytics
708 + path: tools/rosette_text_analytics.mdx
709 + - page: Sage
710 + path: tools/sage.mdx
711 + - page: Salesforce
712 + path: tools/salesforce.mdx
713 + - page: Scrape Do
714 + path: tools/scrape_do.mdx
715 + - page: Scrapingant
716 + path: tools/scrapingant.mdx
717 + - page: Screenshotone
718 + path: tools/screenshotone.mdx
719 + - page: Seismic
720 + path: tools/seismic.mdx
721 + - page: Semanticscholar
722 + path: tools/semanticscholar.mdx
723 + - page: Semrush
724 + path: tools/semrush.mdx
725 + - page: Sendgrid
726 + path: tools/sendgrid.mdx
727 + - page: Sentry
728 + path: tools/sentry.mdx
729 + - page: Serpapi
730 + path: tools/serpapi.mdx
731 + - page: Servicem8
732 + path: tools/servicem8.mdx
733 + - page: Servicenow
734 + path: tools/servicenow.mdx
735 + - page: Share Point
736 + path: tools/share_point.mdx
737 + - page: Shopify
738 + path: tools/shopify.mdx
739 + - page: Shortcut
740 + path: tools/shortcut.mdx
741 + - page: Simplesat
742 + path: tools/simplesat.mdx
743 + - page: Slack
744 + path: tools/slack.mdx
745 + - page: Slackbot
746 + path: tools/slackbot.mdx
747 + - page: Smartrecruiters
748 + path: tools/smartrecruiters.mdx
749 + - page: Smugmug
750 + path: tools/smugmug.mdx
751 + - page: Snowflake
752 + path: tools/snowflake.mdx
753 + - page: Square
754 + path: tools/square.mdx
755 + - page: Stack Exchange
756 + path: tools/stack_exchange.mdx
757 + - page: Starton
758 + path: tools/starton.mdx
759 + - page: Stripe
760 + path: tools/stripe.mdx
761 + - page: Supabase
762 + path: tools/supabase.mdx
763 + - page: Survey Monkey
764 + path: tools/survey_monkey.mdx
765 + - page: Tapform
766 + path: tools/tapform.mdx
767 + - page: Tavily
768 + path: tools/tavily.mdx
769 + - page: Terminus
770 + path: tools/terminus.mdx
771 + - page: Text To Pdf
772 + path: tools/text_to_pdf.mdx
773 + - page: Textrazor
774 + path: tools/textrazor.mdx
775 + - page: Timecamp
776 + path: tools/timecamp.mdx
777 + - page: Timekit
778 + path: tools/timekit.mdx
779 + - page: Timely
780 + path: tools/timely.mdx
781 + - page: Tinypng
782 + path: tools/tinypng.mdx
783 + - page: Tinyurl
784 + path: tools/tinyurl.mdx
785 + - page: Tisane
786 + path: tools/tisane.mdx
787 + - page: Todoist
788 + path: tools/todoist.mdx
789 + - page: Toneden
790 + path: tools/toneden.mdx
791 + - page: Tpscheck
792 + path: tools/tpscheck.mdx
793 + - page: Trello
794 + path: tools/trello.mdx
795 + - page: Twitch
796 + path: tools/twitch.mdx
797 + - page: Twitter
798 + path: tools/twitter.mdx
799 + - page: Twitter Media
800 + path: tools/twitter_media.mdx
801 + - page: Typefully
802 + path: tools/typefully.mdx
803 + - page: Venly
804 + path: tools/venly.mdx
805 + - page: Vero
806 + path: tools/vero.mdx
807 + - page: Visme
808 + path: tools/visme.mdx
809 + - page: Waboxapp
810 + path: tools/waboxapp.mdx
811 + - page: Wakatime
812 + path: tools/wakatime.mdx
813 + - page: Wave Accounting
814 + path: tools/wave_accounting.mdx
815 + - page: Weathermap
816 + path: tools/weathermap.mdx
817 + - page: Webex
818 + path: tools/webex.mdx
819 + - page: Webflow
820 + path: tools/webflow.mdx
821 + - page: Whatsapp
822 + path: tools/whatsapp.mdx
823 + - page: Wiz
824 + path: tools/wiz.mdx
825 + - page: Workiom
826 + path: tools/workiom.mdx
827 + - page: Wrike
828 + path: tools/wrike.mdx
829 + - page: Xero
830 + path: tools/xero.mdx
831 + - page: Yandex
832 + path: tools/yandex.mdx
833 + - page: Ynab
834 + path: tools/ynab.mdx
835 + - page: Yousearch
836 + path: tools/yousearch.mdx
837 + - page: Youtube
838 + path: tools/youtube.mdx
839 + - page: Zendesk
840 + path: tools/zendesk.mdx
841 + - page: Zenrows
842 + path: tools/zenrows.mdx
843 + - page: Zenserp
844 + path: tools/zenserp.mdx
845 + - page: Zoho
846 + path: tools/zoho.mdx
847 + - page: Zoho Bigin
848 + path: tools/zoho_bigin.mdx
849 + - page: Zoho Books
850 + path: tools/zoho_books.mdx
851 + - page: Zoho Desk
852 + path: tools/zoho_desk.mdx
853 + - page: Zoho Inventory
854 + path: tools/zoho_inventory.mdx
855 + - page: Zoho Invoice
856 + path: tools/zoho_invoice.mdx
857 + - page: Zoho Mail
858 + path: tools/zoho_mail.mdx
859 + - page: Zoom
860 + path: tools/zoom.mdx
861 + - page: Zoominfo
862 + path: tools/zoominfo.mdx
863 - tab: sdk-reference
864 layout:
865 + - section: Python
866 + icon: python
867 + contents:
868 + - page: Python SDK Reference
869 + path: pages/sdk/python/sdk-reference.md
870 - section: TypeScript
871 icon: typescript
872 contents:
fern/generators/python-sdk/__init__.py new
+6
@@ -0,0 +1,6 @@
1 +"""
2 +Python SDK documentation generator for Composio.
3 +
4 +This module provides tools to generate SDK documentation from Python code
5 +using autodoc markers in markdown files.
6 +"""
\ No newline at end of file
fern/generators/python-sdk/autodoc_core/__init__.py new
+1
@@ -0,0 +1 @@
1 +# Empty init file to make this a package
\ No newline at end of file
fern/generators/python-sdk/autodoc_core/autodoc.py new
+650
@@ -0,0 +1,650 @@
1 +# coding=utf-8
2 +# Copyright 2021 The HuggingFace Team. All rights reserved.
3 +#
4 +# Licensed under the Apache License, Version 2.0 (the "License");
5 +# you may not use this file except in compliance with the License.
6 +# You may obtain a copy of the License at
7 +#
8 +# http://www.apache.org/licenses/LICENSE-2.0
9 +#
10 +# Unless required by applicable law or agreed to in writing, software
11 +# distributed under the License is distributed on an "AS IS" BASIS,
12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +# See the License for the specific language governing permissions and
14 +# limitations under the License.
15 +
16 +import importlib
17 +import inspect
18 +import json
19 +import re
20 +
21 +from .convert_md_to_mdx import convert_md_docstring_to_mdx
22 +from .convert_rst_to_mdx import convert_rst_docstring_to_mdx, find_indent, is_empty_line
23 +from .external import HUGGINFACE_LIBS, get_external_object_link
24 +
25 +
26 +def find_object_in_package(object_name, package):
27 + """
28 + Find an object from its name inside a given package.
29 +
30 + Args:
31 + - **object_name** (`str`) -- The name of the object to retrieve.
32 + - **package** (`types.ModuleType`) -- The package to look into.
33 + """
34 + path_splits = object_name.split(".")
35 + if path_splits[0] == package.__name__:
36 + path_splits = path_splits[1:]
37 +
38 + module = package
39 + for idx, split in enumerate(path_splits):
40 + submodule = getattr(module, split, None)
41 + if submodule is None:
42 + try:
43 + # Try importing at this level
44 + full_module_path = f"{module.__name__}.{split}"
45 + importlib.import_module(full_module_path)
46 + submodule = getattr(module, split, None)
47 + except ImportError:
48 + return None # Return None if the module cannot be found or imported
49 + module = submodule
50 + if module is None:
51 + return None
52 +
53 + return module
54 +
55 +
56 +def remove_example_tags(text):
57 + tags = ["<exampletitle>", "</exampletitle>", "<example>", "</example>"]
58 + for tag in tags:
59 + text = text.replace(tag, "")
60 + return text
61 +
62 +
63 +def get_shortest_path(obj, package):
64 + """
65 + Simplifies the path to `obj` to be the shortest possible, for instance if `obj` is in the main init of its
66 + package.
67 + """
68 + if isinstance(obj, property):
69 + # Properties have no __module__ or __name__ attributes, but their getter function does.
70 + obj = obj.fget
71 +
72 + if not hasattr(obj, "__module__") or obj.__module__ is None:
73 + return None
74 + long_path = obj.__module__
75 + # Sometimes methods are defined in another module from the class (flax.struct.dataclass)
76 + if not long_path.startswith(package.__name__):
77 + return None
78 + long_name = obj.__qualname__ if hasattr(obj, "__qualname__") else obj.__name__
79 + short_name = long_name.split(".")[0]
80 + path_splits = long_path.split(".")
81 + module = package
82 + idx = module.__name__.count(".")
83 + while idx + 1 < len(path_splits) and not hasattr(module, short_name):
84 + idx += 1
85 + module = getattr(module, path_splits[idx])
86 + return ".".join(path_splits[: idx + 1]) + "." + long_name
87 +
88 +
89 +def get_type_name(typ):
90 + """
91 + Returns the name of the type passed, properly dealing with type annotations.
92 + """
93 + if isinstance(typ, type):
94 + # If it's a class, use its name.
95 + return getattr(typ, "__qualname__", None) or getattr(typ, "__name__", None) or str(typ)
96 + return str(typ) # otherwise, trust its string representation
97 +
98 +
99 +def format_signature(obj):
100 + """
101 + Retrieves the signature of a class, function or method.
102 + Returns `List(Dict(str, str))` (i.e. [{'do_lower_case', ' = True'}, ...])
103 + where `key` of `Dict` is f'{param_name}' & `value` of `Dict` is f': {annotation} = {default}'
104 + """
105 + params = []
106 + if is_getset_descriptor(obj):
107 + return params
108 + try:
109 + signature = inspect.signature(obj)
110 + except ValueError:
111 + # TODO: This fails for ModelOutput. Check if this is normal.
112 + return ""
113 +
114 + for idx, param in enumerate(signature.parameters.values()):
115 + param_name = param.name
116 + if idx == 0 and param_name in ("self", "cls"):
117 + continue
118 + if param.kind == inspect._ParameterKind.VAR_POSITIONAL:
119 + param_name = f"*{param_name}"
120 + elif param.kind == inspect._ParameterKind.VAR_KEYWORD:
121 + param_name = f"**{param_name}"
122 + param_type_val = ""
123 + if param.annotation != inspect._empty:
124 + annotation = get_type_name(param.annotation)
125 + param_type_val += f": {annotation}"
126 + if param.default != inspect._empty:
127 + default = param.default
128 + default = repr(default)
129 + param_type_val += f" = {default}"
130 + params.append({"name": param_name, "val": param_type_val})
131 + return params
132 +
133 +
134 +_re_parameters = re.compile(r"<parameters>(.*)</parameters>", re.DOTALL)
135 +_re_returns = re.compile(r"<returns>(.*)</returns>", re.DOTALL)
136 +_re_returntype = re.compile(r"<returntype>(.*)</returntype>", re.DOTALL)
137 +_re_yields = re.compile(r"<yields>(.*)</yields>", re.DOTALL)
138 +_re_yieldtype = re.compile(r"<yieldtype>(.*)</yieldtype>", re.DOTALL)
139 +_re_example_tags = re.compile(r"(<exampletitle>|<example>)")
140 +_re_parameter_group = re.compile(r"^> (.*)$", re.MULTILINE)
141 +_re_raises = re.compile(r"<raises>(.*)</raises>", re.DOTALL)
142 +_re_raisederrors = re.compile(r"<raisederrors>(.*)</raisederrors>", re.DOTALL)
143 +
144 +
145 +def get_signature_component(name, anchor, signature, object_doc, source_link=None, is_getset_desc=False):
146 + """
147 + Returns the svelte `Docstring` component string.
148 +
149 + Args:
150 + - **name** (`str`) -- The name of the function or class to document.
151 + - **anchor** (`str`) -- The anchor name of the function or class that will be used for hash links.
152 + - **signature** (`List(Dict(str,str))`) -- The signature of the object.
153 + - **object_doc** (`str`) -- The docstring of the the object.
154 + - **source_link** (Union[`str`, `None`], *optional*, defaults to `None`) -- The github source link of the the object.
155 + - **is_getset_desc** (`bool`, *optional*, defaults to `False`) -- Whether the type of obj is `getset_descriptor`.
156 + """
157 +
158 + def inside_example_finder_closure(match, tag):
159 + """
160 + This closure find whether parameters and/or returns sections has example code block inside it
161 + """
162 + match_str = match.group(1)
163 + examples_inside = _re_example_tags.search(match_str)
164 + if examples_inside:
165 + example_tag = examples_inside.group(1)
166 + match_str = match_str.replace(example_tag, f"</{tag}>{example_tag}", 1)
167 + return f"<{tag}>{match_str}"
168 + return f"<{tag}>{match_str}</{tag}>"
169 +
170 + def regex_closure(object_doc, regex):
171 + """
172 + This closure matches given regex & removes the matched group from object_doc
173 + """
174 + re_match = regex.search(object_doc)
175 + object_doc = regex.sub("", object_doc)
176 + match = None
177 + if re_match:
178 + _match = re_match.group(1).strip()
179 + if len(_match):
180 + match = _match
181 + return object_doc, match
182 +
183 + object_doc = _re_returns.sub(lambda m: inside_example_finder_closure(m, "returns"), object_doc)
184 + object_doc = _re_parameters.sub(lambda m: inside_example_finder_closure(m, "parameters"), object_doc)
185 +
186 + object_doc, parameters = regex_closure(object_doc, _re_parameters)
187 + object_doc, return_description = regex_closure(object_doc, _re_returns)
188 + object_doc, returntype = regex_closure(object_doc, _re_returntype)
189 + object_doc, yield_description = regex_closure(object_doc, _re_yields)
190 + object_doc, yieldtype = regex_closure(object_doc, _re_yieldtype)
191 + object_doc, raise_description = regex_closure(object_doc, _re_raises)
192 + object_doc, raisederrors = regex_closure(object_doc, _re_raisederrors)
193 + object_doc = remove_example_tags(object_doc)
194 + object_doc = hashlink_example_codeblock(object_doc, anchor)
195 +
196 + svelte_str = "<docstring>"
197 + svelte_str += f"<name>{name}</name>"
198 + svelte_str += f"<anchor>{anchor}</anchor>"
199 + if source_link:
200 + svelte_str += f"<source>{source_link}</source>"
201 + svelte_str += f"<parameters>{json.dumps(signature)}</parameters>"
202 + if is_getset_desc:
203 + svelte_str += "<isgetsetdescriptor>"
204 +
205 + if parameters is not None:
206 + parameters_str = ""
207 + groups = _re_parameter_group.split(parameters)
208 + group_default = groups.pop(0)
209 + parameters_str += f"<paramsdesc>{group_default}</paramsdesc>"
210 + n_groups = len(groups) // 2
211 + for idx in range(n_groups):
212 + id = idx + 1
213 + title, group = groups[2 * idx], groups[2 * idx + 1]
214 + parameters_str += f"<paramsdesc{id}title>{title}</paramsdesc{id}title>"
215 + parameters_str += f"<paramsdesc{id}>{group}</paramsdesc{id}>"
216 +
217 + svelte_str += parameters_str
218 + svelte_str += f"<paramgroups>{n_groups}</paramgroups>"
219 +
220 + if returntype is not None:
221 + svelte_str += f"<rettype>{returntype}</rettype>"
222 + if return_description is not None:
223 + svelte_str += f"<retdesc>{return_description}</retdesc>"
224 +
225 + if yieldtype is not None:
226 + svelte_str += f"<yieldtype>{yieldtype}</yieldtype>"
227 + if yield_description is not None:
228 + svelte_str += f"<yielddesc>{yield_description}</yielddesc>"
229 +
230 + if raise_description is not None:
231 + svelte_str += f"<raises>{raise_description}</raises>"
232 + if raisederrors is not None:
233 + svelte_str += f"<raisederrors>{raisederrors}</raisederrors>"
234 +
235 + svelte_str += "</docstring>"
236 +
237 + return svelte_str + f"\n{object_doc}\n"
238 +
239 +
240 +# Re pattern to catch :obj:`xx`, :class:`xx`, :func:`xx` or :meth:`xx`.
241 +_re_rst_special_words = re.compile(r":(?:obj|func|class|meth):`([^`]+)`")
242 +# Re pattern to catch things between double backquotes.
243 +_re_double_backquotes = re.compile(r"(^|[^`])``([^`]+)``([^`]|$)")
244 +# Re pattern to catch example introduction.
245 +_re_rst_example = re.compile(r"^\s*Example.*::\s*$", flags=re.MULTILINE)
246 +
247 +
248 +def is_rst_docstring(docstring):
249 + """
250 + Returns `True` if `docstring` is written in rst.
251 + """
252 + if _re_rst_special_words.search(docstring) is not None:
253 + return True
254 + if _re_double_backquotes.search(docstring) is not None:
255 + return True
256 + if _re_rst_example.search(docstring) is not None:
257 + return True
258 + return False
259 +
260 +
261 +# Re pattern to catch example introduction & example code block.
262 +_re_example_codeblock = re.compile(r"((.*:\s+)?^```((?!```)(.|\n))*```)", re.MULTILINE)
263 +
264 +
265 +def hashlink_example_codeblock(object_doc, object_anchor):
266 + """
267 + Returns the svelte `ExampleCodeBlock` component string.
268 +
269 + Args:
270 + - **object_doc** (`str`) -- The docstring of the the object.
271 + - **anchor** (`str`) -- The anchor name of the function or class that will be used for hash links.
272 + """
273 +
274 + example_id = 0
275 +
276 + def add_example_svelte_blocks(match):
277 + """
278 + This closure matches `_re_example_codeblock` regex & creates `ExampleCodeBlock` svelte component
279 + """
280 + nonlocal example_id
281 +
282 + example_id += 1
283 + id_str = "" if example_id == 1 else f"-{example_id}"
284 + example_anchor = f"{object_anchor}.example{id_str}"
285 + return f'<ExampleCodeBlock anchor="{example_anchor}">\n\n{match.group(1)}\n\n</ExampleCodeBlock>'
286 +
287 + object_doc = _re_example_codeblock.sub(add_example_svelte_blocks, object_doc)
288 + return object_doc
289 +
290 +
291 +# Re pattern to numpystyle docstring (e.g Parameter -------).
292 +_re_numpydocstring = re.compile(r"(Parameter|Raise|Return|Yield)s?\n\s*----+\n")
293 +
294 +
295 +def is_numpy_docstring(docstring):
296 + """
297 + Returns `True` if `docstring` is written in numpystyle.
298 + """
299 + return _re_numpydocstring.search(docstring)
300 +
301 +
302 +def is_dataclass_autodoc(obj):
303 + """
304 + Returns boolean whether object's doc was generated automatically by `dataclass`.
305 + """
306 + if is_getset_descriptor(obj):
307 + return False
308 + try:
309 + signature = str(inspect.signature(obj))
310 + except ValueError:
311 + # object doesn't have signature
312 + return False
313 + doc = obj.__doc__
314 + doc_generated = obj.__name__ + signature
315 + is_generated = doc in doc_generated
316 + return is_generated
317 +
318 +
319 +def is_getset_descriptor(obj):
320 + """
321 + Returns boolean whether object is `getset_descriptor`.
322 + """
323 + # used by tokenizers @property bindings
324 + obj_repr = str(type(obj))
325 + return "getset_descriptor" in obj_repr
326 +
327 +
328 +def get_source_link(obj, page_info, version_tag_suffix="src/"):
329 + """
330 + Returns the link to the source code of an object on GitHub.
331 + """
332 + # Repo name defaults to package_name, but if provided in page_info, it will be used instead.
333 + repo_name = page_info.get("repo_name", page_info.get("package_name"))
334 + version_tag = page_info.get("version_tag", "main")
335 + repo_owner = page_info.get("repo_owner", "huggingface")
336 + base_link = f"https://github.com/{repo_owner}/{repo_name}/blob/{version_tag}/{version_tag_suffix}"
337 + module = obj.__module__.replace(".", "/")
338 + line_number = inspect.getsourcelines(obj)[1]
339 + source_file = inspect.getsourcefile(obj)
340 + if source_file.endswith("__init__.py"):
341 + return f"{base_link}{module}/__init__.py#L{line_number}"
342 + return f"{base_link}{module}.py#L{line_number}"
343 +
344 +
345 +def get_source_path(object_name, package):
346 + """
347 + Find a path to file in which given object was defined.
348 +
349 + Args:
350 + - object_name (`str`): The name of the object to retrieve.
351 + - package (`types.ModuleType`): The package to look into.
352 + """
353 + obj = obj = find_object_in_package(object_name=object_name, package=package)
354 + obj_path = inspect.getfile(obj)
355 + return obj_path
356 +
357 +
358 +def document_object(object_name, package, page_info, full_name=True, anchor_name=None, version_tag_suffix="src/"):
359 + """
360 + Writes the document of a function, class or method.
361 +
362 + Args:
363 + object_name (`str`): The name of the object to document.
364 + package (`types.ModuleType`): The package of the object.
365 + full_name (`bool`, *optional*, defaults to `True`): Whether to write the full name of the object or not.
366 + anchor_name (`str`, *optional*): The name to give to the anchor for this object.
367 + version_tag_suffix (`str`, *optional*, defaults to `"src/"`):
368 + Suffix to add after the version tag (e.g. 1.3.0 or main) in the documentation links.
369 + For example, the default `"src/"` suffix will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/src/`.
370 + For example, `version_tag_suffix=""` will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/`.
371 + """
372 + if page_info is None:
373 + page_info = {}
374 + if "package_name" not in page_info:
375 + page_info["package_name"] = package.__name__
376 + obj = find_object_in_package(object_name=object_name, package=package)
377 + if obj is None:
378 + raise ValueError(
379 + f"Unable to find {object_name} in {package.__name__}. Make sure the path to that object is correct."
380 + )
381 + if isinstance(obj, property):
382 + # Propreties have no __module__ or __name__ attributes, but their getter function does.
383 + obj = obj.fget
384 +
385 + if anchor_name is None:
386 + anchor_name = get_shortest_path(obj, package)
387 + if full_name and anchor_name is not None:
388 + name = anchor_name
389 + else:
390 + name = obj.__name__
391 +
392 + prefix = "class " if isinstance(obj, type) else ""
393 + object_doc = ""
394 + signature_name = prefix + name
395 + signature = format_signature(obj)
396 + check = None
397 + if getattr(obj, "__doc__", None) is not None and len(obj.__doc__) > 0:
398 + object_doc = obj.__doc__
399 + if is_dataclass_autodoc(obj):
400 + object_doc = ""
401 + elif is_rst_docstring(object_doc):
402 + object_doc = convert_rst_docstring_to_mdx(obj.__doc__, page_info)
403 + else:
404 + check = quality_check_docstring(object_doc, object_name=object_name)
405 + object_doc = convert_md_docstring_to_mdx(obj.__doc__, page_info)
406 +
407 + try:
408 + source_link = get_source_link(obj, page_info, version_tag_suffix)
409 + except (AttributeError, OSError, TypeError):
410 + # tokenizers obj do NOT have `__module__` attribute & can NOT be used with inspect.getsourcelines
411 + source_link = None
412 + is_getset_desc = is_getset_descriptor(obj)
413 + component = get_signature_component(
414 + signature_name, anchor_name, signature, object_doc, source_link, is_getset_desc
415 + )
416 + documentation = "\n" + component + "\n"
417 + return documentation, check
418 +
419 +
420 +def find_documented_methods(clas):
421 + """
422 + Find all the public methods of a given class that have a nonempty documentation, filtering the methods documented
423 + the exact same way in a superclass.
424 + """
425 + public_attrs = {a: getattr(clas, a) for a in dir(clas) if not a.startswith("_")}
426 + public_methods = {a: m for a, m in public_attrs.items() if callable(m) and not isinstance(m, type)}
427 + documented_methods = {
428 + a: m for a, m in public_methods.items() if getattr(m, "__doc__", None) is not None and len(m.__doc__) > 0
429 + }
430 +
431 + superclasses = clas.mro()[1:]
432 + for superclass in superclasses:
433 + superclass_methods = {a: getattr(superclass, a) for a in documented_methods.keys() if hasattr(superclass, a)}
434 + documented_methods = {
435 + a: m
436 + for a, m in documented_methods.items()
437 + if (
438 + a not in superclass_methods
439 + or getattr(superclass_methods[a], "__doc__", None) is None
440 + or m.__doc__ != superclass_methods[a].__doc__
441 + )
442 + }
443 + return list(documented_methods.keys())
444 +
445 +
446 +docstring_css_classes = "docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"
447 +
448 +
449 +def autodoc(object_name, package, methods=None, return_anchors=False, page_info=None, version_tag_suffix="src/"):
450 + """
451 + Generates the documentation of an object, with a potential filtering on the methods for a class.
452 +
453 + Args:
454 + object_name (`str`): The name of the function or class to document.
455 + package (`types.ModuleType`): The package of the object.
456 + methods (`List[str]`, *optional*):
457 + A list of methods to document if `obj` is a class. If nothing is passed, all public methods with a new
458 + docstring compared to the superclasses are documented. If a list of methods is passed and ou want to add
459 + all those methods, the key "all" will add them.
460 + return_anchors (`bool`, *optional*, defaults to `False`):
461 + Whether or not to return the list of anchors generated.
462 + page_info (`Dict[str, str]`, *optional*): Some information about the page.
463 + version_tag_suffix (`str`, *optional*, defaults to `"src/"`):
464 + Suffix to add after the version tag (e.g. 1.3.0 or main) in the documentation links.
465 + For example, the default `"src/"` suffix will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/src/`.
466 + For example, `version_tag_suffix=""` will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/`.
467 + """
468 + if page_info is None:
469 + page_info = {}
470 + if "package_name" not in page_info:
471 + page_info["package_name"] = package.__name__
472 +
473 + errors = []
474 + obj = find_object_in_package(object_name=object_name, package=package)
475 + documentation, check = document_object(
476 + object_name=object_name, package=package, page_info=page_info, version_tag_suffix=version_tag_suffix
477 + )
478 + if check is not None:
479 + errors.append(check)
480 +
481 + if return_anchors:
482 + anchors = [get_shortest_path(obj, package)]
483 + if isinstance(obj, type):
484 + documentation, check = document_object(
485 + object_name=object_name, package=package, page_info=page_info, version_tag_suffix=version_tag_suffix
486 + )
487 + if check is not None:
488 + errors.append(check)
489 + if methods is None:
490 + methods = find_documented_methods(obj)
491 + elif "all" in methods:
492 + methods.remove("all")
493 + methods_to_add = find_documented_methods(obj)
494 + methods.extend([m for m in methods_to_add if m not in methods])
495 + elif "none" in methods:
496 + methods = []
497 + for method in methods:
498 + anchor_name = f"{anchors[0]}.{method}"
499 + method_doc, check = document_object(
500 + object_name=f"{object_name}.{method}",
501 + package=package,
502 + page_info=page_info,
503 + full_name=False,
504 + anchor_name=anchor_name,
505 + version_tag_suffix=version_tag_suffix,
506 + )
507 + if check is not None:
508 + errors.append(check)
509 + documentation += f'\n<div class="{docstring_css_classes}">\n\n' + method_doc + "</div>"
510 + if return_anchors:
511 + # The anchor name of the method might be different from its
512 + method = find_object_in_package(f"{anchors[0]}.{method}", package=package)
513 + method_name = get_shortest_path(method, package=package)
514 + if anchor_name == method_name or method_name is None:
515 + anchors.append(anchor_name)
516 + else:
517 + anchors.append((anchor_name, method_name))
518 + documentation = f'<div class="{docstring_css_classes}">\n\n' + documentation + "</div>\n"
519 +
520 + return (documentation, anchors, errors) if return_anchors else documentation
521 +
522 +
523 +def resolve_links_in_text(text, package, mapping, page_info):
524 + """
525 + Resolve links of the form [`SomeClass`] to the link in the documentation to `SomeClass`.
526 +
527 + Args:
528 + text (`str`): The text in which to convert the links.
529 + package (`types.ModuleType`): The package in which to search objects for.
530 + mapping (`Dict[str, str]`): The map from anchor names of objects to their page in the documentation.
531 + page_info (`Dict[str, str]`): Some information about the page.
532 + """
533 + package_name = page_info.get("package_name", package.__name__)
534 + version = page_info.get("version", "main")
535 + language = page_info.get("language", "en")
536 +
537 + prefix = f"/docs/{package_name}/{version}/{language}/"
538 +
539 + def _resolve_link(search):
540 + object_or_param_name, last_char = search.groups()
541 + # Deal with external libs first.
542 + lib_name = object_or_param_name.split(".")[0]
543 + if lib_name.startswith("~"):
544 + lib_name = lib_name[1:]
545 + if lib_name in HUGGINFACE_LIBS and lib_name != package_name:
546 + link = get_external_object_link(object_or_param_name, page_info)
547 + return f"{link}{last_char}"
548 + object_name, param_name = None, None
549 + # If `#` is in the name, assume it's a link to the function/method parameter.
550 + if "#" in object_or_param_name:
551 + object_name_for_param = object_or_param_name.split("#", 1)[0]
552 + # Strip preceding `~` if it's there.
553 + object_name_for_param = (
554 + object_name_for_param[1:] if object_name_for_param.startswith("~") else object_name_for_param
555 + )
556 + obj = find_object_in_package(object_name_for_param, package)
557 + param_name = object_or_param_name.split("#", 1)[-1]
558 + # If the name begins with `~`, we shortcut to the last part.
559 + elif object_or_param_name.startswith("~"):
560 + obj = find_object_in_package(object_or_param_name[1:], package)
561 + object_name = object_or_param_name.split(".")[-1]
562 + else:
563 + obj = find_object_in_package(object_or_param_name, package)
564 + object_name = object_or_param_name
565 + # Object not found, return the original link text.
566 + if obj is None:
567 + return f"`{object_or_param_name}`{last_char}"
568 +
569 + link_name = object_name if param_name is None else param_name
570 +
571 + # If the link points to an object and the object is not a class, we add ()
572 + if param_name is None and not isinstance(obj, (type, property)):
573 + link_name = f"{link_name}()"
574 +
575 + # Link to the anchor
576 + anchor = get_shortest_path(obj, package)
577 + if anchor not in mapping:
578 + return f"`{link_name}`{last_char}"
579 + page = f"{prefix}{mapping[anchor]}"
580 + if param_name:
581 + anchor = f"{anchor}.{param_name}"
582 + if "#" in page:
583 + return f"[{link_name}]({page}){last_char}"
584 + else:
585 + return f"[{link_name}]({page}#{anchor}){last_char}"
586 +
587 + return re.sub(r"\[`([^`]+)`\]([^\(])", _resolve_link, text)
588 +
589 +
590 +# Re pattern that catches the start of a block code with potential indent.
591 +_re_start_code_block = re.compile(r"^\s*```.*$", flags=re.MULTILINE)
592 +# Re pattern that catches return blocks of the form `Return:`.
593 +_re_returns_block = re.compile(r"^\s*Returns?:\s*$")
594 +
595 +
596 +def quality_check_docstring(docstring, object_name=None):
597 + """
598 + Check if a docstring is not going to generate a common error on moon-landing, by asserting it does not have:
599 +
600 + - an empty Return block
601 + - two (or more) Return blocks
602 + - a code sample not properly closed.
603 +
604 + This function only returns an error message and does not raise an exception, as we will raise one single exception
605 + with all the problems at the end.
606 +
607 + Args:
608 + docstring (`str`): The docstring to check.
609 + obejct_name (`str`, *optional*): The name of the object being documented.
610 + Will be added to the error message if passed.
611 +
612 + Returns:
613 + Optional `str`: Returns `None` if the docstring is correct and an error message otherwise.
614 + """
615 +
616 + lines = docstring.split("\n")
617 + in_code = False
618 + code_indent = 0
619 + return_blocks = 0
620 + error_message = ""
621 +
622 + for idx, line in enumerate(lines):
623 + if not in_code and _re_start_code_block.search(line) is not None:
624 + in_code = True
625 + code_indent = find_indent(line)
626 + elif in_code and line.rstrip() == " " * code_indent + "```":
627 + in_code = False
628 + elif _re_returns_block.search(line) is not None:
629 + next_line_idx = idx + 1
630 + while next_line_idx < len(lines) and is_empty_line(lines[next_line_idx]):
631 + next_line_idx += 1
632 + if next_line_idx >= len(lines) or find_indent(lines[next_line_idx]) <= find_indent(line):
633 + error_message += "- The return block is empty.\n"
634 + else:
635 + return_blocks += 1
636 +
637 + if in_code:
638 + error_message += "- A code block has been opened but is not closed.\n"
639 + if return_blocks >= 2:
640 + error_message += f"- There are {return_blocks} Returns block. Only one max is supported.\n"
641 +
642 + if len(error_message) == 0:
643 + return
644 +
645 + if object_name is not None:
646 + error_message = (
647 + f"The docstring of {object_name} comports the following issue(s) and needs fixing:\n" + error_message
648 + )
649 +
650 + return error_message
fern/generators/python-sdk/autodoc_core/convert_md_to_mdx.py new
+241
@@ -0,0 +1,241 @@
1 +# coding=utf-8
2 +# Copyright 2021 The HuggingFace Team. All rights reserved.
3 +#
4 +# Licensed under the Apache License, Version 2.0 (the "License");
5 +# you may not use this file except in compliance with the License.
6 +# You may obtain a copy of the License at
7 +#
8 +# http://www.apache.org/licenses/LICENSE-2.0
9 +#
10 +# Unless required by applicable law or agreed to in writing, software
11 +# distributed under the License is distributed on an "AS IS" BASIS,
12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +# See the License for the specific language governing permissions and
14 +# limitations under the License.
15 +
16 +
17 +import json
18 +import re
19 +import tempfile
20 +
21 +from .convert_rst_to_mdx import parse_rst_docstring, remove_indent
22 +
23 +
24 +_re_doctest_flags = re.compile(r"^(>>>.*\S)(\s+)# doctest:\s+\+[A-Z_]+\s*$", flags=re.MULTILINE)
25 +
26 +
27 +def convert_md_to_mdx(md_text, page_info):
28 + """
29 + Convert a document written in md to mdx.
30 + """
31 + return (
32 + """<script lang="ts">
33 +import {onMount} from "svelte";
34 +import Tip from "$lib/Tip.svelte";
35 +import Youtube from "$lib/Youtube.svelte";
36 +import Docstring from "$lib/Docstring.svelte";
37 +import CodeBlock from "$lib/CodeBlock.svelte";
38 +import CodeBlockFw from "$lib/CodeBlockFw.svelte";
39 +import DocNotebookDropdown from "$lib/DocNotebookDropdown.svelte";
40 +import CourseFloatingBanner from "$lib/CourseFloatingBanner.svelte";
41 +import IconCopyLink from "$lib/IconCopyLink.svelte";
42 +import FrameworkContent from "$lib/FrameworkContent.svelte";
43 +import Markdown from "$lib/Markdown.svelte";
44 +import Question from "$lib/Question.svelte";
45 +import FrameworkSwitchCourse from "$lib/FrameworkSwitchCourse.svelte";
46 +import InferenceApi from "$lib/InferenceApi.svelte";
47 +import TokenizersLanguageContent from "$lib/TokenizersLanguageContent.svelte";
48 +import ExampleCodeBlock from "$lib/ExampleCodeBlock.svelte";
49 +import Added from "$lib/Added.svelte";
50 +import Changed from "$lib/Changed.svelte";
51 +import Deprecated from "$lib/Deprecated.svelte";
52 +import PipelineIcon from "$lib/PipelineIcon.svelte";
53 +import PipelineTag from "$lib/PipelineTag.svelte";
54 +import Heading from "$lib/Heading.svelte";
55 +import HfOptions from "$lib/HfOptions.svelte";
56 +import HfOption from "$lib/HfOption.svelte";
57 +import EditOnGithub from "$lib/EditOnGithub.svelte";
58 +import InferenceSnippet from "$lib/InferenceSnippet/InferenceSnippet.svelte";
59 +let fw: "pt" | "tf" = "pt";
60 +onMount(() => {
61 + const urlParams = new URLSearchParams(window.location.search);
62 + fw = urlParams.get("fw") || "pt";
63 +});
64 +</script>
65 +<svelte:head>
66 + <meta name="hf:doc:metadata" content={metadata} >
67 +</svelte:head>
68 +
69 +<!--HF DOCBUILD BODY START-->
70 +
71 +HF_DOC_BODY_START
72 +
73 +"""
74 + + process_md(md_text, page_info)
75 + + edit_on_github(page_info)
76 + + """
77 +
78 +<!--HF DOCBUILD BODY END-->
79 +
80 +HF_DOC_BODY_END
81 +
82 +"""
83 + )
84 +
85 +
86 +def edit_on_github(page_info):
87 + """
88 + Svelte component string that adds "Update on Github" btn.
89 + """
90 + if "path" not in page_info or "repo_name" not in page_info:
91 + return ""
92 + path = str(page_info["path"])
93 + package_name = page_info["repo_name"]
94 + idx = path.find(package_name)
95 + if idx == -1:
96 + return ""
97 + relative_path = path[idx + len(package_name) :]
98 + if relative_path.startswith("/"):
99 + relative_path = relative_path[1:]
100 + source = f'https://github.com/{page_info["repo_owner"]}/{page_info["repo_name"]}/blob/main/{relative_path}'
101 + return f'\n\n<EditOnGithub source="{source}" />\n\n'
102 +
103 +
104 +def convert_img_links(text, page_info):
105 + """
106 + Convert image links to correct URL paths.
107 + """
108 + if "package_name" not in page_info:
109 + raise ValueError("`page_info` must contain at least the package_name.")
110 + package_name = page_info["package_name"]
111 + version = page_info.get("version", "main")
112 + language = page_info.get("language", "en")
113 +
114 + _re_img_link = re.compile(r"(src=\"|\()/imgs/")
115 + while _re_img_link.search(text):
116 + text = _re_img_link.sub(rf"\1/docs/{package_name}/{version}/{language}/imgs/", text)
117 + return text
118 +
119 +
120 +_re_md_img_tag_alt = re.compile(r"!\[([^\]]+)\]", re.I)
121 +_re_html_img_tag_alt = re.compile(r"<img [^>]*?alt=([\"'])([^\1]*?)\1[^>]*?>", re.I)
122 +
123 +
124 +def escape_img_alt_description(text):
125 + """
126 + Escapes ` with ' inside <img> alt description since it causes svelte/mdsvex compiler error.
127 + """
128 +
129 + def replace_md_alt_content(match):
130 + alt_content = match.group(1)
131 + new_alt_content = alt_content.replace("`", "'")
132 + return match.group(0).replace(alt_content, new_alt_content)
133 +
134 + def replace_html_alt_content(match):
135 + alt_content = match.group(2) # group(2) contains the alt text for the HTML regex
136 + new_alt_content = alt_content.replace("`", "'")
137 + return match.group(0).replace(alt_content, new_alt_content)
138 +
139 + # Replace markdown style image alt text
140 + if _re_md_img_tag_alt.search(text):
141 + text = _re_md_img_tag_alt.sub(replace_md_alt_content, text)
142 +
143 + # Replace HTML style image alt text
144 + if _re_html_img_tag_alt.search(text):
145 + text = _re_html_img_tag_alt.sub(replace_html_alt_content, text)
146 +
147 + return text
148 +
149 +
150 +def fix_img_links(text, page_info):
151 + text = convert_img_links(text, page_info)
152 + text = escape_img_alt_description(text)
153 + return text
154 +
155 +
156 +def clean_doctest_syntax(text):
157 + """
158 + Clean the doctest artifacts in a given content.
159 + """
160 + text = text.replace(">>> # ===PT-TF-SPLIT===", "===PT-TF-SPLIT===")
161 + text = _re_doctest_flags.sub(r"\1", text)
162 + return text
163 +
164 +
165 +_re_include_template = r"([ \t]*)<{include_name}>(((?!<{include_name}>).)*)<\/{include_name}>"
166 +_re_include = re.compile(_re_include_template.format(include_name="include"), re.DOTALL)
167 +_re_literalinclude = re.compile(_re_include_template.format(include_name="literalinclude"), re.DOTALL)
168 +
169 +
170 +def convert_file_include_helper(match, page_info, is_code=True):
171 + """
172 + Convert an `include` or `literalinclude` regex match into markdown blocks or markdown code blocks,
173 + by opening a file and copying specified start-end section into markdown block.
174 +
175 + If `is_code` is True, the block will be rendered as a code block, otherwise it will be rendered
176 + as a markdown block.
177 + """
178 + include_info = json.loads(match[2].strip())
179 + indent = match[1]
180 + include_name = "literalinclude" if is_code else "include"
181 + if tempfile.gettempdir() in str(page_info["path"]):
182 + return f"\n`Please restart doc-builder preview commands to see {include_name} rendered`\n"
183 + file = page_info["path"].parent / include_info["path"]
184 + with open(file, "r", encoding="utf-8-sig") as reader:
185 + lines = reader.readlines()
186 + include = lines # defaults to entire file
187 + if "start-after" in include_info or "end-before" in include_info:
188 + start_after, end_before = -1, -1
189 + for idx, line in enumerate(lines):
190 + line = line.strip()
191 + line = re.sub(r"\W+$", "", line)
192 + if line.endswith(include_info["start-after"]):
193 + start_after = idx + 1
194 + if line.endswith(include_info["end-before"]):
195 + end_before = idx
196 + if start_after == -1 or end_before == -1:
197 + raise ValueError(f"The following '{include_name}' does NOT exist:\n{match[0]}")
198 + include = lines[start_after:end_before]
199 + include = [indent + line[include_info.get("dedent", 0) :] for line in include]
200 + include = "".join(include).rstrip()
201 + return f"""{indent}```{include_info.get('language', '')}\n{include}\n{indent}```""" if is_code else include
202 +
203 +
204 +def convert_include(text, page_info):
205 + """
206 + Convert an `include` into markdown.
207 + """
208 + text = _re_include.sub(lambda m: convert_file_include_helper(m, page_info, is_code=False), text)
209 + return text
210 +
211 +
212 +def convert_literalinclude(text, page_info):
213 + """
214 + Convert a `literalinclude` into markdown code blocks.
215 + """
216 + text = _re_literalinclude.sub(lambda m: convert_file_include_helper(m, page_info, is_code=True), text)
217 + return text
218 +
219 +
220 +def convert_md_docstring_to_mdx(docstring, page_info):
221 + """
222 + Convert a docstring written in Markdown to mdx.
223 + """
224 + text = parse_rst_docstring(docstring)
225 + text = remove_indent(text)
226 + return process_md(text, page_info)
227 +
228 +
229 +def process_md(text, page_info):
230 + """
231 + Processes markdown by:
232 + 1. Convert include
233 + 2. Convert literalinclude
234 + 3. Clean doctest syntax
235 + 4. Fix image links
236 + """
237 + text = convert_include(text, page_info)
238 + text = convert_literalinclude(text, page_info)
239 + text = clean_doctest_syntax(text)
240 + text = fix_img_links(text, page_info)
241 + return text
fern/generators/python-sdk/autodoc_core/convert_rst_to_mdx.py new
+705
@@ -0,0 +1,705 @@
1 +# coding=utf-8
2 +# Copyright 2021 The HuggingFace Team. All rights reserved.
3 +#
4 +# Licensed under the Apache License, Version 2.0 (the "License");
5 +# you may not use this file except in compliance with the License.
6 +# You may obtain a copy of the License at
7 +#
8 +# http://www.apache.org/licenses/LICENSE-2.0
9 +#
10 +# Unless required by applicable law or agreed to in writing, software
11 +# distributed under the License is distributed on an "AS IS" BASIS,
12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +# See the License for the specific language governing permissions and
14 +# limitations under the License.
15 +
16 +
17 +import re
18 +
19 +
20 +# Re pattern to catch things inside ` ` in :obj:`thing`.
21 +_re_obj = re.compile(r":obj:`([^`]+)`")
22 +# Re pattern to catch things inside ` ` in :math:`thing`.
23 +_re_math = re.compile(r":math:`([^`]+)`")
24 +# Re pattern to catch things between single backquotes.
25 +_re_single_backquotes = re.compile(r"(^|[^`])`([^`]+)`([^`]|$)")
26 +# Re pattern to catch things between double backquotes.
27 +_re_double_backquotes = re.compile(r"(^|[^`])``([^`]+)``([^`]|$)")
28 +# Re pattern to catch things inside ` ` in :func/class/meth:`thing`.
29 +_re_func_class = re.compile(r":(?:func|class|meth):`([^`]+)`")
30 +
31 +
32 +def convert_rst_formatting(text):
33 + """
34 + Convert rst syntax for formatting to markdown in a given text.
35 + """
36 + # Remove :class:, :func: and :meth: markers. To code-links and put double backquotes
37 + # (to not be caught by the italic conversion).
38 + text = _re_func_class.sub(r"[``\1``]", text)
39 + # Remove :obj: markers. What's after is in a single backquotes so we put in double backquotes
40 + # (to not be caught by the italic conversion).
41 + text = _re_obj.sub(r"``\1``", text)
42 + # Remove :math: markers.
43 + text = _re_math.sub(r"\\\\(\1\\\\)", text)
44 + # Convert content in single backquotes to italic.
45 + text = _re_single_backquotes.sub(r"\1*\2*\3", text)
46 + # Convert content in double backquotes to single backquotes.
47 + text = _re_double_backquotes.sub(r"\1`\2`\3", text)
48 + # Remove remaining ::
49 + text = re.sub(r"::\n", "", text)
50 +
51 + # Remove new lines inside blocks in backsticks as they will be kept.
52 + lines = text.split("\n")
53 + in_code = False
54 + text = None
55 + for line in lines:
56 + if in_code:
57 + splits = line.split("`")
58 + in_code = len(splits) > 1 and len(splits) % 2 == 1
59 + if len(splits) == 1:
60 + # Some forgotten lone backstick
61 + text += "\n" + line
62 + else:
63 + text += " " + line.lstrip()
64 + else:
65 + if text is not None:
66 + text += "\n" + line
67 + else:
68 + text = line
69 + splits = line.split("`")
70 + in_code = len(splits) % 2 == 0
71 + return text
72 +
73 +
74 +# Re pattern to catch description and url in links of the form `description <url>`_.
75 +_re_links = re.compile(r"`([^`]+\S)\s+</*([^/][^>`]*)>`_+")
76 +# Re pattern to catch description and url in links of the form :prefix_link:`description <url>`_.
77 +_re_prefix_links = re.compile(r":prefix_link:`([^`]+\S)\s+</*([^/][^>`]*)>`")
78 +# Re pattern to catch reference in links of the form :doc:`reference`.
79 +_re_simple_doc = re.compile(r":doc:`([^`<]*)`")
80 +# Re pattern to catch description and reference in links of the form :doc:`description <reference>`.
81 +_re_doc_with_description = re.compile(r":doc:`([^`<]+\S)\s+</*([^/][^>`]*)>`")
82 +# Re pattern to catch reference in links of the form :ref:`reference`.
83 +_re_simple_ref = re.compile(r":ref:`([^`<]*)`")
84 +# Re pattern to catch description and reference in links of the form :ref:`description <reference>`.
85 +_re_ref_with_description = re.compile(r":ref:`([^`<]+\S)\s+<([^>]*)>`")
86 +
87 +
88 +def convert_rst_links(text, page_info):
89 + """
90 + Convert the rst links in text to markdown.
91 + """
92 + if "package_name" not in page_info:
93 + raise ValueError("`page_info` must contain at least the package_name.")
94 + package_name = page_info["package_name"]
95 + version = page_info.get("version", "main")
96 + language = page_info.get("language", "en")
97 + no_prefix = page_info.get("no_prefix", False)
98 +
99 + prefix = "" if no_prefix else f"/docs/{package_name}/{version}/{language}/"
100 + # Links of the form :doc:`page`
101 + text = _re_simple_doc.sub(rf"[\1]({prefix}\1)", text)
102 + # Links of the form :doc:`text <page>`
103 + text = _re_doc_with_description.sub(rf"[\1]({prefix}\2)", text)
104 +
105 + if "page" in page_info and not no_prefix:
106 + page = str(page_info["page"])
107 + if page.endswith(".html"):
108 + page = page[:-5]
109 + prefix = f"{prefix}{page}"
110 + else:
111 + prefix = ""
112 + # Refs of the form :ref:`page`
113 + text = _re_simple_ref.sub(rf"[\1]({prefix}#\1)", text)
114 + # Refs of the form :ref:`text <page>`
115 + text = _re_ref_with_description.sub(rf"[\1]({prefix}#\2)", text)
116 +
117 + # Links with a prefix
118 + # TODO: when it exists, use the API to deal with prefix links properly.
119 + prefix = f"https://github.com/huggingface/{package_name}/tree/main/"
120 + text = _re_prefix_links.sub(rf"[\1]({prefix}\2)", text)
121 + # Other links
122 + text = _re_links.sub(r"[\1](\2)", text)
123 + # Relative links or Transformers links need to remove the .html
124 + if "(https://https://huggingface.co/" in text or re.search(r"\(\.+/", text) is not None:
125 + text = text.replace(".html", "")
126 + return text
127 +
128 +
129 +# Re pattern that catches examples blocks of the form `Example::`.
130 +_re_example = re.compile(r"^\s*(\S.*)::\s*$")
131 +# Re pattern that catches rst blocks of the form `.. block_name::`.
132 +_re_block = re.compile(r"^\s*\.\.\s+(\S+)::")
133 +# Re pattern that catches what's after the :: in rst blocks of the form `.. block_name:: something`.
134 +_re_block_info = re.compile(r"^\s*\.\.\s+\S+::\s*(\S.*)$")
135 +
136 +
137 +def is_empty_line(line):
138 + return len(line) == 0 or line.isspace()
139 +
140 +
141 +def find_indent(line):
142 + """
143 + Returns the number of spaces that start a line indent.
144 + """
145 + search = re.search(r"^(\s*)(?:\S|$)", line)
146 + if search is None:
147 + return 0
148 + return len(search.groups()[0])
149 +
150 +
151 +_re_rst_option = re.compile(r"^\s*:(\S+):(.*)$")
152 +
153 +
154 +def convert_special_chars(text):
155 + """
156 + Converts { and < that have special meanings in MDX.
157 + """
158 + text = text.replace("{", "&amp;lcub;")
159 + # We don't want to replace those by the HTML code, so we temporarily set them at LTHTML
160 + text = re.sub(r"<(img|br|hr|Youtube)", r"LTHTML\1", text) # html void elements with no closing counterpart
161 + _re_lt_html = re.compile(r"<(\S+)([^>]*>)(((?!</\1>).)*)<(/\1>)", re.DOTALL)
162 + while _re_lt_html.search(text):
163 + text = _re_lt_html.sub(r"LTHTML\1\2\3LTHTML\5", text)
164 + text = re.sub(r"(^|[^<])<([^<]|$)", r"\1&amp;lt;\2", text)
165 + text = text.replace("LTHTML", "<")
166 + return text
167 +
168 +
169 +def parse_options(block_content):
170 + """
171 + Parses the option in some rst block content.
172 + """
173 + block_lines = block_content.split("\n")
174 + block_indent = find_indent(block_lines[0])
175 + current_option = None
176 + result = {}
177 + for line in block_lines:
178 + if _re_rst_option.search(line) is not None:
179 + current_option, value = _re_rst_option.search(line).groups()
180 + result[current_option] = value.lstrip()
181 + elif find_indent(line) > block_indent:
182 + result[current_option] += " " + line.lstrip()
183 +
184 + return result
185 +
186 +
187 +def apply_min_indent(text, min_indent):
188 + """
189 + Make sure all lines in a text are have a minimum indentation.
190 +
191 + Args:
192 + text (`str`): The text to treat.
193 + min_indent (`int`): The minimal indentation.
194 +
195 + Returns:
196 + `str`: The processed text.
197 + """
198 + lines = text.split("\n")
199 + idx = 0
200 + while idx < len(lines):
201 + if is_empty_line(lines[idx]):
202 + idx += 1
203 + continue
204 + indent = find_indent(lines[idx])
205 + if indent < min_indent:
206 + while idx < len(lines) and (find_indent(lines[idx]) >= indent or is_empty_line(lines[idx])):
207 + if not is_empty_line(lines[idx]):
208 + lines[idx] = " " * (min_indent - indent) + lines[idx]
209 + idx += 1
210 + else:
211 + idx += 1
212 +
213 + return "\n".join(lines)
214 +
215 +
216 +def convert_rst_blocks(text, page_info):
217 + """
218 + Converts rst special blocks (examples, notes) into MDX.
219 + """
220 + if "package_name" not in page_info:
221 + raise ValueError("`page_info` must contain at least the package_name.")
222 + package_name = page_info["package_name"]
223 + version = page_info.get("version", "main")
224 + language = page_info.get("language", "en")
225 +
226 + lines = text.split("\n")
227 + idx = 0
228 + new_lines = []
229 + while idx < len(lines):
230 + block_type = None
231 + block_info = None
232 + if _re_block.search(lines[idx]) is not None:
233 + block_type = _re_block.search(lines[idx]).groups()[0]
234 + if _re_block_info.search(lines[idx]) is not None:
235 + block_info = _re_block_info.search(lines[idx]).groups()[0]
236 + elif _re_example.search(lines[idx]) is not None:
237 + block_type = "code-block-example"
238 + block_info = "python"
239 + example_name = _re_example.search(lines[idx]).groups()[0]
240 + new_lines.append(f"<exampletitle>{example_name}:</exampletitle>\n")
241 + elif lines[idx].strip() == "..":
242 + block_type = "comment"
243 + elif lines[idx].strip() == "::":
244 + block_type = "code-block"
245 +
246 + if block_type is not None:
247 + block_indent = find_indent(lines[idx])
248 + # Find the next nonempty line
249 + idx += 1
250 + while idx < len(lines) and is_empty_line(lines[idx]):
251 + idx += 1
252 + # Grab the indent of the return line, this block will stop when we unindent under it (or has already)
253 + example_indent = find_indent(lines[idx]) if idx < len(lines) else block_indent
254 +
255 + if example_indent == block_indent:
256 + block_content = ""
257 + else:
258 + block_lines = []
259 + while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) >= example_indent):
260 + block_lines.append(lines[idx][example_indent:])
261 + idx += 1
262 + block_content = "\n".join(block_lines)
263 +
264 + if block_type in ["code", "code-block"]:
265 + prefix = "```" if block_info is None else f"```{block_info}"
266 + new_lines.append(f"{prefix}\n{block_content.strip()}\n```\n")
267 + elif block_type == "code-block-example":
268 + prefix = f"<example>```{block_info}"
269 + new_lines.append(f"{prefix}\n{block_content.strip()}\n```\n</example>")
270 + elif block_type == "note":
271 + new_lines.append(apply_min_indent(f"<Tip>\n\n{block_content.strip()}\n\n</Tip>\n", block_indent))
272 + elif block_type == "warning":
273 + new_lines.append(
274 + apply_min_indent("<Tip warning={true}>\n\n" + f"{block_content.strip()}\n\n</Tip>\n", block_indent)
275 + )
276 + elif block_type == "raw":
277 + new_lines.append(block_content.strip() + "\n")
278 + elif block_type == "math":
279 + new_lines.append(f"$${block_content.strip()}$$\n")
280 + elif block_type == "comment":
281 + new_lines.append(f"<!--{block_content.strip()}\n-->\n")
282 + elif block_type == "autofunction":
283 + if block_info is not None:
284 + new_lines.append(f"[[autodoc]] {block_info}\n")
285 + elif block_type == "autoclass":
286 + if block_info is not None:
287 + block = f"[[autodoc]] {block_info}\n"
288 + options = parse_options(block_content)
289 + if "special-members" in options:
290 + special_members = options["special-members"].split(", ")
291 + for special_member in special_members:
292 + block += f" - {special_member}\n"
293 + if "members" in options:
294 + members = options["members"]
295 + if len(members) == 0:
296 + block += " - all\n"
297 + else:
298 + for member in members.split(", "):
299 + block += f" - {member}\n"
300 + new_lines.append(block)
301 + elif block_type == "image":
302 + options = parse_options(block_content)
303 + target = options.pop("target", None)
304 + if block_info is not None:
305 + options["src"] = block_info
306 + else:
307 + if target is None:
308 + raise ValueError("Image source not defined.")
309 + options["src"] = target
310 + # Adapt path
311 + options["src"] = options["src"].replace("/imgs/", f"/docs/{package_name}/{version}/{language}/imgs/")
312 + html_code = " ".join([f'{key}="{value}"' for key, value in options.items()])
313 + new_lines.append(f"<img {html_code}/>\n")
314 +
315 + else:
316 + new_lines.append(f"{block_type},{block_info}\n{block_content.rstrip()}\n")
317 +
318 + else:
319 + new_lines.append(lines[idx])
320 + idx += 1
321 +
322 + return "\n".join(new_lines)
323 +
324 +
325 +# Re pattern that catches rst args blocks of the form `Parameters:`.
326 +_re_args = re.compile(r"^\s*(Args?|Arguments?|Attributes?|Params?|Parameters?):\s*$")
327 +# Re pattern that catches return blocks of the form `Return:`.
328 +_re_returns = re.compile(r"^\s*(Return|Yield|Raise)s?:\s*$")
329 +
330 +
331 +def split_return_line(line):
332 + """
333 + Split the return line with format `type: some doc`. Type may contain colons in the form of :obj: or :class:.
334 + """
335 + splits_on_colon = line.split(":")
336 + idx = 1
337 + while idx < len(splits_on_colon) and splits_on_colon[idx] in ["obj", "class"]:
338 + idx += 2
339 + if idx >= len(splits_on_colon):
340 + if len(splits_on_colon) % 2 == 1 and re.search(r"`\w+`$", line.rstrip()):
341 + return line, ""
342 + return None, line
343 + return ":".join(splits_on_colon[:idx]), ":".join(splits_on_colon[idx:])
344 +
345 +
346 +def split_raise_line(line):
347 + """
348 + Split the raise line with format `SomeError some doc`.
349 + """
350 + splits_on_colon = line.strip().split(" ")
351 + error_type, doc = splits_on_colon[0], " ".join(splits_on_colon[1:])
352 + if error_type and error_type[-1] == ":":
353 + error_type = error_type[:-1]
354 + return error_type, doc
355 +
356 +
357 +def split_arg_line(line):
358 + """
359 + Split the return line with format `type: some doc`. Type may contain colons in the form of :obj: or :class:.
360 + """
361 + splits_on_colon = line.split(":")
362 + idx = 1
363 + while idx < len(splits_on_colon) and splits_on_colon[idx] in ["obj", "class"]:
364 + idx += 2
365 + if idx >= len(splits_on_colon):
366 + return line, ""
367 + return ":".join(splits_on_colon[:idx]), ":".join(splits_on_colon[idx:])
368 +
369 +
370 +class InvalidRstDocstringError(ValueError):
371 + pass
372 +
373 +
374 +_re_parameters = re.compile(r"<parameters>(((?!<parameters>).)*)</parameters>", re.DOTALL)
375 +_re_md_link = re.compile(r"\[(.+)\]\(.+\)", re.DOTALL)
376 +
377 +
378 +def parse_rst_docstring(docstring):
379 + """
380 + Parses a docstring written in rst, in particular the list of arguments and the return type.
381 + """
382 + lines = docstring.split("\n")
383 + idx = 0
384 + while idx < len(lines):
385 + # Parameters section
386 + if _re_args.search(lines[idx]) is not None:
387 + # Title of the section.
388 + lines[idx] = "<parameters>\n"
389 + # Find the next nonempty line
390 + idx += 1
391 + while is_empty_line(lines[idx]):
392 + idx += 1
393 + # Grab the indent of the list of parameters, this block will stop when we unindent under it or we see the
394 + # Returns or Raises block.
395 + param_indent = find_indent(lines[idx])
396 + while (
397 + idx < len(lines) and find_indent(lines[idx]) == param_indent and _re_returns.search(lines[idx]) is None
398 + ):
399 + intro, doc = split_arg_line(lines[idx])
400 + # Line starting with a > after indent indicate a "section title" in the parameters.
401 + if intro.lstrip().startswith(">"):
402 + lines[idx] = intro.lstrip()
403 + else:
404 + lines[idx] = re.sub(r"^\s*(\S+)(\s)?", r"- **\1**\2", intro) + " --" + doc
405 + idx += 1
406 + while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) > param_indent):
407 + idx += 1
408 + lines.insert(idx, "</parameters>\n")
409 + idx += 1
410 +
411 + # Returns section
412 + elif _re_returns.search(lines[idx]) is not None:
413 + # tag is either `return` or `yield`
414 + tag = _re_returns.match(lines[idx]).group(1).lower()
415 + # Title of the section.
416 + lines[idx] = f"<{tag}s>\n"
417 + # Find the next nonempty line
418 + idx += 1
419 + while is_empty_line(lines[idx]):
420 + idx += 1
421 +
422 + # Grab the indent of the return line, this block will stop when we unindent under it.
423 + return_indent = find_indent(lines[idx])
424 + raised_errors = []
425 + # The line may contain the return type.
426 + if tag in ["return", "yield"]:
427 + return_type, return_description = split_return_line(lines[idx])
428 + lines[idx] = return_description
429 + idx += 1
430 + while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) >= return_indent):
431 + idx += 1
432 + else:
433 + while idx < len(lines) and find_indent(lines[idx]) == return_indent:
434 + return_type, return_description = split_raise_line(lines[idx])
435 + raised_error = re.sub(r"^\s*`?([\w\.]*)`?$", r"``\1``", return_type)
436 + lines[idx] = "- " + raised_error + " -- " + return_description
437 + md_link = _re_md_link.match(raised_error)
438 + if md_link:
439 + raised_error = md_link[1]
440 + raised_error = re.sub(r"^\s*`?([\w\.]*)`?$", r"``\1``", raised_error)
441 + if raised_error not in raised_errors:
442 + raised_errors.append(raised_error)
443 + idx += 1
444 + while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) > return_indent):
445 + idx += 1
446 +
447 + lines.insert(idx, f"</{tag}s>\n")
448 + idx += 1
449 +
450 + # Return block finished, we insert the return type if one was specified
451 + if tag in ["return", "yield"] and return_type is not None:
452 + lines[idx - 1] += f"\n<{tag}type>{return_type}</{tag}type>\n"
453 + elif len(raised_errors) > 0:
454 + # raised errors
455 + lines[idx - 1] += f"\n<raisederrors>{' or '.join(raised_errors)}</raisederrors>\n"
456 +
457 + else:
458 + idx += 1
459 +
460 + result = "\n".join(lines)
461 +
462 + # combine multiple <parameters> blocks into one block
463 + if result.count("<parameters>") > 1:
464 + parameters_blocks = _re_parameters.findall(result)
465 + parameters_blocks = [pb[0].strip() for pb in parameters_blocks]
466 + parameters_str = "\n".join(parameters_blocks)
467 + result = _re_parameters.sub("", result)
468 + result += f"\n<parameters>{parameters_str}</parameters>\n"
469 +
470 + return result
471 +
472 +
473 +_re_list = re.compile(r"^\s*(-|\*|\d+\.)\s")
474 +_re_autodoc = re.compile(r"^\s*\[\[autodoc\]\]\s+(\S+)\s*$")
475 +
476 +
477 +def remove_indent(text):
478 + """
479 + Remove indents in text, except the one linked to lists (or sublists).
480 + """
481 + lines = text.split("\n")
482 + # List of indents to remember for nested lists
483 + current_indents = []
484 + # List of new indents to remember for nested lists
485 + new_indents = []
486 + is_inside_code = False
487 + code_indent = 0
488 + for idx, line in enumerate(lines):
489 + # Line is an item in a list.
490 + if _re_list.search(line) is not None:
491 + indent = find_indent(line)
492 + # Is it a new list / new level of nestedness?
493 + if len(current_indents) == 0 or indent > current_indents[-1]:
494 + current_indents.append(indent)
495 + new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
496 + lines[idx] = " " * new_indent + line[indent:]
497 + new_indent += len(_re_list.search(line).groups()[0]) + 1
498 + new_indents.append(new_indent)
499 + # Otherwise it's an existing level of list (current one, or previous one)
500 + else:
501 + # Let's find the proper level of indentation
502 + level = len(current_indents) - 1
503 + while level >= 0 and current_indents[level] != indent:
504 + level -= 1
505 + current_indents = current_indents[: level + 1]
506 + new_indents = new_indents[:level]
507 + new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
508 + lines[idx] = " " * new_indent + line[indent:]
509 + new_indent += len(_re_list.search(line).groups()[0]) + 1
510 + new_indents.append(new_indent)
511 +
512 + # Line is an autodoc, we keep the indent for the list just after if there is one.
513 + elif _re_autodoc.search(line) is not None:
514 + indent = find_indent(line)
515 + current_indents = [indent]
516 + new_indents = [4]
517 + lines[idx] = line.strip()
518 +
519 + # Deal with empty lines separately
520 + elif is_empty_line(line):
521 + lines[idx] = ""
522 +
523 + # Code blocks
524 + elif line.lstrip().startswith("```"):
525 + is_inside_code = not is_inside_code
526 + if is_inside_code:
527 + code_indent = find_indent(line)
528 + lines[idx] = line[code_indent:]
529 + elif is_inside_code:
530 + lines[idx] = line[code_indent:]
531 +
532 + else:
533 + indent = find_indent(line)
534 + if len(current_indents) > 0 and indent > current_indents[-1]:
535 + lines[idx] = " " * new_indents[-1] + line[indent:]
536 + elif len(current_indents) > 0:
537 + # Let's find the proper level of indentation
538 + level = len(current_indents) - 1
539 + while level >= 0 and current_indents[level] > indent:
540 + level -= 1
541 + current_indents = current_indents[: level + 1]
542 + if level >= 0:
543 + if current_indents[level] < indent:
544 + new_indents = new_indents[: level + 1]
545 + else:
546 + new_indents = new_indents[:level]
547 + new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
548 + lines[idx] = " " * new_indent + line[indent:]
549 + new_indents.append(new_indent)
550 + else:
551 + new_indents = []
552 + lines[idx] = line[indent:]
553 + else:
554 + lines[idx] = line[indent:]
555 +
556 + return "\n".join(lines)
557 +
558 +
559 +def base_rst_to_mdx(text, page_info, unindent=True):
560 + """
561 + Convert a text from rst to mdx, with the base operations necessary for both docstrings and rst docs.
562 + """
563 + text = convert_rst_links(text, page_info)
564 + text = convert_special_chars(text)
565 + text = convert_rst_blocks(text, page_info)
566 + # Convert * in lists to - to avoid the formatting conversion treat them as bold.
567 + text = re.sub(r"^(\s*)\*(\s)", r"\1-\2", text, flags=re.MULTILINE)
568 + text = convert_rst_formatting(text)
569 + return remove_indent(text) if unindent else text
570 +
571 +
572 +def convert_rst_docstring_to_mdx(docstring, page_info):
573 + """
574 + Convert a docstring written in rst to mdx.
575 + """
576 + text = parse_rst_docstring(docstring)
577 + return base_rst_to_mdx(text, page_info)
578 +
579 +
580 +def process_titles(lines):
581 + """Converts rst titles to markdown titles."""
582 + title_chars = """= - ` : ' " ~ ^ _ * + # < >""".split(" ")
583 + title_levels = {}
584 + new_lines = []
585 + for line in lines:
586 + if (
587 + len(new_lines) > 0
588 + and len(line) >= len(new_lines[-1])
589 + and len(set(line)) == 1
590 + and line[0] in title_chars
591 + and line != "::"
592 + ):
593 + char = line[0]
594 + level = title_levels.get(char, len(title_levels) + 1)
595 + if level not in title_levels:
596 + title_levels[char] = level
597 + new_lines[-1] = f"{'#' * level} {new_lines[-1]}"
598 + else:
599 + new_lines.append(line)
600 + return new_lines
601 +
602 +
603 +# Matches lines with a pattern of a table new line in rst.
604 +_re_ignore_line_table = re.compile(r"^(\+[\-\s]+)+\+\s*$")
605 +# Matches lines with a pattern of a table new line in rst, with a first column empty.
606 +_re_ignore_line_table1 = re.compile(r"^\|\s+(\+[\-\s]+)+\+\s*$")
607 +# Matches lines with a pattern of a first table line in rst.
608 +_re_sep_line_table = re.compile(r"^(\+[=\s]+)+\+\s*$")
609 +# Re pattern that catches anchors of the type .. reference:
610 +_re_anchor_section = re.compile(r"^\.\.\s+_(\S+):")
611 +
612 +
613 +def split_pt_tf_code_blocks(text):
614 + """
615 + Split PyTorch and TensorFlow specific block codes.
616 + """
617 + lines = text.split("\n")
618 + new_lines = []
619 + idx = 0
620 + while idx < len(lines):
621 + if lines[idx].startswith("```"):
622 + code_lines = {"common": [lines[idx]], "pytorch": [], "tensorflow": []}
623 + is_pytorch = False
624 + is_tensorflow = False
625 + idx += 1
626 + while idx < len(lines) and lines[idx].strip() != "```":
627 + if "## PYTORCH CODE" in lines[idx]:
628 + is_pytorch = True
629 + is_tensorflow = False
630 + elif "## TENSORFLOW CODE" in lines[idx]:
631 + is_tensorflow = True
632 + is_pytorch = False
633 + elif is_pytorch:
634 + code_lines["pytorch"].append(lines[idx])
635 + elif is_tensorflow:
636 + code_lines["tensorflow"].append(lines[idx])
637 + else:
638 + code_lines["common"].append(lines[idx])
639 + idx += 1
640 + if len(code_lines["pytorch"]) > 0 or len(code_lines["tensorflow"]) > 0:
641 + block_lines = ["<frameworkcontent>", "<pt>"]
642 + block_lines.extend(code_lines["common"].copy() + code_lines["pytorch"])
643 + block_lines.extend(["```", "</pt>", "<tf>"])
644 + block_lines.extend(code_lines["common"].copy() + code_lines["tensorflow"])
645 + block_lines.extend(["```", "</tf>", "</frameworkcontent>"])
646 + new_lines.extend(block_lines)
647 + else:
648 + block_lines = code_lines["common"] + ["```"]
649 + new_lines.extend(block_lines)
650 + idx += 1
651 + else:
652 + new_lines.append(lines[idx])
653 + idx += 1
654 + return "\n".join(new_lines)
655 +
656 +
657 +def convert_rst_to_mdx(rst_text, page_info, add_imports=True):
658 + """
659 + Convert a document written in rst to mdx.
660 + """
661 + lines = rst_text.split("\n")
662 + lines = process_titles(lines)
663 + if add_imports:
664 + new_lines = [
665 + '<script lang="ts">',
666 + ' import Tip from "$lib/Tip.svelte";',
667 + ' import Youtube from "$lib/Youtube.svelte";',
668 + ' import Docstring from "$lib/Docstring.svelte";',
669 + ' import CodeBlock from "$lib/CodeBlock.svelte";',
670 + ' import CodeBlockFw from "$lib/CodeBlockFw.svelte";',
671 + ' import DocNotebookDropdown from "$lib/DocNotebookDropdown.svelte";',
672 + ' import CourseFloatingBanner from "$lib/CourseFloatingBanner.svelte";',
673 + ' import IconCopyLink from "$lib/IconCopyLink.svelte";',
674 + ' import FrameworkContent from "$lib/FrameworkContent.svelte";',
675 + ' import Markdown from "$lib/Markdown.svelte";',
676 + ' import ExampleCodeBlock from "$lib/ExampleCodeBlock.svelte";',
677 + ' import Added from "$lib/Added.svelte";',
678 + ' import Changed from "$lib/Changed.svelte";',
679 + ' import Deprecated from "$lib/Deprecated.svelte";',
680 + ' import PipelineIcon from "$lib/PipelineIcon.svelte";',
681 + ' import PipelineTag from "$lib/PipelineTag.svelte";',
682 + " ",
683 + ' export let fw: "pt" | "tf"',
684 + "</script>",
685 + "<svelte:head>",
686 + '<meta name="hf:doc:metadata" content={JSON.stringify(metadata)} >',
687 + "</svelte:head>",
688 + "",
689 + ]
690 + else:
691 + new_lines = []
692 + for line in lines:
693 + if _re_ignore_line_table.search(line) is not None:
694 + continue
695 + elif _re_ignore_line_table1.search(line) is not None:
696 + continue
697 + elif _re_sep_line_table.search(line) is not None:
698 + line = line.replace("=", "-").replace("+", "|")
699 + elif _re_anchor_section.search(line) is not None:
700 + anchor_name = _re_anchor_section.search(line).groups()[0]
701 + line = f"<a id='{anchor_name}'></a>"
702 + new_lines.append(line)
703 + text = "\n".join(new_lines)
704 +
705 + return split_pt_tf_code_blocks(base_rst_to_mdx(text, page_info))
fern/generators/python-sdk/autodoc_core/external.py new
+153
@@ -0,0 +1,153 @@
1 +# coding=utf-8
2 +# Copyright 2022 The HuggingFace Team. All rights reserved.
3 +#
4 +# Licensed under the Apache License, Version 2.0 (the "License");
5 +# you may not use this file except in compliance with the License.
6 +# You may obtain a copy of the License at
7 +#
8 +# http://www.apache.org/licenses/LICENSE-2.0
9 +#
10 +# Unless required by applicable law or agreed to in writing, software
11 +# distributed under the License is distributed on an "AS IS" BASIS,
12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +# See the License for the specific language governing permissions and
14 +# limitations under the License.
15 +
16 +import os
17 +import re
18 +import tempfile
19 +import zlib
20 +
21 +import git
22 +import requests
23 +
24 +
25 +HF_DOC_PREFIX = "https://huggingface.co/docs/"
26 +EXTERNAL_DOC_OBJECTS_CACHE = {}
27 +HUGGINFACE_LIBS = [
28 + "accelerate",
29 + "datasets",
30 + "evaluate",
31 + "huggingface_hub",
32 + "optimum",
33 + "tokenizers",
34 + "transformers",
35 + "trl",
36 +]
37 +
38 +
39 +def post_process_objects_inv(object_data, doc_url):
40 + """
41 + Post-processes the data in sphinx-like format to get a dictionary object_name: link in doc.
42 +
43 + Args:
44 + object_data (`str`): The data in the `objects.inv` object (except the first 4 lines).
45 + doc_url (`str`): The documentation url of the package.
46 + """
47 + links = {}
48 + for line in object_data:
49 + if len(line) == 0:
50 + continue
51 + name, typ, _, link = line.split(" ")[:4]
52 + if typ in ["py:class", "py:function", "py:method"]:
53 + link = link.replace("$", name)
54 + links[name] = f"{doc_url}/{link}"
55 + return links
56 +
57 +
58 +def get_stable_version(package_name, repo_owner="huggingface", repo_name=None):
59 + """
60 + Gets the version of the last release of a package.
61 +
62 + Args:
63 + package_name (`str`): The name of the package.
64 + repo_owner (`str`): The owner of the GitHub repo.
65 + repo_name (`str`, *optional*, defaults to `package_name`):
66 + The name of the GitHub repo. If not provided, will be the same as the package name.
67 + """
68 + repo_name = repo_name if repo_name is not None else package_name
69 + github_url = f"https://github.com/{repo_owner}/{repo_name}"
70 + try:
71 + # Get the version tags from the GitHub repo in decreasing order (that's what '-v:refname' means)
72 + result = git.cmd.Git().ls_remote(github_url, sort="-v:refname", tags=True)
73 + except git.GitCommandError:
74 + return "main"
75 +
76 + # One line per tag
77 + for line in result.split("\n"):
78 + # Lines returned are {sha}\trefs/tags/{tag}^{}, we grab the tag
79 + candidate = line.split("/")[-1].replace("^", "").replace("{}", "")
80 + # Some tags are not versions (looking at your VERSION and delete tags Datasets)
81 + if re.search(r"v?\d+\.\d+\.\d+", candidate):
82 + # Add the v is missing (looking at you Datasets :-p)
83 + return candidate if candidate.startswith("v") else f"v{candidate}"
84 +
85 + return "main"
86 +
87 +
88 +def get_objects_map(package_name, version="main", language="en", repo_owner="huggingface", repo_name=None):
89 + """
90 + Downloads the `objects.inv` for a package and post-processes it to get a nice dictionary.
91 +
92 + Args:
93 + package_name (`str`): The name of the external package.
94 + version (`str`, *optional*, defaults to `"main"`): The version of the package for which documentation is built.
95 + language (`str`, *optional*, defaults to `"en"`): The language of the documentation being built.
96 + repo_owner (`str`, *optional*, defaults to `"huggingface"`): The owner of the GitHub repo.
97 + repo_name (`str`, *optional*, defaults to `package_name`):
98 + The name of the GitHub repo. If not provided, it will be the same as the package name.
99 + """
100 + repo_name = repo_name if repo_name is not None else package_name
101 + # We link to main in `package_name` from the main doc (or PR docs) but to the last stable release otherwise.
102 + if version in ["main", "master"] or version.startswith("pr_"):
103 + package_version = "main"
104 + else:
105 + package_version = get_stable_version(package_name, repo_owner, repo_name)
106 +
107 + doc_url = f"{HF_DOC_PREFIX}{package_name}/{package_version}/{language}"
108 + url = f"{doc_url}/objects.inv"
109 + try:
110 + request = requests.get(url, stream=True)
111 + request.raise_for_status()
112 + with tempfile.TemporaryDirectory() as tmp_dir:
113 + tmp_file = os.path.join(tmp_dir, "objects.inv")
114 + with open(tmp_file, "ab") as writer:
115 + for chunk in request.iter_content(chunk_size=1024):
116 + if chunk: # filter out keep-alive new chunks
117 + writer.write(chunk)
118 +
119 + with open(tmp_file, "rb") as reader:
120 + object_lines = reader.readlines()[4:]
121 + object_data = zlib.decompress(b"".join(object_lines)).decode().split("\n")
122 + return post_process_objects_inv(object_data, doc_url)
123 + except Exception:
124 + return {}
125 +
126 +
127 +def get_external_object_link(object_name, page_info):
128 + if object_name.startswith("~"):
129 + object_name = object_name[1:]
130 + link_name = object_name.split(".")[-1]
131 + else:
132 + link_name = object_name
133 +
134 + version = page_info.get("version", "main")
135 + language = page_info.get("language", "en")
136 + if language != "en":
137 + # No resolving for other languages then English as we don't translate API doc pages/docstrings for now.
138 + return f"`{link_name}`"
139 +
140 + package_name = object_name.split(".")[0]
141 + if package_name not in HUGGINFACE_LIBS:
142 + # No resolving for non-HF libs for now.
143 + return f"`{link_name}`"
144 +
145 + if package_name not in EXTERNAL_DOC_OBJECTS_CACHE:
146 + EXTERNAL_DOC_OBJECTS_CACHE[package_name] = get_objects_map(package_name, version=version, language=language)
147 + object_url = EXTERNAL_DOC_OBJECTS_CACHE[package_name].get(object_name, None)
148 +
149 + if object_url is None:
150 + # Object not found in the lib
151 + return f"`{link_name}`"
152 + else:
153 + return f"[{link_name}]({object_url})"
fern/generators/python-sdk/generate_docs.py new
+48
@@ -0,0 +1,48 @@
1 +#!/usr/bin/env python
2 +"""
3 +Generate SDK documentation for Composio Python SDK.
4 +
5 +Usage:
6 + uv run python generators/python-sdk/generate_docs.py
7 +"""
8 +import sys
9 +from pathlib import Path
10 +
11 +# Add current directory to path
12 +sys.path.insert(0, str(Path(__file__).parent))
13 +
14 +from process_sdk_docs import build_sdk_docs
15 +
16 +
17 +def main():
18 + """Generate SDK documentation."""
19 + fern_dir = Path(__file__).parent.parent.parent
20 + source_dir = fern_dir / "generators" / "python-sdk" / "templates"
21 + output_dir = fern_dir / "docs" / "sdk" / "python"
22 +
23 + print("Generating Composio Python SDK documentation...")
24 + print(f"Source: {source_dir}")
25 + print(f"Output: {output_dir}")
26 +
27 + try:
28 + anchors = build_sdk_docs(
29 + source_dir=source_dir,
30 + output_dir=output_dir,
31 + package_name="composio",
32 + version="main",
33 + repo_owner="composio",
34 + clean=False # Don't clean to preserve other files
35 + )
36 +
37 + print(f"\n✓ Successfully generated documentation with {len(anchors)} anchors")
38 + print(f"✓ Output written to: {output_dir}")
39 +
40 + except Exception as e:
41 + print(f"\n✗ Error generating documentation: {e}")
42 + import traceback
43 + traceback.print_exc()
44 + sys.exit(1)
45 +
46 +
47 +if __name__ == "__main__":
48 + main()
\ No newline at end of file
fern/generators/python-sdk/markdown_formatter.py new
+286
@@ -0,0 +1,286 @@
1 +"""
2 +Custom markdown formatter for autodoc output
3 +"""
4 +import json
5 +import re
6 +from typing import List, Dict, Optional, Tuple
7 +
8 +def format_signature_markdown(name: str, anchor: str, signature: List[Dict[str, str]],
9 + object_doc: str, source_link: Optional[str] = None,
10 + is_getset_desc: bool = False) -> str:
11 + """
12 + Generate markdown documentation instead of XML/Svelte components.
13 +
14 + This replaces get_signature_component() to output clean Markdown.
15 + """
16 + output = []
17 +
18 + # Extract structured data from the docstring
19 + doc_data = parse_structured_docstring(object_doc)
20 +
21 + # Add the main heading with an invisible anchor
22 + # Determine heading level based on whether it's a class or method
23 + if name.startswith('class '):
24 + class_name = name.replace('class ', '')
25 + heading = f'<a id="{anchor}"></a>\n\n### `{class_name}`\n'
26 + elif '.' in anchor and not name.startswith('class'):
27 + # This is a method - use h4
28 + heading = f'<a id="{anchor}"></a>\n\n#### `{name}`\n'
29 + else:
30 + heading = f'<a id="{anchor}"></a>\n\n### `{name}`\n'
31 + output.append(heading)
32 +
33 + # Add source link if available
34 + if source_link:
35 + output.append(f"[View source]({source_link})\n")
36 +
37 + # Add signature
38 + if signature and not is_getset_desc:
39 + params = []
40 + for param in signature:
41 + param_str = param["name"] + param["val"]
42 + params.append(param_str)
43 +
44 + # Format signature in a code block
45 + if name.startswith("class "):
46 + class_name = name.replace("class ", "")
47 + output.append(f"```python\n{class_name}({', '.join(params)})\n```\n")
48 + else:
49 + output.append(f"```python\n{name}({', '.join(params)})\n```\n")
50 +
51 + # Add the main description
52 + if doc_data['description']:
53 + output.append(doc_data['description'] + "\n")
54 +
55 + # Add parameters section
56 + if doc_data['parameters']:
57 + # Format parameters as a table
58 + table = format_parameters_table(doc_data['parameters'])
59 + output.append(table + "\n")
60 +
61 + # Add returns section
62 + if doc_data['returns']:
63 + # Parse the return description
64 + return_desc = parse_return_line(doc_data['returns'])
65 + if not return_desc:
66 + # If not in :return: format, use the raw text
67 + return_desc = doc_data['returns']
68 +
69 + # Format the return value
70 + if doc_data['return_type']:
71 + output.append(f"**Returns:** `{doc_data['return_type']}` — {return_desc}\n")
72 + else:
73 + output.append(f"**Returns:** {return_desc}\n")
74 +
75 + # Add raises section
76 + if doc_data['raises']:
77 + output.append("**Raises:**\n")
78 + output.append(doc_data['raises'] + "\n")
79 +
80 + # Add examples
81 + if doc_data['examples']:
82 + for example in doc_data['examples']:
83 + output.append(example + "\n")
84 +
85 + return "\n".join(output)
86 +
87 +
88 +def parse_param_line(line: str) -> Tuple[Optional[str], Optional[str]]:
89 + """
90 + Parse a parameter line like ":param name: description" into (name, description).
91 + """
92 + match = re.match(r':param\s+(\w+):\s*(.+)', line.strip())
93 + if match:
94 + return match.group(1), match.group(2)
95 + return None, None
96 +
97 +
98 +def parse_return_line(line: str) -> Optional[str]:
99 + """
100 + Parse a return line like ":return: description" into description.
101 + """
102 + match = re.match(r':return:\s*(.+)', line.strip())
103 + if match:
104 + return match.group(1)
105 + return None
106 +
107 +
108 +def format_parameters_table(params_text: str) -> str:
109 + """
110 + Convert parameter text into a markdown table.
111 + """
112 + lines = params_text.strip().split('\n')
113 + params = []
114 +
115 + for line in lines:
116 + name, desc = parse_param_line(line)
117 + if name and desc:
118 + params.append((name, desc))
119 +
120 + if not params:
121 + return params_text # Return original if no params found
122 +
123 + # Build markdown table
124 + table = ["| Parameter | Description |", "| --- | --- |"]
125 + for name, desc in params:
126 + # Clean up the description - remove trailing period if present
127 + desc = desc.rstrip('.')
128 + table.append(f"| `{name}` | {desc} |")
129 +
130 + return "\n".join(table)
131 +
132 +
133 +def parse_structured_docstring(docstring: str) -> Dict[str, any]:
134 + """
135 + Parse the structured docstring that contains XML tags and extract the data.
136 + Also handles RST-style parameter documentation.
137 + """
138 + data = {
139 + 'description': '',
140 + 'parameters': None,
141 + 'returns': None,
142 + 'return_type': None,
143 + 'raises': None,
144 + 'examples': []
145 + }
146 +
147 + # First, check for XML-wrapped sections
148 + # Parameters
149 + params_match = re.search(r'<parameters>(.*?)</parameters>', docstring, re.DOTALL)
150 + if params_match:
151 + data['parameters'] = params_match.group(1).strip()
152 + docstring = docstring.replace(params_match.group(0), '')
153 +
154 + # Returns
155 + returns_match = re.search(r'<returns>(.*?)</returns>', docstring, re.DOTALL)
156 + if returns_match:
157 + data['returns'] = returns_match.group(1).strip()
158 + docstring = docstring.replace(returns_match.group(0), '')
159 +
160 + # Return type
161 + rettype_match = re.search(r'<returntype>(.*?)</returntype>', docstring, re.DOTALL)
162 + if rettype_match:
163 + data['return_type'] = rettype_match.group(1).strip()
164 + docstring = docstring.replace(rettype_match.group(0), '')
165 +
166 + # Raises
167 + raises_match = re.search(r'<raises>(.*?)</raises>', docstring, re.DOTALL)
168 + if raises_match:
169 + data['raises'] = raises_match.group(1).strip()
170 + docstring = docstring.replace(raises_match.group(0), '')
171 +
172 + # Examples
173 + example_matches = re.findall(r'<ExampleCodeBlock[^>]*>(.*?)</ExampleCodeBlock>', docstring, re.DOTALL)
174 + for match in example_matches:
175 + data['examples'].append(match.strip())
176 + docstring = docstring.replace(match, '')
177 +
178 + # If no XML parameters found, look for RST-style parameters
179 + if not data['parameters']:
180 + lines = docstring.split('\n')
181 + param_lines = []
182 + return_lines = []
183 + description_lines = []
184 + in_params = False
185 + in_return = False
186 +
187 + for line in lines:
188 + if line.strip().startswith(':param '):
189 + in_params = True
190 + in_return = False
191 + param_lines.append(line)
192 + elif line.strip().startswith(':return:'):
193 + in_params = False
194 + in_return = True
195 + return_lines.append(line)
196 + elif line.strip().startswith(':raises:') or line.strip().startswith(':rtype:'):
197 + in_params = False
198 + in_return = False
199 + # Handle other RST fields if needed
200 + elif in_params and line.strip():
201 + param_lines.append(line)
202 + elif in_return and line.strip():
203 + return_lines.append(line)
204 + elif not in_params and not in_return and not line.strip().startswith(':'):
205 + description_lines.append(line)
206 +
207 + if param_lines:
208 + data['parameters'] = '\n'.join(param_lines)
209 + if return_lines:
210 + data['returns'] = '\n'.join(return_lines)
211 +
212 + # Clean up description
213 + data['description'] = '\n'.join(description_lines).strip()
214 + else:
215 + # The remaining docstring is the description
216 + data['description'] = docstring.strip()
217 +
218 + return data
219 +
220 +
221 +def create_custom_autodoc(original_autodoc):
222 + """
223 + Wrapper that modifies autodoc to use markdown formatting.
224 + """
225 + def markdown_autodoc(object_name, package, methods=None, return_anchors=False,
226 + page_info=None, version_tag_suffix="src/"):
227 + # Get the original result
228 + result = original_autodoc(object_name, package, methods=methods,
229 + return_anchors=return_anchors, page_info=page_info,
230 + version_tag_suffix=version_tag_suffix)
231 +
232 + if return_anchors:
233 + doc, anchors, errors = result
234 + # Convert the XML documentation to markdown
235 + doc = convert_xml_to_markdown(doc)
236 + return doc, anchors, errors
237 + else:
238 + # Convert the XML documentation to markdown
239 + return convert_xml_to_markdown(result)
240 +
241 + return markdown_autodoc
242 +
243 +
244 +def convert_xml_to_markdown(xml_doc: str) -> str:
245 + """
246 + Convert the XML/Svelte component output to clean Markdown.
247 + """
248 + output_parts = []
249 +
250 + # Remove all wrapping divs
251 + xml_doc = re.sub(r'<div class="[^"]*">\s*', '', xml_doc, flags=re.DOTALL)
252 + xml_doc = re.sub(r'</div>\s*', '', xml_doc, flags=re.DOTALL)
253 +
254 + # Find all docstring components (main class + methods)
255 + docstring_pattern = r'<docstring>(.*?)</docstring>(.*?)(?=<docstring>|$)'
256 + matches = re.findall(docstring_pattern, xml_doc, re.DOTALL)
257 +
258 + if not matches:
259 + # No docstring components found, return as-is
260 + return xml_doc
261 +
262 + for docstring_content, remaining_doc in matches:
263 + # Parse each docstring component
264 + name_match = re.search(r'<name>(.*?)</name>', docstring_content)
265 + anchor_match = re.search(r'<anchor>(.*?)</anchor>', docstring_content)
266 + source_match = re.search(r'<source>(.*?)</source>', docstring_content)
267 + params_match = re.search(r'<parameters>(.*?)</parameters>', docstring_content)
268 +
269 + name = name_match.group(1) if name_match else ""
270 + anchor = anchor_match.group(1) if anchor_match else ""
271 + source = source_match.group(1) if source_match else None
272 +
273 + # Parse parameters
274 + signature = []
275 + if params_match:
276 + try:
277 + signature = json.loads(params_match.group(1))
278 + except:
279 + pass
280 +
281 + # Format this component
282 + formatted = format_signature_markdown(name, anchor, signature, remaining_doc.strip(), source)
283 + output_parts.append(formatted)
284 +
285 + # Join all parts with appropriate spacing
286 + return "\n\n".join(output_parts)
\ No newline at end of file
fern/generators/python-sdk/process_sdk_docs.py new
+208
@@ -0,0 +1,208 @@
1 +#!/usr/bin/env python
2 +"""
3 +Process SDK documentation files with autodoc markers.
4 +
5 +This is a simplified version that doesn't require toctree validation.
6 +"""
7 +import os
8 +import re
9 +import importlib
10 +import logging
11 +from pathlib import Path
12 +from typing import Dict, Optional, Tuple
13 +from tqdm import tqdm
14 +
15 +from autodoc_core.autodoc import autodoc, resolve_links_in_text
16 +from markdown_formatter import convert_xml_to_markdown
17 +
18 +# Pattern to find [[autodoc]] markers
19 +_re_autodoc = re.compile(r"^\s*\[\[autodoc\]\]\s+(\S+)\s*$")
20 +
21 +# Setup logging
22 +logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
23 +logger = logging.getLogger(__name__)
24 +
25 +
26 +def process_autodoc_file(
27 + file_path: Path,
28 + package,
29 + page_info: Dict[str, str],
30 + version_tag_suffix: str = "src/"
31 +) -> Tuple[str, Dict[str, str]]:
32 + """
33 + Process a single file containing autodoc markers.
34 +
35 + Args:
36 + file_path: Path to the markdown file
37 + package: The Python package to document
38 + page_info: Information about the documentation page
39 + version_tag_suffix: Suffix for version tags in links
40 +
41 + Returns:
42 + Tuple of (processed content, anchor mapping)
43 + """
44 + with open(file_path, 'r', encoding='utf-8') as f:
45 + lines = f.read().split('\n')
46 +
47 + new_lines = []
48 + idx = 0
49 + anchors = {}
50 +
51 + while idx < len(lines):
52 + if _re_autodoc.search(lines[idx]) is not None:
53 + object_name = _re_autodoc.search(lines[idx]).groups()[0]
54 + logger.info(f"Processing autodoc: {object_name}")
55 +
56 + try:
57 + result = autodoc(
58 + object_name,
59 + package,
60 + return_anchors=True,
61 + page_info=page_info,
62 + version_tag_suffix=version_tag_suffix
63 + )
64 +
65 + doc, new_anchors, errors = result
66 + doc = convert_xml_to_markdown(doc)
67 +
68 + # Collect anchors
69 + page_name = file_path.stem
70 + for anchor in new_anchors:
71 + if isinstance(anchor, tuple):
72 + for a in anchor:
73 + anchors[a] = page_name
74 + else:
75 + anchors[anchor] = page_name
76 +
77 + if errors:
78 + logger.warning(f"Autodoc warnings for {object_name}: {errors}")
79 +
80 + new_lines.append(doc.strip())
81 +
82 + except Exception as e:
83 + logger.error(f"Error processing {object_name}: {e}")
84 + new_lines.append(lines[idx])
85 + else:
86 + new_lines.append(lines[idx])
87 +
88 + idx += 1
89 +
90 + content = '\n'.join(new_lines)
91 + return content, anchors
92 +
93 +
94 +def build_sdk_docs(
95 + source_dir: Path,
96 + output_dir: Path,
97 + package_name: str,
98 + version: str = "main",
99 + repo_owner: str = "composio",
100 + repo_name: Optional[str] = None,
101 + clean: bool = False
102 +):
103 + """
104 + Build SDK documentation from markdown files with autodoc markers.
105 +
106 + Args:
107 + source_dir: Directory containing source markdown files
108 + output_dir: Directory where processed files will be written
109 + package_name: Name of the Python package to document
110 + version: Version of the documentation
111 + repo_owner: Owner of the GitHub repository
112 + repo_name: Name of the GitHub repository (defaults to package_name)
113 + clean: Whether to clean the output directory before building
114 + """
115 + source_dir = Path(source_dir)
116 + output_dir = Path(output_dir)
117 +
118 + if not source_dir.exists():
119 + raise ValueError(f"Source directory {source_dir} does not exist")
120 +
121 + # Clean output directory if requested
122 + if clean and output_dir.exists():
123 + import shutil
124 + shutil.rmtree(output_dir)
125 +
126 + output_dir.mkdir(parents=True, exist_ok=True)
127 +
128 + # Import the package
129 + try:
130 + package = importlib.import_module(package_name)
131 + except ImportError as e:
132 + raise ImportError(f"Failed to import package {package_name}: {e}")
133 +
134 + # Page info for documentation
135 + page_info = {
136 + "version": version,
137 + "version_tag": version,
138 + "language": "en",
139 + "package_name": package_name,
140 + "repo_owner": repo_owner,
141 + "repo_name": repo_name or package_name,
142 + }
143 +
144 + # Phase 1: Process all files and collect anchors
145 + logger.info("Phase 1: Processing autodoc markers and collecting anchors")
146 + all_anchors = {}
147 + file_contents = {}
148 +
149 + markdown_files = list(source_dir.glob("**/*.md")) + list(source_dir.glob("**/*.mdx"))
150 +
151 + for file_path in tqdm(markdown_files, desc="Processing files"):
152 + if file_path.is_file():
153 + logger.info(f"Processing: {file_path}")
154 + content, anchors = process_autodoc_file(file_path, package, page_info)
155 +
156 + # Store content and anchors
157 + relative_path = file_path.relative_to(source_dir)
158 + file_contents[relative_path] = content
159 + all_anchors.update(anchors)
160 +
161 + logger.info(f"Collected {len(all_anchors)} anchors")
162 +
163 + # Phase 2: Resolve cross-references
164 + logger.info("Phase 2: Resolving cross-references")
165 +
166 + for relative_path, content in tqdm(file_contents.items(), desc="Resolving links"):
167 + # Resolve cross-references
168 + resolved_content = resolve_links_in_text(content, package, all_anchors, page_info)
169 +
170 + # Write output file
171 + output_path = output_dir / relative_path
172 + output_path.parent.mkdir(parents=True, exist_ok=True)
173 +
174 + with open(output_path, 'w', encoding='utf-8') as f:
175 + f.write(resolved_content)
176 +
177 + logger.info(f"Documentation built successfully in {output_dir}")
178 + return all_anchors
179 +
180 +
181 +def main():
182 + """CLI entry point for SDK documentation builder."""
183 + import argparse
184 +
185 + parser = argparse.ArgumentParser(description="Build SDK documentation with autodoc markers")
186 + parser.add_argument("source", help="Source directory containing markdown files")
187 + parser.add_argument("output", help="Output directory for processed files")
188 + parser.add_argument("--package", required=True, help="Python package name to document")
189 + parser.add_argument("--version", default="main", help="Documentation version")
190 + parser.add_argument("--repo-owner", default="composio", help="GitHub repository owner")
191 + parser.add_argument("--repo-name", help="GitHub repository name (defaults to package name)")
192 + parser.add_argument("--no-clean", action="store_true", help="Don't clean output directory")
193 +
194 + args = parser.parse_args()
195 +
196 + build_sdk_docs(
197 + source_dir=Path(args.source),
198 + output_dir=Path(args.output),
199 + package_name=args.package,
200 + version=args.version,
201 + repo_owner=args.repo_owner,
202 + repo_name=args.repo_name,
203 + clean=not args.no_clean
204 + )
205 +
206 +
207 +if __name__ == "__main__":
208 + main()
\ No newline at end of file
fern/generators/python-sdk/templates/index.mdx
fern/generators/python-sdk/templates/sdk-reference.md new
+55
@@ -0,0 +1,55 @@
1 +# Composio Python SDK Reference
2 +
3 +This is the comprehensive SDK reference for the Composio Python SDK.
4 +
5 +## Main SDK Class
6 +
7 +The main entry point for the Composio SDK.
8 +
9 +[[autodoc]] composio.Composio
10 +
11 +## Core Models
12 +
13 +### Tools
14 +
15 +[[autodoc]] composio.core.models.Tools
16 +
17 +### Toolkits
18 +
19 +[[autodoc]] composio.core.models.Toolkits
20 +
21 +### Connected Accounts
22 +
23 +[[autodoc]] composio.core.models.ConnectedAccounts
24 +
25 +### Auth Configs
26 +
27 +[[autodoc]] composio.core.models.AuthConfigs
28 +
29 +### Triggers
30 +
31 +[[autodoc]] composio.core.models.Triggers
32 +
33 +## Decorators
34 +
35 +### before_execute
36 +
37 +[[autodoc]] composio.before_execute
38 +
39 +### after_execute
40 +
41 +[[autodoc]] composio.after_execute
42 +
43 +### schema_modifier
44 +
45 +[[autodoc]] composio.schema_modifier
46 +
47 +## Cross References
48 +
49 +The [`Composio`] class is the main entry point for all SDK operations. It provides access to:
50 +- [`Tools`] for tool management and execution
51 +- [`Toolkits`] for toolkit operations
52 +- [`ConnectedAccounts`] for managing authentication
53 +- [`Triggers`] for webhook and event handling
54 +
55 +When you call [`Tools.execute`], it can use the [`before_execute`] and [`after_execute`] decorators to modify behavior.
\ No newline at end of file
fern/generators/python-sdk/test_generator.py new
+83
@@ -0,0 +1,83 @@
1 +#!/usr/bin/env python
2 +"""
3 +Test the SDK documentation generator
4 +"""
5 +import sys
6 +from pathlib import Path
7 +import tempfile
8 +import shutil
9 +
10 +# Add current directory to path
11 +sys.path.insert(0, str(Path(__file__).parent))
12 +
13 +from process_sdk_docs import build_sdk_docs
14 +
15 +
16 +def test_generator():
17 + """Test the documentation generator with a simple example."""
18 +
19 + # Use the actual fern directory structure
20 + fern_dir = Path(__file__).parent.parent.parent
21 + source_dir = fern_dir / "generators" / "python-sdk" / "templates"
22 + output_dir = fern_dir / "docs" / "sdk" / "python"
23 +
24 + # Create source directory if it doesn't exist
25 + source_dir.mkdir(parents=True, exist_ok=True)
26 +
27 + # Create a test markdown file
28 + test_file = source_dir / "sdk-reference.md"
29 + if not test_file.exists():
30 + test_file.write_text("""# Composio SDK Reference
31 +
32 +## Main Class
33 +
34 +[[autodoc]] composio.Composio
35 +
36 +## Tools
37 +
38 +[[autodoc]] composio.core.models.Tools
39 +
40 +## Cross References
41 +
42 +The [`Composio`] class is the main entry point.
43 +""")
44 +
45 + print(f"Created test file: {test_file}")
46 + print("Running documentation generator...")
47 +
48 + try:
49 + # Run the generator
50 + anchors = build_sdk_docs(
51 + source_dir=source_dir,
52 + output_dir=output_dir,
53 + package_name="composio",
54 + version="test",
55 + repo_owner="composio"
56 + )
57 +
58 + print(f"\nGenerated {len(anchors)} anchors")
59 + print("\nOutput files:")
60 + for file in output_dir.rglob("*"):
61 + if file.is_file():
62 + print(f" - {file.relative_to(output_dir)}")
63 + print(f" Size: {file.stat().st_size} bytes")
64 +
65 + # Read and display the output
66 + output_file = output_dir / "sdk-reference.md"
67 + if output_file.exists():
68 + print("\nGenerated content preview:")
69 + print("-" * 50)
70 + content = output_file.read_text()
71 + print(content[:500] + "..." if len(content) > 500 else content)
72 + print("-" * 50)
73 +
74 + print("\nTest completed successfully!")
75 +
76 + except Exception as e:
77 + print(f"\nError during test: {e}")
78 + import traceback
79 + traceback.print_exc()
80 +
81 +
82 +if __name__ == "__main__":
83 + test_generator()
\ No newline at end of file
fern/package.json
+3 -1
@@ -11,7 +11,9 @@
11 "tools:generate": "uv run generators/tool_doc_generator/main.py --workers 10",
12 "tools:comment": "uv run python scripts/manage-tool-docs.py comment",
13 "tools:uncomment": "uv run python scripts/manage-tool-docs.py uncomment",
14 - "sdkdocs": "pnpm exec typedoc",
14 + "sdkdocs": "pnpm run sdkdocs:ts && pnpm run sdkdocs:python",
15 + "sdkdocs:ts": "pnpm exec typedoc",
16 + "sdkdocs:python": "uv run python generators/python-sdk/generate_docs.py",
17 "api:pull": "bash scripts/pull-openapi-spec.sh",
18 "snippets:build": "bun run scripts/build-snippets.ts",
19 "snippets:dev": "bun run scripts/build-snippets.ts --watch",
fern/pyproject.toml
+12 -11
@@ -12,8 +12,14 @@ dependencies = [
12 "typing-extensions>=4.13.0",
13 "composio-client==0.1.0a11",
14 "openai>=1.79.0",
15 - "composio-anthropic",
16 - "composio",
15 + "composio==1.0.0rc1",
16 + # Dependencies for SDK doc generation
17 + "tqdm>=4.62.0",
18 + "pyyaml>=6.0",
19 + "GitPython>=3.1.0",
20 + "packaging>=20.0",
21 + "nbformat>=5.0.0",
22 + "composio-langchain==1.0.0rc2",
23 ]
24
25 [tool.ruff]
@@ -24,17 +30,12 @@ target-version = "py312"
30 line-length = 100
31 target-version = ["py312"]
32
27 -[tool.uv.sources]
28 -composio-langchain = { git = "ssh://git@github.com/composiohq/py-sdk-v3", subdirectory = "providers/langchain" }
29 -composio-anthropic = { git = "ssh://git@github.com/composiohq/py-sdk-v3", subdirectory = "providers/anthropic" }
30 -composio = { git = "ssh://git@github.com/composiohq/py-sdk-v3" }
33
34 [tool.uv.workspace]
35 members = ["snippets/migration"]
36
37 +[tool.setuptools.packages.find]
38 +include = ["generators*"]
39 +
40 [dependency-groups]
36 -dev = [
37 - "composio",
38 - "composio-langchain",
39 - "langchain>=0.3.25",
40 -]
41 +dev = ["composio", "composio-langchain", "langchain>=0.3.25"]
fern/scripts/build-snippets.ts
+17 -13
@@ -24,7 +24,7 @@ function ensureDistDir() {
24 fs.rmSync(PAGES_DIR, { recursive: true, force: true });
25 console.log('🧹 Cleaned existing pages directory');
26 }
27 -
27 +
28 // Create fresh pages directory
29 fs.mkdirSync(PAGES_DIR, { recursive: true });
30 }
@@ -174,8 +174,12 @@ function processFile(srcPath: string, distPath: string) {
174 }
175 }
176
177 +function isMarkdownFile(filename: string): boolean {
178 + return filename.endsWith('.mdx') || filename.endsWith('.md');
179 +}
180 +
181 function processAllFiles() {
178 - console.log('🔄 Processing all .mdx files...');
182 + console.log('🔄 Processing all .mdx and .md files...');
183
184 function processDirectory(srcDir: string) {
185 const entries = fs.readdirSync(srcDir, { withFileTypes: true });
@@ -187,18 +191,18 @@ function processAllFiles() {
191 // Skip dist directory to avoid infinite loops
192 if (entry.name === 'dist') continue;
193 processDirectory(srcPath);
190 - } else if (entry.isFile() && entry.name.endsWith('.mdx')) {
194 + } else if (entry.isFile() && isMarkdownFile(entry.name)) {
195 // Calculate the relative path from the source directory
196 const relativePath = path.relative(DOCS_SRC_DIR, srcPath);
193 -
197 +
198 // Check if this file is in the SDK directory
199 const isInSDK = relativePath.startsWith('sdk/') || relativePath.startsWith('sdk\\');
196 -
200 +
201 // If in SDK, preserve directory structure; otherwise flatten
198 - const distPath = isInSDK
202 + const distPath = isInSDK
203 ? path.join(PAGES_DIR, relativePath)
204 : path.join(PAGES_DIR, entry.name);
201 -
205 +
206 processFile(srcPath, distPath);
207 }
208 }
@@ -214,15 +218,15 @@ function startWatchMode() {
218
219 const watcher = watch(DOCS_SRC_DIR, { recursive: true }, (eventType, filename) => {
220 if (!filename) return;
217 - if (!filename.endsWith('.mdx')) return;
221 + if (!isMarkdownFile(filename)) return;
222
223 const srcPath = path.join(DOCS_SRC_DIR, filename);
220 -
224 +
225 // Check if this file is in the SDK directory
226 const isInSDK = filename.startsWith('sdk/') || filename.startsWith('sdk\\');
223 -
227 +
228 // If in SDK, preserve directory structure; otherwise flatten
225 - const distPath = isInSDK
229 + const distPath = isInSDK
230 ? path.join(PAGES_DIR, filename)
231 : path.join(PAGES_DIR, path.basename(filename));
232
@@ -240,12 +244,12 @@ function startWatchMode() {
244 if (filename.includes('fern/pages')) return; // Skip pages (output) files
245 if (filename.includes('fern/scripts')) return; // Skip the script itself
246
243 - // If a source file changes, reprocess all .mdx files since we don't know which ones reference it
247 + // If a source file changes, reprocess all .mdx and .md files since we don't know which ones reference it
248 if (
249 eventType === 'change' &&
250 (filename.endsWith('.ts') || filename.endsWith('.js') || filename.endsWith('.py'))
251 ) {
248 - console.log(`🔄 Source file changed: ${filename}, reprocessing all .mdx files...`);
252 + console.log(`🔄 Source file changed: ${filename}, reprocessing all .mdx and .md files...`);
253 processAllFiles();
254 }
255 });
fern/turbo.json
+15 -2
@@ -9,7 +9,7 @@
9 },
10
11 "dev": {
12 - "dependsOn": ["api:pull", "sdkdocs","tools:comment", "snippets:build"],
12 + "dependsOn": ["api:pull", "sdkdocs", "tools:comment", "snippets:build"],
13 "persistent": true,
14 "cache": false
15 },
@@ -58,12 +58,25 @@
58 },
59
60 "sdkdocs": {
61 - "dependsOn": ["^build"],
61 + "dependsOn": ["^build", "sdkdocs:ts", "sdkdocs:python"],
62 "outputs": ["docs/sdk/**"],
63 + "cache": true
64 + },
65 +
66 + "sdkdocs:ts": {
67 + "dependsOn": ["^build"],
68 + "outputs": ["docs/sdk/typescript/**"],
69 "inputs": ["../ts/packages/core/**/*.ts", "../ts/packages/providers/**/*.ts", "typedoc.json"],
70 "cache": true
71 },
72
73 + "sdkdocs:python": {
74 + "dependsOn": ["^build"],
75 + "outputs": ["docs/sdk/python/**"],
76 + "inputs": ["generators/python-sdk/templates/**/*.md", "generators/python-sdk/**/*.py"],
77 + "cache": true
78 + },
79 +
80 "check": {
81 "dependsOn": ["tools:comment", "snippets:build"],
82 "cache": false
fern/uv.lock
+222 -33
@@ -20,24 +20,6 @@ wheels = [
20 { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 },
21 ]
22
23 -[[package]]
24 -name = "anthropic"
25 -version = "0.54.0"
26 -source = { registry = "https://pypi.org/simple" }
27 -dependencies = [
28 - { name = "anyio" },
29 - { name = "distro" },
30 - { name = "httpx" },
31 - { name = "jiter" },
32 - { name = "pydantic" },
33 - { name = "sniffio" },
34 - { name = "typing-extensions" },
35 -]
36 -sdist = { url = "https://files.pythonhosted.org/packages/89/28/80cb9bb6e7ce77d404145b51da4257455805c17f0a6be528ff3286e3882f/anthropic-0.54.0.tar.gz", hash = "sha256:5e6f997d97ce8e70eac603c3ec2e7f23addeff953fbbb76b19430562bb6ba815", size = 312376 }
37 -wheels = [
38 - { url = "https://files.pythonhosted.org/packages/de/b9/6ffb48e82c5e97b03cecee872d134a6b6666c2767b2d32ed709f3a60a8fe/anthropic-0.54.0-py3-none-any.whl", hash = "sha256:c1062a0a905daeec17ca9c06c401e4b3f24cb0495841d29d752568a1d4018d56", size = 288774 },
39 -]
40 -
23 [[package]]
24 name = "anyio"
25 version = "4.9.0"
@@ -52,6 +34,15 @@ wheels = [
34 { url = "https://files.pythonhosted.org/packages/a1/ee/48ca1a7c89ffec8b6a0c5d02b89c305671d5ffd8d3c94acf8b8c408575bb/anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c", size = 100916 },
35 ]
36
37 +[[package]]
38 +name = "attrs"
39 +version = "25.3.0"
40 +source = { registry = "https://pypi.org/simple" }
41 +sdist = { url = "https://files.pythonhosted.org/packages/5a/b0/1367933a8532ee6ff8d63537de4f1177af4bff9f3e829baf7331f595bb24/attrs-25.3.0.tar.gz", hash = "sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b", size = 812032 }
42 +wheels = [
43 + { url = "https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", size = 63815 },
44 +]
45 +
46 [[package]]
47 name = "certifi"
48 version = "2025.4.26"
@@ -162,14 +153,6 @@ dependencies = [
153 { name = "typing-extensions" },
154 ]
155
165 -[[package]]
166 -name = "composio-anthropic"
167 -version = "1.0.0rc1"
168 -source = { git = "ssh://git@github.com/composiohq/py-sdk-v3?subdirectory=providers%2Fanthropic#f9914d35690455bb9901e8fed5c07657ef3385f5" }
169 -dependencies = [
170 - { name = "anthropic" },
171 -]
172 -
156 [[package]]
157 name = "composio-client"
158 version = "0.1.0a11"
@@ -189,11 +172,15 @@ wheels = [
172
173 [[package]]
174 name = "composio-langchain"
192 -version = "1.0.0rc1"
193 -source = { git = "ssh://git@github.com/composiohq/py-sdk-v3?subdirectory=providers%2Flangchain#f9914d35690455bb9901e8fed5c07657ef3385f5" }
175 +version = "1.0.0rc2"
176 +source = { registry = "https://pypi.org/simple" }
177 dependencies = [
178 { name = "langchain" },
179 ]
180 +sdist = { url = "https://files.pythonhosted.org/packages/06/53/cbaf8ff590ac45400a6419a8594f354276f528c60025dd567163803cf618/composio_langchain-1.0.0rc2.tar.gz", hash = "sha256:b5bbf8ada343e7e0d055a4a99676ee593ca3d4b659115770c675dd191bd294bf", size = 2402 }
181 +wheels = [
182 + { url = "https://files.pythonhosted.org/packages/e5/66/c474ca5dd71ac8cf9aa10479686cf9f6c974d41148b303a56ee963d374e7/composio_langchain-1.0.0rc2-py3-none-any.whl", hash = "sha256:e6cdc66bc5dec3f74dea0cf3111d0cbf7338265455b093154186b8c2c47bde16", size = 2762 },
183 +]
184
185 [[package]]
186 name = "distro"
@@ -204,6 +191,15 @@ wheels = [
191 { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277 },
192 ]
193
194 +[[package]]
195 +name = "fastjsonschema"
196 +version = "2.21.1"
197 +source = { registry = "https://pypi.org/simple" }
198 +sdist = { url = "https://files.pythonhosted.org/packages/8b/50/4b769ce1ac4071a1ef6d86b1a3fb56cdc3a37615e8c5519e1af96cdac366/fastjsonschema-2.21.1.tar.gz", hash = "sha256:794d4f0a58f848961ba16af7b9c85a3e88cd360df008c59aac6fc5ae9323b5d4", size = 373939 }
199 +wheels = [
200 + { url = "https://files.pythonhosted.org/packages/90/2b/0817a2b257fe88725c25589d89aec060581aabf668707a8d03b2e9e0cb2a/fastjsonschema-2.21.1-py3-none-any.whl", hash = "sha256:c9e5b7e908310918cf494a434eeb31384dd84a98b57a30bcb1f535015b554667", size = 23924 },
201 +]
202 +
203 [[package]]
204 name = "fern"
205 version = "0.1.0"
@@ -211,12 +207,17 @@ source = { virtual = "." }
207 dependencies = [
208 { name = "click" },
209 { name = "composio" },
214 - { name = "composio-anthropic" },
210 { name = "composio-client" },
211 + { name = "composio-langchain" },
212 + { name = "gitpython" },
213 { name = "inflection" },
214 + { name = "nbformat" },
215 { name = "openai" },
216 + { name = "packaging" },
217 { name = "python-dotenv" },
218 + { name = "pyyaml" },
219 { name = "ruamel-yaml" },
220 + { name = "tqdm" },
221 { name = "typing-extensions" },
222 ]
223
@@ -230,23 +231,52 @@ dev = [
231 [package.metadata]
232 requires-dist = [
233 { name = "click", specifier = ">=8.1.7" },
233 - { name = "composio", git = "ssh://git@github.com/composiohq/py-sdk-v3" },
234 - { name = "composio-anthropic", git = "ssh://git@github.com/composiohq/py-sdk-v3?subdirectory=providers%2Fanthropic" },
234 + { name = "composio", specifier = "==1.0.0rc1" },
235 { name = "composio-client", specifier = "==0.1.0a11" },
236 + { name = "composio-langchain", specifier = "==1.0.0rc2" },
237 + { name = "gitpython", specifier = ">=3.1.0" },
238 { name = "inflection", specifier = ">=0.5.1" },
239 + { name = "nbformat", specifier = ">=5.0.0" },
240 { name = "openai", specifier = ">=1.79.0" },
241 + { name = "packaging", specifier = ">=20.0" },
242 { name = "python-dotenv", specifier = ">=1.1.0" },
243 + { name = "pyyaml", specifier = ">=6.0" },
244 { name = "ruamel-yaml", specifier = ">=0.18.10" },
245 + { name = "tqdm", specifier = ">=4.62.0" },
246 { name = "typing-extensions", specifier = ">=4.13.0" },
247 ]
248
249 [package.metadata.requires-dev]
250 dev = [
245 - { name = "composio", git = "ssh://git@github.com/composiohq/py-sdk-v3" },
246 - { name = "composio-langchain", git = "ssh://git@github.com/composiohq/py-sdk-v3?subdirectory=providers%2Flangchain" },
251 + { name = "composio" },
252 + { name = "composio-langchain" },
253 { name = "langchain", specifier = ">=0.3.25" },
254 ]
255
256 +[[package]]
257 +name = "gitdb"
258 +version = "4.0.12"
259 +source = { registry = "https://pypi.org/simple" }
260 +dependencies = [
261 + { name = "smmap" },
262 +]
263 +sdist = { url = "https://files.pythonhosted.org/packages/72/94/63b0fc47eb32792c7ba1fe1b694daec9a63620db1e313033d18140c2320a/gitdb-4.0.12.tar.gz", hash = "sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571", size = 394684 }
264 +wheels = [
265 + { url = "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", hash = "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", size = 62794 },
266 +]
267 +
268 +[[package]]
269 +name = "gitpython"
270 +version = "3.1.44"
271 +source = { registry = "https://pypi.org/simple" }
272 +dependencies = [
273 + { name = "gitdb" },
274 +]
275 +sdist = { url = "https://files.pythonhosted.org/packages/c0/89/37df0b71473153574a5cdef8f242de422a0f5d26d7a9e231e6f169b4ad14/gitpython-3.1.44.tar.gz", hash = "sha256:c87e30b26253bf5418b01b0660f818967f3c503193838337fe5e573331249269", size = 214196 }
276 +wheels = [
277 + { url = "https://files.pythonhosted.org/packages/1d/9a/4114a9057db2f1462d5c8f8390ab7383925fe1ac012eaa42402ad65c2963/GitPython-3.1.44-py3-none-any.whl", hash = "sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110", size = 207599 },
278 +]
279 +
280 [[package]]
281 name = "greenlet"
282 version = "3.2.3"
@@ -404,6 +434,47 @@ wheels = [
434 { url = "https://files.pythonhosted.org/packages/71/92/5e77f98553e9e75130c78900d000368476aed74276eb8ae8796f65f00918/jsonpointer-3.0.0-py2.py3-none-any.whl", hash = "sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942", size = 7595 },
435 ]
436
437 +[[package]]
438 +name = "jsonschema"
439 +version = "4.24.0"
440 +source = { registry = "https://pypi.org/simple" }
441 +dependencies = [
442 + { name = "attrs" },
443 + { name = "jsonschema-specifications" },
444 + { name = "referencing" },
445 + { name = "rpds-py" },
446 +]
447 +sdist = { url = "https://files.pythonhosted.org/packages/bf/d3/1cf5326b923a53515d8f3a2cd442e6d7e94fcc444716e879ea70a0ce3177/jsonschema-4.24.0.tar.gz", hash = "sha256:0b4e8069eb12aedfa881333004bccaec24ecef5a8a6a4b6df142b2cc9599d196", size = 353480 }
448 +wheels = [
449 + { url = "https://files.pythonhosted.org/packages/a2/3d/023389198f69c722d039351050738d6755376c8fd343e91dc493ea485905/jsonschema-4.24.0-py3-none-any.whl", hash = "sha256:a462455f19f5faf404a7902952b6f0e3ce868f3ee09a359b05eca6673bd8412d", size = 88709 },
450 +]
451 +
452 +[[package]]
453 +name = "jsonschema-specifications"
454 +version = "2025.4.1"
455 +source = { registry = "https://pypi.org/simple" }
456 +dependencies = [
457 + { name = "referencing" },
458 +]
459 +sdist = { url = "https://files.pythonhosted.org/packages/bf/ce/46fbd9c8119cfc3581ee5643ea49464d168028cfb5caff5fc0596d0cf914/jsonschema_specifications-2025.4.1.tar.gz", hash = "sha256:630159c9f4dbea161a6a2205c3011cc4f18ff381b189fff48bb39b9bf26ae608", size = 15513 }
460 +wheels = [
461 + { url = "https://files.pythonhosted.org/packages/01/0e/b27cdbaccf30b890c40ed1da9fd4a3593a5cf94dae54fb34f8a4b74fcd3f/jsonschema_specifications-2025.4.1-py3-none-any.whl", hash = "sha256:4653bffbd6584f7de83a67e0d620ef16900b390ddc7939d56684d6c81e33f1af", size = 18437 },
462 +]
463 +
464 +[[package]]
465 +name = "jupyter-core"
466 +version = "5.8.1"
467 +source = { registry = "https://pypi.org/simple" }
468 +dependencies = [
469 + { name = "platformdirs" },
470 + { name = "pywin32", marker = "platform_python_implementation != 'PyPy' and sys_platform == 'win32'" },
471 + { name = "traitlets" },
472 +]
473 +sdist = { url = "https://files.pythonhosted.org/packages/99/1b/72906d554acfeb588332eaaa6f61577705e9ec752ddb486f302dafa292d9/jupyter_core-5.8.1.tar.gz", hash = "sha256:0a5f9706f70e64786b75acba995988915ebd4601c8a52e534a40b51c95f59941", size = 88923 }
474 +wheels = [
475 + { url = "https://files.pythonhosted.org/packages/2f/57/6bffd4b20b88da3800c5d691e0337761576ee688eb01299eae865689d2df/jupyter_core-5.8.1-py3-none-any.whl", hash = "sha256:c28d268fc90fb53f1338ded2eb410704c5449a358406e8a948b75706e24863d0", size = 28880 },
476 +]
477 +
478 [[package]]
479 name = "langchain"
480 version = "0.3.25"
@@ -481,6 +552,21 @@ dependencies = [
552 [package.metadata]
553 requires-dist = [{ name = "composio", git = "ssh://git@github.com/composiohq/py-sdk-v3" }]
554
555 +[[package]]
556 +name = "nbformat"
557 +version = "5.10.4"
558 +source = { registry = "https://pypi.org/simple" }
559 +dependencies = [
560 + { name = "fastjsonschema" },
561 + { name = "jsonschema" },
562 + { name = "jupyter-core" },
563 + { name = "traitlets" },
564 +]
565 +sdist = { url = "https://files.pythonhosted.org/packages/6d/fd/91545e604bc3dad7dca9ed03284086039b294c6b3d75c0d2fa45f9e9caf3/nbformat-5.10.4.tar.gz", hash = "sha256:322168b14f937a5d11362988ecac2a4952d3d8e3a2cbeb2319584631226d5b3a", size = 142749 }
566 +wheels = [
567 + { url = "https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl", hash = "sha256:3b48d6c8fbca4b299bf3982ea7db1af21580e4fec269ad087b9e81588891200b", size = 78454 },
568 +]
569 +
570 [[package]]
571 name = "openai"
572 version = "1.79.0"
@@ -547,6 +633,15 @@ wheels = [
633 { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 },
634 ]
635
636 +[[package]]
637 +name = "platformdirs"
638 +version = "4.3.8"
639 +source = { registry = "https://pypi.org/simple" }
640 +sdist = { url = "https://files.pythonhosted.org/packages/fe/8b/3c73abc9c759ecd3f1f7ceff6685840859e8070c4d947c93fae71f6a0bf2/platformdirs-4.3.8.tar.gz", hash = "sha256:3d512d96e16bcb959a814c9f348431070822a6496326a4be0911c40b5a74c2bc", size = 21362 }
641 +wheels = [
642 + { url = "https://files.pythonhosted.org/packages/fe/39/979e8e21520d4e47a0bbe349e2713c0aac6f3d853d0e5b34d76206c439aa/platformdirs-4.3.8-py3-none-any.whl", hash = "sha256:ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4", size = 18567 },
643 +]
644 +
645 [[package]]
646 name = "pycparser"
647 version = "2.22"
@@ -632,6 +727,19 @@ wheels = [
727 { url = "https://files.pythonhosted.org/packages/1e/18/98a99ad95133c6a6e2005fe89faedf294a748bd5dc803008059409ac9b1e/python_dotenv-1.1.0-py3-none-any.whl", hash = "sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d", size = 20256 },
728 ]
729
730 +[[package]]
731 +name = "pywin32"
732 +version = "310"
733 +source = { registry = "https://pypi.org/simple" }
734 +wheels = [
735 + { url = "https://files.pythonhosted.org/packages/6b/ec/4fdbe47932f671d6e348474ea35ed94227fb5df56a7c30cbbb42cd396ed0/pywin32-310-cp312-cp312-win32.whl", hash = "sha256:8a75a5cc3893e83a108c05d82198880704c44bbaee4d06e442e471d3c9ea4f3d", size = 8796239 },
736 + { url = "https://files.pythonhosted.org/packages/e3/e5/b0627f8bb84e06991bea89ad8153a9e50ace40b2e1195d68e9dff6b03d0f/pywin32-310-cp312-cp312-win_amd64.whl", hash = "sha256:bf5c397c9a9a19a6f62f3fb821fbf36cac08f03770056711f765ec1503972060", size = 9503839 },
737 + { url = "https://files.pythonhosted.org/packages/1f/32/9ccf53748df72301a89713936645a664ec001abd35ecc8578beda593d37d/pywin32-310-cp312-cp312-win_arm64.whl", hash = "sha256:2349cc906eae872d0663d4d6290d13b90621eaf78964bb1578632ff20e152966", size = 8459470 },
738 + { url = "https://files.pythonhosted.org/packages/1c/09/9c1b978ffc4ae53999e89c19c77ba882d9fce476729f23ef55211ea1c034/pywin32-310-cp313-cp313-win32.whl", hash = "sha256:5d241a659c496ada3253cd01cfaa779b048e90ce4b2b38cd44168ad555ce74ab", size = 8794384 },
739 + { url = "https://files.pythonhosted.org/packages/45/3c/b4640f740ffebadd5d34df35fecba0e1cfef8fde9f3e594df91c28ad9b50/pywin32-310-cp313-cp313-win_amd64.whl", hash = "sha256:667827eb3a90208ddbdcc9e860c81bde63a135710e21e4cb3348968e4bd5249e", size = 9503039 },
740 + { url = "https://files.pythonhosted.org/packages/b4/f4/f785020090fb050e7fb6d34b780f2231f302609dc964672f72bfaeb59a28/pywin32-310-cp313-cp313-win_arm64.whl", hash = "sha256:e308f831de771482b7cf692a1f308f8fca701b2d8f9dde6cc440c7da17e47b33", size = 8458152 },
741 +]
742 +
743 [[package]]
744 name = "pyyaml"
745 version = "6.0.2"
@@ -658,6 +766,20 @@ wheels = [
766 { url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446 },
767 ]
768
769 +[[package]]
770 +name = "referencing"
771 +version = "0.36.2"
772 +source = { registry = "https://pypi.org/simple" }
773 +dependencies = [
774 + { name = "attrs" },
775 + { name = "rpds-py" },
776 + { name = "typing-extensions", marker = "python_full_version < '3.13'" },
777 +]
778 +sdist = { url = "https://files.pythonhosted.org/packages/2f/db/98b5c277be99dd18bfd91dd04e1b759cad18d1a338188c936e92f921c7e2/referencing-0.36.2.tar.gz", hash = "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa", size = 74744 }
779 +wheels = [
780 + { url = "https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl", hash = "sha256:e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0", size = 26775 },
781 +]
782 +
783 [[package]]
784 name = "requests"
785 version = "2.32.3"
@@ -685,6 +807,55 @@ wheels = [
807 { url = "https://files.pythonhosted.org/packages/3f/51/d4db610ef29373b879047326cbf6fa98b6c1969d6f6dc423279de2b1be2c/requests_toolbelt-1.0.0-py2.py3-none-any.whl", hash = "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06", size = 54481 },
808 ]
809
810 +[[package]]
811 +name = "rpds-py"
812 +version = "0.25.1"
813 +source = { registry = "https://pypi.org/simple" }
814 +sdist = { url = "https://files.pythonhosted.org/packages/8c/a6/60184b7fc00dd3ca80ac635dd5b8577d444c57e8e8742cecabfacb829921/rpds_py-0.25.1.tar.gz", hash = "sha256:8960b6dac09b62dac26e75d7e2c4a22efb835d827a7278c34f72b2b84fa160e3", size = 27304 }
815 +wheels = [
816 + { url = "https://files.pythonhosted.org/packages/7f/81/28ab0408391b1dc57393653b6a0cf2014cc282cc2909e4615e63e58262be/rpds_py-0.25.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:b5ffe453cde61f73fea9430223c81d29e2fbf412a6073951102146c84e19e34c", size = 364647 },
817 + { url = "https://files.pythonhosted.org/packages/2c/9a/7797f04cad0d5e56310e1238434f71fc6939d0bc517192a18bb99a72a95f/rpds_py-0.25.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:115874ae5e2fdcfc16b2aedc95b5eef4aebe91b28e7e21951eda8a5dc0d3461b", size = 350454 },
818 + { url = "https://files.pythonhosted.org/packages/69/3c/93d2ef941b04898011e5d6eaa56a1acf46a3b4c9f4b3ad1bbcbafa0bee1f/rpds_py-0.25.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a714bf6e5e81b0e570d01f56e0c89c6375101b8463999ead3a93a5d2a4af91fa", size = 389665 },
819 + { url = "https://files.pythonhosted.org/packages/c1/57/ad0e31e928751dde8903a11102559628d24173428a0f85e25e187defb2c1/rpds_py-0.25.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:35634369325906bcd01577da4c19e3b9541a15e99f31e91a02d010816b49bfda", size = 403873 },
820 + { url = "https://files.pythonhosted.org/packages/16/ad/c0c652fa9bba778b4f54980a02962748479dc09632e1fd34e5282cf2556c/rpds_py-0.25.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d4cb2b3ddc16710548801c6fcc0cfcdeeff9dafbc983f77265877793f2660309", size = 525866 },
821 + { url = "https://files.pythonhosted.org/packages/2a/39/3e1839bc527e6fcf48d5fec4770070f872cdee6c6fbc9b259932f4e88a38/rpds_py-0.25.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9ceca1cf097ed77e1a51f1dbc8d174d10cb5931c188a4505ff9f3e119dfe519b", size = 416886 },
822 + { url = "https://files.pythonhosted.org/packages/7a/95/dd6b91cd4560da41df9d7030a038298a67d24f8ca38e150562644c829c48/rpds_py-0.25.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c2cd1a4b0c2b8c5e31ffff50d09f39906fe351389ba143c195566056c13a7ea", size = 390666 },
823 + { url = "https://files.pythonhosted.org/packages/64/48/1be88a820e7494ce0a15c2d390ccb7c52212370badabf128e6a7bb4cb802/rpds_py-0.25.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1de336a4b164c9188cb23f3703adb74a7623ab32d20090d0e9bf499a2203ad65", size = 425109 },
824 + { url = "https://files.pythonhosted.org/packages/cf/07/3e2a17927ef6d7720b9949ec1b37d1e963b829ad0387f7af18d923d5cfa5/rpds_py-0.25.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9fca84a15333e925dd59ce01da0ffe2ffe0d6e5d29a9eeba2148916d1824948c", size = 567244 },
825 + { url = "https://files.pythonhosted.org/packages/d2/e5/76cf010998deccc4f95305d827847e2eae9c568099c06b405cf96384762b/rpds_py-0.25.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:88ec04afe0c59fa64e2f6ea0dd9657e04fc83e38de90f6de201954b4d4eb59bd", size = 596023 },
826 + { url = "https://files.pythonhosted.org/packages/52/9a/df55efd84403736ba37a5a6377b70aad0fd1cb469a9109ee8a1e21299a1c/rpds_py-0.25.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a8bd2f19e312ce3e1d2c635618e8a8d8132892bb746a7cf74780a489f0f6cdcb", size = 561634 },
827 + { url = "https://files.pythonhosted.org/packages/ab/aa/dc3620dd8db84454aaf9374bd318f1aa02578bba5e567f5bf6b79492aca4/rpds_py-0.25.1-cp312-cp312-win32.whl", hash = "sha256:e5e2f7280d8d0d3ef06f3ec1b4fd598d386cc6f0721e54f09109a8132182fbfe", size = 222713 },
828 + { url = "https://files.pythonhosted.org/packages/a3/7f/7cef485269a50ed5b4e9bae145f512d2a111ca638ae70cc101f661b4defd/rpds_py-0.25.1-cp312-cp312-win_amd64.whl", hash = "sha256:db58483f71c5db67d643857404da360dce3573031586034b7d59f245144cc192", size = 235280 },
829 + { url = "https://files.pythonhosted.org/packages/99/f2/c2d64f6564f32af913bf5f3f7ae41c7c263c5ae4c4e8f1a17af8af66cd46/rpds_py-0.25.1-cp312-cp312-win_arm64.whl", hash = "sha256:6d50841c425d16faf3206ddbba44c21aa3310a0cebc3c1cdfc3e3f4f9f6f5728", size = 225399 },
830 + { url = "https://files.pythonhosted.org/packages/2b/da/323848a2b62abe6a0fec16ebe199dc6889c5d0a332458da8985b2980dffe/rpds_py-0.25.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:659d87430a8c8c704d52d094f5ba6fa72ef13b4d385b7e542a08fc240cb4a559", size = 364498 },
831 + { url = "https://files.pythonhosted.org/packages/1f/b4/4d3820f731c80fd0cd823b3e95b9963fec681ae45ba35b5281a42382c67d/rpds_py-0.25.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:68f6f060f0bbdfb0245267da014d3a6da9be127fe3e8cc4a68c6f833f8a23bb1", size = 350083 },
832 + { url = "https://files.pythonhosted.org/packages/d5/b1/3a8ee1c9d480e8493619a437dec685d005f706b69253286f50f498cbdbcf/rpds_py-0.25.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:083a9513a33e0b92cf6e7a6366036c6bb43ea595332c1ab5c8ae329e4bcc0a9c", size = 389023 },
833 + { url = "https://files.pythonhosted.org/packages/3b/31/17293edcfc934dc62c3bf74a0cb449ecd549531f956b72287203e6880b87/rpds_py-0.25.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:816568614ecb22b18a010c7a12559c19f6fe993526af88e95a76d5a60b8b75fb", size = 403283 },
834 + { url = "https://files.pythonhosted.org/packages/d1/ca/e0f0bc1a75a8925024f343258c8ecbd8828f8997ea2ac71e02f67b6f5299/rpds_py-0.25.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c6564c0947a7f52e4792983f8e6cf9bac140438ebf81f527a21d944f2fd0a40", size = 524634 },
835 + { url = "https://files.pythonhosted.org/packages/3e/03/5d0be919037178fff33a6672ffc0afa04ea1cfcb61afd4119d1b5280ff0f/rpds_py-0.25.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c4a128527fe415d73cf1f70a9a688d06130d5810be69f3b553bf7b45e8acf79", size = 416233 },
836 + { url = "https://files.pythonhosted.org/packages/05/7c/8abb70f9017a231c6c961a8941403ed6557664c0913e1bf413cbdc039e75/rpds_py-0.25.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a49e1d7a4978ed554f095430b89ecc23f42014a50ac385eb0c4d163ce213c325", size = 390375 },
837 + { url = "https://files.pythonhosted.org/packages/7a/ac/a87f339f0e066b9535074a9f403b9313fd3892d4a164d5d5f5875ac9f29f/rpds_py-0.25.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d74ec9bc0e2feb81d3f16946b005748119c0f52a153f6db6a29e8cd68636f295", size = 424537 },
838 + { url = "https://files.pythonhosted.org/packages/1f/8f/8d5c1567eaf8c8afe98a838dd24de5013ce6e8f53a01bd47fe8bb06b5533/rpds_py-0.25.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:3af5b4cc10fa41e5bc64e5c198a1b2d2864337f8fcbb9a67e747e34002ce812b", size = 566425 },
839 + { url = "https://files.pythonhosted.org/packages/95/33/03016a6be5663b389c8ab0bbbcca68d9e96af14faeff0a04affcb587e776/rpds_py-0.25.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:79dc317a5f1c51fd9c6a0c4f48209c6b8526d0524a6904fc1076476e79b00f98", size = 595197 },
840 + { url = "https://files.pythonhosted.org/packages/33/8d/da9f4d3e208c82fda311bff0cf0a19579afceb77cf456e46c559a1c075ba/rpds_py-0.25.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:1521031351865e0181bc585147624d66b3b00a84109b57fcb7a779c3ec3772cd", size = 561244 },
841 + { url = "https://files.pythonhosted.org/packages/e2/b3/39d5dcf7c5f742ecd6dbc88f6f84ae54184b92f5f387a4053be2107b17f1/rpds_py-0.25.1-cp313-cp313-win32.whl", hash = "sha256:5d473be2b13600b93a5675d78f59e63b51b1ba2d0476893415dfbb5477e65b31", size = 222254 },
842 + { url = "https://files.pythonhosted.org/packages/5f/19/2d6772c8eeb8302c5f834e6d0dfd83935a884e7c5ce16340c7eaf89ce925/rpds_py-0.25.1-cp313-cp313-win_amd64.whl", hash = "sha256:a7b74e92a3b212390bdce1d93da9f6488c3878c1d434c5e751cbc202c5e09500", size = 234741 },
843 + { url = "https://files.pythonhosted.org/packages/5b/5a/145ada26cfaf86018d0eb304fe55eafdd4f0b6b84530246bb4a7c4fb5c4b/rpds_py-0.25.1-cp313-cp313-win_arm64.whl", hash = "sha256:dd326a81afe332ede08eb39ab75b301d5676802cdffd3a8f287a5f0b694dc3f5", size = 224830 },
844 + { url = "https://files.pythonhosted.org/packages/4b/ca/d435844829c384fd2c22754ff65889c5c556a675d2ed9eb0e148435c6690/rpds_py-0.25.1-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:a58d1ed49a94d4183483a3ce0af22f20318d4a1434acee255d683ad90bf78129", size = 359668 },
845 + { url = "https://files.pythonhosted.org/packages/1f/01/b056f21db3a09f89410d493d2f6614d87bb162499f98b649d1dbd2a81988/rpds_py-0.25.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:f251bf23deb8332823aef1da169d5d89fa84c89f67bdfb566c49dea1fccfd50d", size = 345649 },
846 + { url = "https://files.pythonhosted.org/packages/e0/0f/e0d00dc991e3d40e03ca36383b44995126c36b3eafa0ccbbd19664709c88/rpds_py-0.25.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8dbd586bfa270c1103ece2109314dd423df1fa3d9719928b5d09e4840cec0d72", size = 384776 },
847 + { url = "https://files.pythonhosted.org/packages/9f/a2/59374837f105f2ca79bde3c3cd1065b2f8c01678900924949f6392eab66d/rpds_py-0.25.1-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6d273f136e912aa101a9274c3145dcbddbe4bac560e77e6d5b3c9f6e0ed06d34", size = 395131 },
848 + { url = "https://files.pythonhosted.org/packages/9c/dc/48e8d84887627a0fe0bac53f0b4631e90976fd5d35fff8be66b8e4f3916b/rpds_py-0.25.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:666fa7b1bd0a3810a7f18f6d3a25ccd8866291fbbc3c9b912b917a6715874bb9", size = 520942 },
849 + { url = "https://files.pythonhosted.org/packages/7c/f5/ee056966aeae401913d37befeeab57a4a43a4f00099e0a20297f17b8f00c/rpds_py-0.25.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:921954d7fbf3fccc7de8f717799304b14b6d9a45bbeec5a8d7408ccbf531faf5", size = 411330 },
850 + { url = "https://files.pythonhosted.org/packages/ab/74/b2cffb46a097cefe5d17f94ede7a174184b9d158a0aeb195f39f2c0361e8/rpds_py-0.25.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3d86373ff19ca0441ebeb696ef64cb58b8b5cbacffcda5a0ec2f3911732a194", size = 387339 },
851 + { url = "https://files.pythonhosted.org/packages/7f/9a/0ff0b375dcb5161c2b7054e7d0b7575f1680127505945f5cabaac890bc07/rpds_py-0.25.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c8980cde3bb8575e7c956a530f2c217c1d6aac453474bf3ea0f9c89868b531b6", size = 418077 },
852 + { url = "https://files.pythonhosted.org/packages/0d/a1/fda629bf20d6b698ae84c7c840cfb0e9e4200f664fc96e1f456f00e4ad6e/rpds_py-0.25.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:8eb8c84ecea987a2523e057c0d950bcb3f789696c0499290b8d7b3107a719d78", size = 562441 },
853 + { url = "https://files.pythonhosted.org/packages/20/15/ce4b5257f654132f326f4acd87268e1006cc071e2c59794c5bdf4bebbb51/rpds_py-0.25.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:e43a005671a9ed5a650f3bc39e4dbccd6d4326b24fb5ea8be5f3a43a6f576c72", size = 590750 },
854 + { url = "https://files.pythonhosted.org/packages/fb/ab/e04bf58a8d375aeedb5268edcc835c6a660ebf79d4384d8e0889439448b0/rpds_py-0.25.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:58f77c60956501a4a627749a6dcb78dac522f249dd96b5c9f1c6af29bfacfb66", size = 558891 },
855 + { url = "https://files.pythonhosted.org/packages/90/82/cb8c6028a6ef6cd2b7991e2e4ced01c854b6236ecf51e81b64b569c43d73/rpds_py-0.25.1-cp313-cp313t-win32.whl", hash = "sha256:2cb9e5b5e26fc02c8a4345048cd9998c2aca7c2712bd1b36da0c72ee969a3523", size = 218718 },
856 + { url = "https://files.pythonhosted.org/packages/b6/97/5a4b59697111c89477d20ba8a44df9ca16b41e737fa569d5ae8bff99e650/rpds_py-0.25.1-cp313-cp313t-win_amd64.whl", hash = "sha256:401ca1c4a20cc0510d3435d89c069fe0a9ae2ee6495135ac46bdd49ec0495763", size = 232218 },
857 +]
858 +
859 [[package]]
860 name = "ruamel-yaml"
861 version = "0.18.10"
@@ -723,6 +894,15 @@ wheels = [
894 { url = "https://files.pythonhosted.org/packages/b0/85/e8e751d8791564dd333d5d9a4eab0a7a115f7e349595417fd50ecae3395c/ruamel.yaml.clib-0.2.12-cp313-cp313-win_amd64.whl", hash = "sha256:e5b8daf27af0b90da7bb903a876477a9e6d7270be6146906b276605997c7e9a3", size = 115190 },
895 ]
896
897 +[[package]]
898 +name = "smmap"
899 +version = "5.0.2"
900 +source = { registry = "https://pypi.org/simple" }
901 +sdist = { url = "https://files.pythonhosted.org/packages/44/cd/a040c4b3119bbe532e5b0732286f805445375489fceaec1f48306068ee3b/smmap-5.0.2.tar.gz", hash = "sha256:26ea65a03958fa0c8a1c7e8c7a58fdc77221b8910f6be2131affade476898ad5", size = 22329 }
902 +wheels = [
903 + { url = "https://files.pythonhosted.org/packages/04/be/d09147ad1ec7934636ad912901c5fd7667e1c858e19d355237db0d0cd5e4/smmap-5.0.2-py3-none-any.whl", hash = "sha256:b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e", size = 24303 },
904 +]
905 +
906 [[package]]
907 name = "sniffio"
908 version = "1.3.1"
@@ -782,6 +962,15 @@ wheels = [
962 { url = "https://files.pythonhosted.org/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2", size = 78540 },
963 ]
964
965 +[[package]]
966 +name = "traitlets"
967 +version = "5.14.3"
968 +source = { registry = "https://pypi.org/simple" }
969 +sdist = { url = "https://files.pythonhosted.org/packages/eb/79/72064e6a701c2183016abbbfedaba506d81e30e232a68c9f0d6f6fcd1574/traitlets-5.14.3.tar.gz", hash = "sha256:9ed0579d3502c94b4b3732ac120375cda96f923114522847de4b3bb98b96b6b7", size = 161621 }
970 +wheels = [
971 + { url = "https://files.pythonhosted.org/packages/00/c0/8f5d070730d7836adc9c9b6408dec68c6ced86b304a9b26a14df072a6e8c/traitlets-5.14.3-py3-none-any.whl", hash = "sha256:b74e89e397b1ed28cc831db7aea759ba6640cb3de13090ca145426688ff1ac4f", size = 85359 },
972 +]
973 +
974 [[package]]
975 name = "typing-extensions"
976 version = "4.13.2"