{"id":31017233,"url":"https://github.com/cetanu/python-env.nvim","last_synced_at":"2025-09-13T07:53:38.737Z","repository":{"id":310518541,"uuid":"1040163294","full_name":"cetanu/python-env.nvim","owner":"cetanu","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-18T15:21:04.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-18T17:31:09.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cetanu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-18T14:49:55.000Z","updated_at":"2025-08-18T15:21:08.000Z","dependencies_parsed_at":"2025-08-18T17:42:20.634Z","dependency_job_id":null,"html_url":"https://github.com/cetanu/python-env.nvim","commit_stats":null,"previous_names":["cetanu/python-env.nvim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cetanu/python-env.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cetanu%2Fpython-env.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cetanu%2Fpython-env.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cetanu%2Fpython-env.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cetanu%2Fpython-env.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cetanu","download_url":"https://codeload.github.com/cetanu/python-env.nvim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cetanu%2Fpython-env.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274935968,"owners_count":25376836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-13T07:53:33.151Z","updated_at":"2025-09-13T07:53:38.725Z","avatar_url":"https://github.com/cetanu.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-env.nvim\n\nA neovim plugin that automatically detects Python projects and sets up\nenvironment variables to hook up your editor to the correct python runtime.\n\n## Features\n\n- Automatically detects Python projects by looking for:\n  - `pyproject.toml`\n  - `poetry.lock`\n  - `uv.lock`\n  - Uses **Poetry** when `poetry.lock` is present\n  - Uses **uv** when `uv.lock` is present\n  - Falls back to configured tool preference order when no specific lock files are found\n\nI'm not that interested in supporting other tools as I don't use them, but if\nyou want, send over a PR\n\n- Activates the environment when you enter a Python project directory\n- Can restore the original environment when needed\n- Shows notifications when environments are activated\n- Optional debug logging for troubleshooting\n\n## Installation\n\n### Using [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n```lua\n{\n  \"cetanu/python-env.nvim\",\n  config = function()\n    require(\"python-env\").setup({\n      -- Optional configuration\n    })\n  end,\n}\n```\n\n## Configuration\n\nI've tried to set sane defaults, but you can change them if you like:\n\n```lua\nrequire(\"python-env\").setup({\n  -- File patterns to detect Python projects\n  project_files = {\n    \"pyproject.toml\",\n    \"poetry.lock\", \n  },\n  \n  -- Tools to try in order of preference\n  tools = { \"uv\", \"poetry\", },\n  \n  -- Whether to automatically setup on directory change\n  auto_setup = true,\n  \n  -- Whether to show notifications\n  notify = true,\n  \n  -- Debug mode (shows detailed logging)\n  debug = false\n})\n```\n\n## Commands\n\n- `:PythonEnvSetup` - Manually setup Python environment for current project\n- `:PythonEnvRestore` - Restore original environment variables\n- `:PythonEnvInfo` - Show information about the current Python environment\n\n## How It Works\n\n1. The plugin searches upward from the current directory for Python project files\n2. It determines which tool to use based on lock files:\n   - If `poetry.lock` exists, it prioritizes Poetry\n   - If `uv.lock` exists, it prioritizes uv\n   - If no specific lock files are found, it tries tools in the configured preference order\n3. It checks which Python environment tools are available on your system\n4. It uses the determined tool to find the project's virtual environment\n5. It sets the following environment variables:\n   - `VIRTUAL_ENV` - Path to the virtual environment\n   - `PATH` - Prepends the virtual environment's bin directory\n   - `PYTHON` - Path to the Python executable\n\n## Supported Tools\n\n### uv\nThe plugin looks for `.venv` directories or uses `uv python find` to locate the\nPython interpreter.\n\n### Poetry\nUses `poetry env info --path` to get the virtual environment path.\n\n## Troubleshooting\n\n### Enable Debug Mode\n```lua\nrequire(\"python-env\").setup({\n  debug = true\n})\n```\n\n### Check Environment Status\nUse `:PythonEnvInfo` to see the current environment status.\n\n### Manual Setup\nIf auto-setup isn't working, try `:PythonEnvSetup` to manually activate the environment.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nFSL-1.1-MIT, see LICENSE.md for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcetanu%2Fpython-env.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcetanu%2Fpython-env.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcetanu%2Fpython-env.nvim/lists"}