Skip to content

Improve local development setup instructions in README #1079

Open
Khiladi-786 wants to merge 4 commits intofossasia:masterfrom
Khiladi-786:improve-readme-setup
Open

Improve local development setup instructions in README #1079
Khiladi-786 wants to merge 4 commits intofossasia:masterfrom
Khiladi-786:improve-readme-setup

Conversation

@Khiladi-786
Copy link

@Khiladi-786 Khiladi-786 commented Mar 22, 2026

Description

This PR improves the local development setup instructions in the README to make it easier for new contributors to run the project from a fresh clone.

Added a clear step-by-step guide covering environment setup, dependency installation, and running the server and demo script. Also included a troubleshooting section for common import issues.

Motivation and Context

While setting up the project locally, I encountered issues related to:

  • Module import errors due to package structure (visdom inside py/)
  • Missing dependencies (e.g., Pillow)
  • Unclear setup flow for first-time contributors

These changes aim to reduce setup friction and improve the onboarding experience for new contributors.

How Has This Been Tested?

  • Created a fresh conda environment (Python 3.10)

  • Installed dependencies using the updated instructions

  • Successfully ran:

    • python -m visdom.server
    • python example/demo.py
  • Verified that the application runs correctly on http://localhost:8097

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactor or cleanup (changes to existing code for improved readability or performance)

Checklist:

  • I adapted the version number under py/visdom/VERSION according to Semantic Versioning
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Summary by Sourcery

Document a simple from-scratch local development workflow for running the project after a fresh clone.

Documentation:

  • Add step-by-step local development setup instructions covering environment creation, dependency installation, and running the demo script.
  • Document a workaround for common module import errors by configuring PYTHONPATH.

Copilot AI review requested due to automatic review settings March 22, 2026 14:52
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates README.md to add a concise, step-by-step local development setup guide (environment creation, dependency installation, running demo) plus a brief troubleshooting note for import issues, improving onboarding clarity for new contributors.

Flow diagram for local development setup and troubleshooting

flowchart TD
  A(Clone_repository) --> B(Read_local_development_setup_section_in_README)
  B --> C(Create_conda_env_visdom_env_python_3_10)
  C --> D(Activate_conda_env_visdom_env)
  D --> E(Pip_install_r_requirements_txt)
  E --> F(Pip_install_pillow_and_charset_normalizer)
  F --> G(Pip_install_editable_project_pip_install_e_dot)
  G --> H(Run_demo_python_example_demo_py)
  H --> I{Demo_runs_without_import_errors}
  I -- Yes --> J(Access_application_at_http_localhost_8097)
  I -- No --> K(Set_PYTHONPATH_pwd_py)
  K --> H
Loading

File-Level Changes

Change Details Files
Add step-by-step local development setup instructions for running the project from a fresh clone.
  • Document creation and activation of a dedicated conda environment with Python 3.10.
  • Describe installing project dependencies via requirements.txt and additional explicit packages (Pillow and charset-normalizer).
  • Explain installing the package in editable mode and running the example demo script to verify the setup.
  • Add a troubleshooting hint to set PYTHONPATH to include the py directory when encountering module import errors.
  • Introduce a new section heading for local development setup placed after the install-from-source instructions.
README.md

Possibly linked issues

  • #Improve installation instructions for new contributors: PR adds detailed local setup steps and troubleshooting in README, directly addressing the request for clearer installation instructions.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new local setup section uses ,,,bash instead of Markdown code fences like ```bash, which will render incorrectly on GitHub and should be updated.
  • Consider separating the main setup commands from the troubleshooting tip (PYTHONPATH export) using a short explanatory sentence or a dedicated subsection so new contributors don’t confuse it as part of the default setup flow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new local setup section uses `,,,bash` instead of Markdown code fences like ```bash, which will render incorrectly on GitHub and should be updated.
- Consider separating the main setup commands from the troubleshooting tip (PYTHONPATH export) using a short explanatory sentence or a dedicated subsection so new contributors don’t confuse it as part of the default setup flow.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates README.md to add “Local Development Setup (From Scratch)” instructions intended to help new contributors set up a fresh environment and run Visdom locally.

Changes:

  • Added a new local development setup section with conda-based environment creation and install/run steps.
  • Added a brief troubleshooting note for Python import/module path issues.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +189 to +190
pip install pillow charset-normalizer
pip install -e .
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip install pillow charset-normalizer is likely unnecessary here: Pillow is already included in setup.py’s install_requires, so pip install -e . should pull it in. If there’s a known edge case (e.g., Pillow build failures on some platforms), it would be better documented as a troubleshooting note rather than a required step.

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +196
,,,bash
conda create -n visdom_env python=3.10 -y
conda activate visdom_env
pip install -r requirements.txt
pip install pillow charset-normalizer
pip install -e .
python example/demo.py

If you get module import errors:
export PYTHONPATH=$(pwd)/py
,,,bash

Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bash snippet isn’t fenced with valid Markdown code blocks. The ,,,bash lines won’t render as code, and there’s no closing fence around the commands. Please switch to standard Markdown fences (bash … ), and include the export PYTHONPATH=... line inside an appropriate code block (also remove the stray ,,,bash at the end).

Copilot uses AI. Check for mistakes.
Comment on lines +188 to +189
pip install -r requirements.txt
pip install pillow charset-normalizer
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip install -r requirements.txt will fail because there is no requirements.txt in the repository root. Consider removing this step or pointing to the actual dependency source (e.g., rely on pip install -e ., which already installs runtime requirements via setup.py).

Copilot uses AI. Check for mistakes.
conda activate visdom_env
pip install -r requirements.txt
pip install pillow charset-normalizer
pip install -e .
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions run python example/demo.py but never instruct starting the Visdom server first. example/demo.py asserts a server connection (viz.check_connection(...)) and will fail unless visdom / python -m visdom.server is running (typically in another terminal). Please add an explicit “start server” step before running the demo.

Suggested change
pip install -e .
pip install -e .
# In another terminal, start the Visdom server before running the demo:
# visdom # or: python -m visdom.server

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines +193 to +195
If you get module import errors:
export PYTHONPATH=$(pwd)/py
,,,bash
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The troubleshooting note is currently ambiguous relative to the preceding pip install -e . step: with an editable install, import visdom should work without setting PYTHONPATH. If you keep this, clarify when it’s needed (e.g., only when running from source without installing) and consider showing it as an alternative command like PYTHONPATH=./py python -m visdom.server rather than a persistent shell export.

Copilot uses AI. Check for mistakes.
@Khiladi-786
Copy link
Author

Thanks for the suggestion!

I've updated the troubleshooting section to clarify when PYTHONPATH is needed and replaced it with a clearer inline command example. Also fixed formatting.

Please let me know if anything else should be improved.

Copilot AI review requested due to automatic review settings March 22, 2026 15:42
@Khiladi-786
Copy link
Author

Thanks for the detailed review!

I've updated the README to:

  • Fix Markdown formatting (replaced ,,,bash with proper code blocks)
  • Removed incorrect dependency steps
  • Added explicit instruction to start the server before running the demo
  • Clarified the usage of PYTHONPATH only for source-based execution

Please let me know if any further improvements are needed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to +68
except OSError:
print(f"\nError: Port {port} is already in use.")
print("Try running on another port:")
print(f"python -m visdom.server -port {port+1}\n")
sys.exit(1)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The except OSError: handler assumes every OSError from app.listen(...) means "port already in use", but listen can fail for other reasons (e.g., permission denied, invalid address). Catch the exception as e, check e.errno (e.g., errno.EADDRINUSE / Windows equivalent), and re-raise or report a more accurate message for other error codes.

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +191
,,,bash
conda create -n visdom_env python=3.10 -y
conda activate visdom_env
pip install -r requirements.txt
pip install pillow charset-normalizer
pip install -e .
python example/demo.py
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section uses ,,,bash instead of a fenced code block (```bash). As written, the Markdown rendering will be broken and the commands may not display as code.

Copilot uses AI. Check for mistakes.
Comment on lines +188 to +190
pip install -r requirements.txt
pip install pillow charset-normalizer
pip install -e .
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip install -r requirements.txt will fail because this repository doesn't have a requirements.txt at the repo root. Either reference an existing requirements file or rely on pip install -e . (which installs install_requires from setup.py).

Copilot uses AI. Check for mistakes.
Comment on lines +195 to +198
If you are running directly from source without installing the package:

PYTHONPATH=./py python -m visdom.server
,,,bash
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The troubleshooting command is not inside a proper fenced code block (and the closing fence is also ,,,bash). Wrap PYTHONPATH=./py python -m visdom.server in a valid ```bash block so it renders correctly and is easy to copy/paste.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +68
try:
if bind_local:
app.listen(port, max_buffer_size=1024**3, address="127.0.0.1")
else:
app.listen(port, max_buffer_size=1024**3)

logging.info("Application Started")
logging.info(f"Working directory: {os.path.abspath(env_path)}")

except OSError:
print(f"\nError: Port {port} is already in use.")
print("Try running on another port:")
print(f"python -m visdom.server -port {port+1}\n")
sys.exit(1)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description focuses on README/local setup docs, but this change also alters server runtime behavior by handling OSError during app.listen(...) and exiting the process. Please confirm this behavior change is intended and update the PR description accordingly so reviewers/users understand the non-doc impact.

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +54
import sys

Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys is already imported at the module level (line 17). The additional import sys inside start_server is redundant and should be removed to avoid duplicate imports and keep imports consistent.

Suggested change
import sys

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants