generated from teamhide/fastapi-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
migrate to uv from pyenv and publish to test.pypi #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Migration Guide: pyenv to uv | ||
|
|
||
| This guide will help you migrate from pyenv to uv for Python environment and package management. | ||
|
|
||
| ## What is uv? | ||
|
|
||
| uv is a modern Python package installer and resolver written in Rust. It's designed to be a faster, more reliable alternative to pip and other Python package managers. | ||
|
|
||
| ## Migration Steps | ||
|
|
||
| ### 1. Virtual Environment Management | ||
|
|
||
| **With pyenv (old way):** | ||
| ```bash | ||
| # Create a virtual environment | ||
| pyenv virtualenv 3.11.4 my-project-env | ||
| # Activate the environment | ||
| pyenv activate my-project-env | ||
| ``` | ||
|
|
||
| **With uv (new way):** | ||
| ```bash | ||
| # Create a virtual environment | ||
| uv venv .venv | ||
| # Activate the environment | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| ### 2. Package Installation | ||
|
|
||
| **With pip (old way):** | ||
| ```bash | ||
| pip install -e . | ||
| pip install -e ".[dev]" | ||
| ``` | ||
|
|
||
| **With uv (new way):** | ||
| ```bash | ||
| uv pip install -e . | ||
| uv pip install pytest flake8 black mypy # Install dev dependencies | ||
| ``` | ||
|
|
||
| ### 3. Managing Dependencies | ||
|
|
||
| **With pip (old way):** | ||
| ```bash | ||
| pip freeze > requirements.txt | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| **With uv (new way):** | ||
| ```bash | ||
| # Generate a lock file | ||
| uv pip freeze > requirements-lock.txt | ||
| # Install from lock file | ||
| uv pip install -r requirements-lock.txt | ||
| ``` | ||
|
|
||
| ## Workflow Changes | ||
|
|
||
| 1. **Environment Activation**: Use `source .venv/bin/activate` instead of `pyenv activate` | ||
| 2. **Package Installation**: Use `uv pip install` instead of `pip install` | ||
| 3. **Dependency Management**: Use `uv pip freeze` and `uv pip install -r` for dependency management | ||
|
|
||
| ## Benefits of uv | ||
|
|
||
| - **Speed**: uv is significantly faster than pip for package installation and resolution | ||
| - **Reliability**: Better dependency resolution with fewer conflicts | ||
| - **Compatibility**: Works with existing Python projects and tools | ||
| - **Modern Features**: Better caching, parallel downloads, and more | ||
|
|
||
| ## Additional uv Commands | ||
|
|
||
| - `uv pip list` - List installed packages | ||
| - `uv pip uninstall <package>` - Uninstall a package | ||
| - `uv pip show <package>` - Show information about a package | ||
| - `uv pip check` - Verify installed packages have compatible dependencies | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If you encounter any issues with the migration, try the following: | ||
|
|
||
| 1. Ensure you're using the latest version of uv: `uv --version` | ||
| 2. If a package fails to install, try installing it with `--no-binary`: `uv pip install --no-binary :all: <package>` | ||
| 3. For any compatibility issues, you can always fall back to pip within the virtual environment: `pip install <package>` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| version: '3.8' | ||
|
|
||
| services: | ||
| prompt_secure: | ||
| compliant_llm: | ||
| build: . | ||
| ports: | ||
| - "8001:8001" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,14 +3,14 @@ requires = ["setuptools>=61.0"] | |
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "prompt_secure" | ||
| name = "compliant-llm" | ||
| version = "0.1.0" | ||
| description = "Tool for testing AI system prompts against various attack vectors" | ||
| readme = "README.md" | ||
| requires-python = ">=3.9" | ||
| license = {text = "MIT"} | ||
| authors = [ | ||
| {name = "Prompt Secure Contributors", email = "[email protected]"}, | ||
| {name = "Compliant LLM Contributors", email = "[email protected]"}, | ||
| ] | ||
| dependencies = [ | ||
| "pyyaml", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| aiofiles==24.1.0 | ||
| aiohappyeyeballs==2.6.1 | ||
| aiohttp==3.11.18 | ||
| aiosignal==1.3.2 | ||
| altair==5.5.0 | ||
| annotated-types==0.7.0 | ||
| anyio==4.9.0 | ||
| attrs==25.3.0 | ||
| black==25.1.0 | ||
| blinker==1.9.0 | ||
| cachetools==5.5.2 | ||
| certifi==2025.4.26 | ||
| charset-normalizer==3.4.2 | ||
| click==8.2.0 | ||
| distro==1.9.0 | ||
| filelock==3.18.0 | ||
| flake8==7.2.0 | ||
| frozenlist==1.6.0 | ||
| fsspec==2025.5.0 | ||
| gitdb==4.0.12 | ||
| gitpython==3.1.44 | ||
| h11==0.16.0 | ||
| httpcore==1.0.9 | ||
| httpx==0.28.1 | ||
| huggingface-hub==0.31.4 | ||
| idna==3.10 | ||
| importlib-metadata==8.7.0 | ||
| iniconfig==2.1.0 | ||
| jinja2==3.1.6 | ||
| jiter==0.10.0 | ||
| jsonschema==4.23.0 | ||
| jsonschema-specifications==2025.4.1 | ||
| litellm==1.70.0 | ||
| markdown-it-py==3.0.0 | ||
| markupsafe==3.0.2 | ||
| mccabe==0.7.0 | ||
| mdurl==0.1.2 | ||
| multidict==6.4.4 | ||
| mypy==1.15.0 | ||
| mypy-extensions==1.1.0 | ||
| narwhals==1.40.0 | ||
| numpy==2.2.6 | ||
| openai==1.75.0 | ||
| packaging==24.2 | ||
| pandas==2.2.3 | ||
| pathspec==0.12.1 | ||
| pillow==11.2.1 | ||
| platformdirs==4.3.8 | ||
| pluggy==1.6.0 | ||
| -e file:///Users/kaushik/Code/fc/compliant-llm | ||
| propcache==0.3.1 | ||
| protobuf==6.31.0 | ||
| pyarrow==20.0.0 | ||
| pycodestyle==2.13.0 | ||
| pydantic==2.11.4 | ||
| pydantic-core==2.33.2 | ||
| pydeck==0.9.1 | ||
| pyflakes==3.3.2 | ||
| pygments==2.19.1 | ||
| pytest==8.3.5 | ||
| python-dateutil==2.9.0.post0 | ||
| python-dotenv==1.1.0 | ||
| pytz==2025.2 | ||
| pyyaml==6.0.2 | ||
| referencing==0.36.2 | ||
| regex==2024.11.6 | ||
| requests==2.32.3 | ||
| rich==14.0.0 | ||
| rpds-py==0.25.0 | ||
| six==1.17.0 | ||
| smmap==5.0.2 | ||
| sniffio==1.3.1 | ||
| streamlit==1.45.1 | ||
| tenacity==9.1.2 | ||
| tiktoken==0.9.0 | ||
| tokenizers==0.21.1 | ||
| toml==0.10.2 | ||
| tornado==6.5 | ||
| tqdm==4.67.1 | ||
| typing-extensions==4.13.2 | ||
| typing-inspection==0.4.0 | ||
| tzdata==2025.2 | ||
| urllib3==2.4.0 | ||
| yarl==1.20.0 | ||
| zipp==3.21.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| from setuptools import setup, find_packages | ||
|
|
||
| setup( | ||
| name='prompt_secure', | ||
| name='compliant-llm', | ||
| version='0.1.0', | ||
| packages=find_packages(), | ||
| install_requires=[ | ||
|
|
@@ -31,12 +31,12 @@ | |
| ], | ||
| }, | ||
| python_requires='>=3.9', | ||
| author='Prompt Secure Contributors', | ||
| author='Compliant LLM Contributors', | ||
| author_email='[email protected]', | ||
| description='Tool for testing AI system prompts against various attack vectors', | ||
| long_description=open('README.md').read(), | ||
| long_description_content_type='text/markdown', | ||
| url='https://github.com/yourusername/prompt_secure', | ||
| url='https://github.com/fiddlecube/compliant-llm', | ||
| classifiers=[ | ||
| 'Development Status :: 3 - Alpha', | ||
| 'Intended Audience :: Developers', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this file go in git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. this functions like npm's
package-lock.json, enablinguvto cache and reuse dependencies.also, ensures that all dev builds and prod builds use the exact same version of packages.