@@ -51,18 +51,15 @@ Ensuring your handler is found by papermill
5151~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5252
5353Once you have developed a new handler, you need to declare papermill entry
54- points in your ``setup.py `` file.
54+ points in your ``pyproject.toml `` file.
5555
56- This is done by including the ``entry_points `` key-word argument to `` setup ``
57- in your setup.py file:
56+ This is done by including the ``[project.entry-points."papermill.io"] `` section
57+ in your pyproject.toml file:
5858
59- .. code-block :: python
59+ .. code-block :: toml
6060
61- from setuptools import setup, find_packages
62- setup(
63- # all the normal setup.py arguments...
64- entry_points = {" papermill.io" : [" sftp://=papermill_sftp:SFTPHandler" ]},
65- )
61+ [project.entry-points."papermill.io"]
62+ "sftp://" = "papermill_sftp:SFTPHandler"
6663
6764 This indicates to papermill that when a file path begins with ``sftp:// ``, it
6865should use the class ``papermill_sftp.SFTPHandler `` to handle reading or writing
@@ -84,7 +81,7 @@ from an sftp server and writes back to it, so we could do the following::
8481Our project structure will look like this::
8582
8683 papermill_sftp
87- |- setup.py
84+ |- pyproject.toml
8885 |- src
8986 |- papermill_sftp
9087 |- __init__.py
@@ -153,24 +150,32 @@ implement a listdir option for now.
153150 raise NotImplementedError
154151
155152
156- The ``setup.py `` file contains the following code:
153+ The ``pyproject.toml `` file contains the following code:
157154
158- .. code-block :: python
155+ .. code-block :: toml
156+
157+ [build-system]
158+ requires = ["setuptools>=61.0", "wheel"]
159+ build-backend = "setuptools.build_meta"
160+
161+ [project]
162+ name = "papermill_sftp"
163+ version = "0.1"
164+ description = "An SFTP I/O handler for papermill."
165+ authors = [
166+ {name = "My Name", email = "[email protected] "} 167+ ]
168+ dependencies = ["pysftp"]
169+
170+ [project.urls]
171+ Repository = "https://github.com/my_username/papermill_sftp.git"
172+
173+ [project.entry-points."papermill.io"]
174+ "sftp://" = "papermill_sftp:SFTPHandler"
159175
160- from setuptools import setup, find_packages
161-
162- setup(
163- name = " papermill_sftp" ,
164- version = " 0.1" ,
165- url = " https://github.com/my_username/papermill_sftp.git" ,
166- author = " My Name" ,
167- 168- description = " An SFTP I/O handler for papermill." ,
169- packages = find_packages(" ./src" ),
170- package_dir = {" " : " src" },
171- install_requires = [" pysftp" ],
172- entry_points = {" papermill.io" : [" sftp://=papermill_sftp:SFTPHandler" ]},
173- )
176+ [tool.setuptools]
177+ packages = ["papermill_sftp"]
178+ package-dir = {"" = "src"}
174179
175180 When executing, papermill will check if the input or output path begin with
176181``sftp:// ``, and if so, use the SFTPHandler from the papermill_sftp project.
@@ -214,7 +219,7 @@ time it took to execute each cell as additional output after every code cell.
214219The project structure is::
215220
216221 papermill_timing
217- |- setup.py
222+ |- pyproject.toml
218223 |- src
219224 |- papermill_timing
220225 |- __init__.py
@@ -249,33 +254,41 @@ library to create a `notebook node object`_.
249254 cell.outputs = [output_node] + cell.outputs
250255
251256 Once this is in place, we need to add our engine as an entry point to our
252- ``setup.py `` script - for this, see the following section.
257+ ``pyproject.toml `` file - for this, see the following section.
253258
254259Ensuring your engine is found by papermill
255260~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
256261
257262Custom engines can be specified as `entry points `_, under the
258263``papermill.engine `` prefix. The entry point needs to reference the class that
259264we have just implemented. For example, if you write an engine called
260- TimingEngine in a package called papermill_timing, then in the ``setup.py ``
265+ TimingEngine in a package called papermill_timing, then in the ``pyproject.toml ``
261266file, you should specify:
262267
263- .. code-block :: python
268+ .. code-block :: toml
269+
270+ [build-system]
271+ requires = ["setuptools>=61.0", "wheel"]
272+ build-backend = "setuptools.build_meta"
273+
274+ [project]
275+ name = "papermill_timing"
276+ version = "0.1"
277+ description = "A papermill engine that logs additional timing information about code."
278+ authors = [
279+ {name = "My Name", email = "[email protected] "} 280+ ]
281+ dependencies = ["papermill", "nbformat"]
282+
283+ [project.urls]
284+ Repository = "https://github.com/my_username/papermill_timing.git"
285+
286+ [project.entry-points."papermill.engine"]
287+ timer_engine = "papermill_timing:CustomEngine"
264288
265- from setuptools import setup, find_packages
266-
267- setup(
268- name = " papermill_timing" ,
269- version = " 0.1" ,
270- url = " https://github.com/my_username/papermill_timing.git" ,
271- author = " My Name" ,
272- 273- description = " A papermill engine that logs additional timing information about code." ,
274- packages = find_packages(" ./src" ),
275- package_dir = {" " : " src" },
276- install_requires = [" papermill" , " nbformat" ],
277- entry_points = {" papermill.engine" : [" timer_engine=papermill_timing:CustomEngine" ]},
278- )
289+ [tool.setuptools]
290+ packages = ["papermill_timing"]
291+ package-dir = {"" = "src"}
279292
280293 This allows users to specify the engine from ``papermill_timing `` by passing the
281294command line argument ``--engine timer_engine ``.
0 commit comments