Skip to content

Commit 880fb48

Browse files
authored
recommend manual publishing (#1260)
* recommend manual publishing * woops
1 parent 8ac3b77 commit 880fb48

File tree

3 files changed

+15
-61
lines changed

3 files changed

+15
-61
lines changed

docs/custom-components/command-reference.md

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ Options:
2222
--help Show this message and exit.
2323
2424
Commands:
25-
build Build a custom component.
2625
init Initialize a custom component.
27-
publish Publish a custom component.
28-
""")
26+
build Build a custom component.
27+
share Collect more details on the published package for gallery.""")
2928
```
3029

3130
## reflex component init
@@ -140,54 +139,9 @@ Options:
140139

141140
## reflex component publish
142141

143-
To publish to a package index, a user is required to already have an account with them. As of **0.4.3**, Reflex only supports uploading to PyPI and TestPyPI. Those indices are separate PyPI and TestPyPI should have sufficient documentation on the account creation and how to generate API tokens. We also have a [short guide]({custom_components.overview.path}) covering this topic.
144-
145-
The publish process starts with a build if needed. If the distribution files for the version specified in pyproject.toml file already exist, the command prompts the user to confirm rebuilding the files nor not. After making sure the distribution files are ready, the command proceeds to upload them to the specified python package index.
146-
147-
```python eval
148-
doccmdoutput(
149-
command="reflex component publish --help",
150-
output="""
151-
reflex component publish --help
152-
Usage: reflex component publish [OPTIONS]
153-
154-
Publish a custom component. Must be run from the project root directory
155-
where the pyproject.toml is.
156-
157-
Args: repository: The name of the Python package repository, such pypi,
158-
testpypi. token: The token to use for authentication on python package
159-
repository. If token is provided, no username/password should be provided at
160-
the same time. username: The username to use for authentication on
161-
python package repository. password: The password to use for
162-
authentication on python package repository. loglevel: The log level to
163-
use.
142+
To publish to a package index, a user is required to already have an account with them. As of **0.7.5**, Reflex does not handle the publishing process for you. You can do so manually by first running `reflex component build` followed by `twine upload` or `uv publish` or your choice of a publishing utility.
164143

165-
Raises: Exit: If arguments provided are not correct or the publish
166-
fails.
167-
168-
Options:
169-
-r, --repository TEXT The name of the repository. Defaults to
170-
pypi. Only supports pypi and testpypi (Test
171-
PyPI) for now.
172-
-t, --token TEXT The API token to use for authentication on
173-
python package repository. If token is
174-
provided, no username/password should be
175-
provided at the same time
176-
-u, --username TEXT The username to use for authentication on
177-
python package repository. Username and
178-
password must both be provided.
179-
-p, --password TEXT The password to use for authentication on
180-
python package repository. Username and
181-
password must both be provided.
182-
--build / --no-build Whether to build the package before
183-
publishing. If the package is already built,
184-
set this to False. [default: build]
185-
--loglevel [debug|info|warning|error|critical]
186-
The log level to use. [default:
187-
LogLevel.INFO]
188-
--help Show this message and exit.
189-
""")
190-
```
144+
You can then share your build on our website with `reflex component share`.
191145

192146
## reflex component build
193147

docs/custom-components/overview.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ from pcweb.pages.docs.custom_components import custom_components as custom_compo
88

99
Reflex users create many components of their own: ready to use high level components, or nicely wrapped React components. With **Custom Components**, the community can easily share these components now.
1010

11-
Release **0.4.3** introduces a series of `reflex component` commands that help developers wrap react components, test, and publish them as python packages. As shown in the image below, there are already a few custom components published on PyPI, such as `reflex-spline`, `reflex-webcam`.
11+
Release **0.4.3** introduces a series of `reflex component` commands that help developers wrap react components, test, and publish them as python packages. As shown in the image below, there are already a few custom components published on PyPI, such as `reflex-spline`, `reflex-webcam`.
1212

1313
Check out the custom components gallery [here]({custom_components_gallery.path}).
1414

15-
1615
```python eval
1716
rx.center(
1817
rx.image(src="/custom_components/pypi_reflex_custom_components.png", width="400px", border_radius="15px", border="1px solid"),
@@ -29,7 +28,8 @@ Follow these steps to publish the custom component as a python package:
2928

3029
1. `reflex component init`: creates a new custom component project from templates.
3130
2. dev and test: developer implements and tests the custom component.
32-
3. `reflex component publish`: builds and uploads the package to a python package index.
31+
3. `reflex component build`: builds the package.
32+
4. `twine upload` or `uv publish`: uploads the package to a python package index.
3333

3434
### Initialization
3535

@@ -64,7 +64,11 @@ After finishing the custom component implementation, the user is encouraged to f
6464
### Publish
6565

6666
```bash
67-
reflex component publish
67+
reflex component build
6868
```
6969

70-
Once ready to publish, execute `reflex component publish` with the credentials in the command options (either `--username` and `--password` together or `--token`). First the command builds the distribution files if they are not already built. The end result is a `dist` folder containing the distribution files. The user does not need to do anything manually with these distribution files. The the command proceeds to publish those files. The same version of the package can only be published once. If already exists, the publish ends in error. The user can go to the `pyproject.toml` file and update the version number as desired. After the `publish` command finishes successfully, the package is uploaded to PyPI. 🎉
70+
Once you're ready to publish your package, run `reflex component build` to build the package. The command builds the distribution files if they are not already built. The end result is a `dist` folder containing the distribution files. The user does not need to do anything manually with these distribution files.
71+
72+
In order to publish these files as a Python package, you need to use a publishing utility. Any would work, but we recommend either [Twine](https://twine.readthedocs.io/en/stable/) or (uv)[https://docs.astral.sh/uv/guides/package/#publishing-your-package]. Make sure to keep your package version in pyproject.toml updated.
73+
74+
You can also share your components with the rest of the community at our website using the command `reflex component share`. See you there!

docs/custom-components/prerequisites-for-publishing.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ image_style = {
1010
}
1111
```
1212

13-
In order to publish a Python package, an account with the package index is required. As of **0.4.3**, Reflex only supports publishing to PyPI and TestPyPI. PyPI is short for **Python Package Index**, the official third-party software repository for Python. TestPyPI is a separate instance of index that allows users to test the distribution and installation of the package before publishing it to the real index.
13+
In order to publish a Python package, you need to use a publishing utility. Any would work, but we recommend either [Twine](https://twine.readthedocs.io/en/stable/) or (uv)[https://docs.astral.sh/uv/guides/package/#publishing-your-package].
1414

1515
## PyPI
1616

@@ -22,7 +22,7 @@ rx.center(
2222
)
2323
```
2424

25-
A user can use username and password to authenticate with PyPI when publishing. Reflex does not store your PyPI credentials. If an API token is preferred, it can be generated in the account settings.
25+
A user can use username and password to authenticate with PyPI when publishing.
2626

2727
```python eval
2828
rx.center(
@@ -37,7 +37,3 @@ rx.center(
3737
rx.image(src="/custom_components/pypi_api_tokens.png", style=image_style, width="700px", loading="lazy"),
3838
)
3939
```
40-
41-
## TestPyPI
42-
43-
TestPyPI has the same look and feel as PyPI.

0 commit comments

Comments
 (0)