Git Product home page Git Product logo

rye's Introduction

Rye: a Hassle-Free Python Experience


Rye

Rye is a comprehensive project and package management solution for Python. Born from its creator's desire to establish a one-stop-shop for all Python users, Rye provides a unified experience to install and manage Python installations, pyproject.toml based projects, dependencies and virtualenvs seamlessly. It's designed to accommodate complex projects, monorepos and to facilitate global tool installations. Curious? Watch an introduction.

A hassle-free experience for Python developers at every level.

Watch the instruction

Click on the thumbnail to watch a 16 minute introduction video

In The Box

Rye picks and ships the right tools so you can get started in minutes:

  • Bootstraps Python: it provides an automated way to get access to the amazing Indygreg Python Builds as well as the PyPy binary distributions.
  • Linting and Formatting: it bundles ruff and makes it available with rye lint and rye fmt.
  • Managing Virtualenvs: it uses the well established virtualenv library under the hood.
  • Building Wheels: it delegates that work largely to build.
  • Publishing: its publish command uses twine to accomplish this task.
  • Locking and Dependency Installation: is today implemented by using uv with a fallback to unearth and pip-tools.
  • Workspace support: Rye lets you work with complex projects consisting of multiple libraries.

Installation

The installation takes just a minute:

  • Linux and macOS:

    curl -sSf https://rye-up.com/get | bash
    
  • Windows:

    Download and run the installer (64bit Intel or 32bit Intel).

For more details and other options, refer to the installation instructions.

Learn More

Did I spark your interest?

More

  • Discussion Forum, to discuss the project on GitHub
  • Discord, for conversations with other developers in text form
  • Issue Tracker, if you run into bugs or have suggestions
  • Badges, if you want to show that you use Rye
  • License: MIT

rye's People

Contributors

335g avatar aisk avatar anti-social avatar avosa avatar bluss avatar charleschen0823 avatar charliermarsh avatar cnpryer avatar cojua8 avatar dhruvinsh avatar dnlbauer avatar dsp avatar github-actions[bot] avatar gunungpw avatar ischaojie avatar j178 avatar mitsuhiko avatar nedjwestern avatar nicoddemus avatar sakti avatar sbarrios93 avatar stephan-noel avatar striezel avatar t-256 avatar tiangolo avatar tombl avatar whynothugo avatar willingc avatar wuyumin avatar yezz123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rye's Issues

Package resolution defaults to latest, not latest stable

Conventionally, the default behavior of package resolution is to use latest stable versions. Perhaps the behavior of using the very latest / prerelease could be behind a flag of the add command. pip uses the flag --pre for that. (https://pip.pypa.io/en/stable/cli/pip_install/#install-pre)

As an example: latest stable pydantic (https://pypi.org/project/pydantic/) is version 1.10.7, latest pydantic (as found on https://pypi.org/simple/pydantic/) is version 2.0a3. Currently, rye selects the alpha version.

Plugin for Pycharm/IntelliJ

Integration with Pycharm and other Jetbrains IDEs can make usage of project management tools such as Rye more convenient.

I'd like to suggest the following features in an IntelliJ plugin:

  • New project wizard/template
  • rye interpreter/environment management

Although I'm inexperienced with creating plugins for IntelliJ, I'd still like to contribute towards this. I've created a repository to serve as a starting point at https://github.com/imbev/rye-pycharm-plugin

Show available Python interpreter lists for download/installation

Feature request

Add a new option of rye toolchain to show Show available Python interpreter lists for download/installation

Detail

rye toolchain list shows the installed Python interpreter list.
And rye toolchain fetch can download a specific Python interpreter version.
But we don't know what Python interpreter version can download.

Motivation

I'm developing the rye integration plugin for PyCharm.
When we create a new project in the PyCharm, a user should select a specific Python interpreter version.
I want to use the list of the new option instead of the Base Interpreter dropdown list in the screenshot.
new_project

Related Issues:
#28

[feature] Project templates

In larger organizations, it is often useful to have some kind of tmeplate for starting new python projects to encourage (organizational) best practices. A popular solution for python projects would be the Cookiecutter project.

I was even thinking of some kind of mechanism, where something like django or other larger packages could define a template and rye would be able to list that (and others) as a possible project starter if django (or whatever) is already installed. Sort of an entrypoint-system or plugin system for project templates, that rye would provide and other packages could hook into, registering their templates with rye. Just an idea. You could also just wrap Cookiecutter, which takes git repository URLs for external templates, or leave it out completely. Packaging just has a lot of biolerplate, that a unified tool could take care of.

As for the interface, Hatchet has

hatchet new --ci --tests --docs

if I remember correctly. Rye could have a similar

rye init --app/--library --ci --tests --docs --django --vcs-versions --jupyter ...

Not saying I want rye to have these, just giving options (literally 😁 ).

Consider musl builds

It might be worthwhile to consider picking musl builds instead of glibc builds for platforms without glibc to address #30. The builds themselves are available but currently not considered by rye.

`pip-compile` resolves against internal python version

  1. execute cmd
rye init testrye
rye pin [email protected]
rye sync
rye add flask
rye sync
  1. then failed.

I found that the requirements using pip-compile found for flask is not match the python version 3.7.
According search the result in google, I found that the tools pip-compile cannot specify python-version, so I thought the method of using pip-compile with self env is not proper.

`rye install jupyter` does not add `jupyter` to ~/.rye/shims

Steps to Reproduce

  1. Run rye install pycowsay - verify that pycowsay appears in ~/.rye/shims
  2. Run rye install jupyter

Expected Result

The jupyter command is added to ~/.rye/shims and can be run from the terminal if ~/.rye/shims is on the PATH.

Actual Result

No scripts are added to ~/.rye/shims, and there's an error message:
warning: installed package did not expose any scripts

Version Info

rye 0.1.0
commit: unknown (01cbe9681 2023-04-28)
platform: macos (aarch64)
self-python: [email protected]

(Aside: rye --version currently prints to stderr, which means you have to do rye --version 2>&1 | pbcopy. If it printed to stdout it would make this a bit easier: rye --version | pbcopy)

Stacktrace

No response

rye mentions 3 different versions of Python, then fails at installing any

On Ubuntu 20.04 with deadsnake:

$ rye pin 3.11
pinned [email protected] in /tmp/.python-version
 
$ rye init
success: Initialized project in /tmp/.
$ cat pyproject.toml 
[project]
...
requires-python = ">= 3.8"
...
$ rye run python
Bootstrapping rye internals
Downloading [email protected]
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 15.13 KiB/27.29 MiBtar: Archive is compressed. Use --zstd option
tar: Error is not recoverable: exiting now
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', rye/src/bootstrap.rs:176:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Rye mentions 3.11, 3.8 and 3.10, so I don't understand what's going on.

Unfortunately, adding the backtrace doesn't give much more info:

$ export RUST_BACKTRACE=1
$ rye run python
Bootstrapping rye internals
error: No such file or directory (os error 2)

rye install on zip / local path behaves weirdly

Steps to Reproduce

If you install a downloaded zip with rye install ./path/to.zip it does something, but it does something completely wrong.

Expected Result

I would expect the virtualenv for the tool to match the package name of what's inside the zip

Actual Result

The tool is named archive-name-zip and scripts are not installed correctly

Version Info

rye 0.1.0
commit: unknown (c137b62c1 2023-04-26)
platform: macos (aarch64)
self-python: [email protected]

Stacktrace

No response

Shell completion

clap_complete seems to have worked fine for me.

Could generate the completion scripts and print them from rye self completion or something for a first pass.

[Suggestion] Moving project to a GitHub organization

I think rye has great potential (esp. with the monorepo management). I'd love to see it developed and maintained by the community. I think moving the project to a GitHub organization would help more people to contribute.

rye sync should not require README.md file

Steps to Reproduce

https://github.com/wasdee/ped4you-cross-detection/blob/main/Dockerfile.rye

FROM rust:latest

RUN cargo install --git https://github.com/mitsuhiko/rye rye

WORKDIR /usr/src/app

COPY requirements*.lock pyproject.toml ./
RUN rye sync

COPY main.py ./
COPY models/model2.pkl ./models/

EXPOSE 8000

CMD rye run serve

Expected Result

COPY requirements*.lock pyproject.toml ./
no readme.md needed

Actual Result

 => ERROR [5/7] RUN rye sync                                                                               24.1s
------                                                                                                           
 > [5/7] RUN rye sync:                                                                                           
#9 0.420 Bootstrapping rye internals                                                                             
#9 0.421 Downloading [email protected]                                                                              
#9 5.419 success: Downloaded [email protected]                                                                      
#9 12.56 Upgrading pip                                                                                           
#9 13.22 Installing internal dependencies
#9 16.86 Downloading [email protected]
#9 21.37 success: Downloaded [email protected]
#9 21.38 Initializing new virtualenv in /usr/src/app/.venv
#9 21.38 Python version: [email protected]
#9 21.79 Generating production lockfile: /usr/src/app/requirements.lock
#9 23.91     error: subprocess-exited-with-error
#9 23.91     
#9 23.91     × Preparing metadata (pyproject.toml) did not run successfully.
#9 23.91     │ exit code: 1
#9 23.91     ╰─> [18 lines of output]
#9 23.91         Traceback (most recent call last):
#9 23.91           File "/root/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
#9 23.91             main()
#9 23.91           File "/root/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
#9 23.91             json_out['return_val'] = hook(**hook_input['kwargs'])
#9 23.91           File "/root/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
#9 23.91             whl_basename = backend.build_wheel(metadata_directory, config_settings)
#9 23.91           File "/tmp/pip-build-env-frn1ltt3/overlay/lib/python3.10/site-packages/hatchling/build.py", line 56, in build_wheel
#9 23.91             return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
#9 23.91           File "/tmp/pip-build-env-frn1ltt3/overlay/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 93, in build
#9 23.91             self.metadata.validate_fields()
#9 23.91           File "/tmp/pip-build-env-frn1ltt3/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 244, in validate_fields
#9 23.91             self.core.validate_fields()
#9 23.91           File "/tmp/pip-build-env-frn1ltt3/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 1325, in validate_fields
#9 23.91             getattr(self, attribute)
#9 23.91           File "/tmp/pip-build-env-frn1ltt3/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 508, in readme
#9 23.91             raise OSError(message)
#9 23.91         OSError: Readme file does not exist: README.md
#9 23.91         [end of output]

Version Info

rye --version
rye 0.1.0
commit: unknown (c8e50e5 2023-04-30)
platform: linux (x86_64)
self-python: [email protected]

Stacktrace

No response

A local sync service to replace rye sync

IIRC Cargo uses fingerprints to determine when updates have been made to the project and its environment. It would be nice to have rye sync managed by a kind of watch service that does something like this.

This probably makes more sense in the future with faster sync operations, but I thought I could propose it for the wishlist.

Confusing Error if Internal Python Builds do not Run

$ rye add atomicwrites
Bootstrapping rye internals
error: No such file or directory (os error 2)

With #29 I get:

Bootstrapping rye internals
Error: error bootstrapping venv

Caused by:
    0: unable to create self venv
    1: No such file or directory (os error 2)

constrain requires-python version work not proper

Steps to Reproduce

  1. rye init testrye
  2. rye pin [email protected]
  3. rye sync

Expected Result

execute success and pyproject.toml requires-python version set as pin >=3.7

Actual Result

Downloading [email protected]
success: Downloaded [email protected]
Initializing new virtualenv in /Users/charles/program/python/testrye/.venv
Python version: [email protected]
Generating production lockfile: /Users/charles/program/python/testrye/requirements.lock
Generating dev lockfile: /Users/charles/program/python/testrye/requirements-dev.lock
Installing dependencies
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Obtaining file:///. (from -r /var/folders/z4/4q0sj3vn5fvbmp8v961pnkl40000gn/T/tmpwi9yy1uk (line 1))
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of testrye to determine which version is compatible with other requirements. This could take a while.
ERROR: Package 'testrye' requires a different Python: 3.7.9 not in '>=3.8'
Traceback (most recent call last):
File "/Users/charles/.rye/self/bin/pip-sync", line 8, in
sys.exit(cli())
File "/Users/charles/.rye/self/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/charles/.rye/self/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/charles/.rye/self/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/charles/.rye/self/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/charles/.rye/self/lib/python3.10/site-packages/piptools/scripts/sync.py", line 174, in cli
sync.sync(
File "/Users/charles/.rye/self/lib/python3.10/site-packages/piptools/sync.py", line 244, in sync
run( # nosec
File "/Users/charles/.rye/py/[email protected]/install/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Users/charles/program/python/testrye/.venv/bin/python', '-m', 'pip', 'install', '-r', '/var/folders/z4/4q0sj3vn5fvbmp8v961pnkl40000gn/T/tmpwi9yy1uk', '--index-url', 'http://mirrors.aliyun.com/pypi/simple', '--trusted-host', 'mirrors.aliyun.com', '--python=/Users/charles/program/python/testrye/.venv/bin/python']' returned non-zero exit status 1.
Error: Installation of dependencies failed

Version Info

rye 0.1.0
commit: unknown (74937e3 2023-04-29)
platform: macos (x86_64)
self-python: [email protected]

Stacktrace

No response

Binary Linux release

Let me kindly ask for a binary Linux release for testing. (I am currently using venv+pip-tools.)

Confusing URL / Path Installation via Rye Install

As mentioned by @simonw, the way you depend on a non published package is non obvious.

$ rye install https://github.com/simonw/datasette/archive/main.zip
Error: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `:`
https://github.com/simonw/datasette/archive/main.zip
     ^

The correct syntax today is rye install datasette @ url in line with requirements specifiers. Maybe the tool should gain a --url option similar and hint that in the usage. This is similar to how cargo installs cargo install --git ... package_name.

Requirements.lock uses the project's absolute path

When adding a package e.g. requests and doing rye sync, the following is generated:

-e file:///var/my/path/rye-test
certifi==2022.12.7
charset-normalizer==3.1.0
idna==3.4
requests==2.28.2
urllib3==1.26.15

The path used in the first line is the absolute path the project. This could cause problems with multiple users collaborating on the same project and sharing lock files.

concurrent pip

Currently, the internet's answer to

How do I concurrently install pip packages?

Is something along the lines of

xargs --max-args=1 --max-procs=4 pip install < requirements.txt

Wouldn't be awesome if rye took care of the concurrency problem as well?

Thanks for this great project 🤟🏽

"rye install datasette" doesn't put anything in ~/.rye/shims

Steps to Reproduce

I just released a new version of Datasette - 0.64.3 - which adds the setuptools and pip dependencies which were causing it to break in Rye (see https://til.simonwillison.net/python/rye#user-content-failing-and-then-succeeding-to-install-datasette)

  1. rye install datasette - this succeeds
  2. But... I would expect to be able to run ~/.rye/shims/datasette --version - but that file does not exist
  3. ~/.rye/tools/datasette/bin/datasette --version does work

Expected Result

I expected ~/.rye/shims/datasette to be created.

Actual Result

It wasn't created.

Version Info

rye 0.1.0
commit: unknown (c137b62c1 2023-04-26)
platform: macos (aarch64)
self-python: [email protected]

Stacktrace

No response

Support for private repositories

Currently in poetry you can do something like:

[[tool.poetry.source]]
name = "my_source"
url = "..."

[tool.poetry.dependencies]
my-package = { version = "=1.0.0", source = "my_source" }

to support getting packages from a private repository.

However this doesn't seem to work with rye out the box. Is there a way to do this with rye, or is development needed?

Intergrate Apache OpenDAL with rye

OpenDAL is an Apache Project which people can use to CRUD files on multiple services like S3, IPFS, Azure blob, etc, with the same interface.

I think we can integrate it so that rye can install the file on different services. Here's an example

rye add s3://${bucket-name}/demo-project
rye sync

platform specific `--no-dependencies` support

  • 1st - thanks for all efforts put into rye, really a pleasure to use!

Issue description

  • I currently struggle to solve a issue with: https://github.com/pimoroni/inky under macos.
  • I cannot add / sync it with rye because it has a dependency (spidev) which is linux only
  • For local debugging on macos spidev is not needed

Suggestion

  • It would be awesome if rye could add a way to make a dependency systemspecific with --no-dependencies

Looking forward to discuss (hopefully) possible options 🚀

Support Local Python Installations

On the version of rye I published there is currently no support for local Python installations. This is pretty much intentional because I really want the experience to not involve manually downloading Pythons. However there are also situations where this is necessary. In the original implementation I had, the way non automatically managed Python installations worked was with registering them.

Link a Python:

ln -s /path/to/python ~/.rye/py/[email protected]

And to pick a default distribution for what gets picked up when you write 3.11.0 another symlink does:

ln -s ~/.rye/py/[email protected] ~/.rye/py/3.11.0

I however never really fleshed out the details and it was pretty brittle. In particular the only way I found to reliably pin a project to pypy for instance was to write pypy@madeupversion into .python-version which obviously is not very portable.

Remaining tasks:

  • enable rye to work with a local toolchain entirely (eg: make the self venv work with a supplied one)
  • find a good way to pin to specific installations without throwing stuff into the .python-version file that other toolchains cannot work with

Initializing projects with git

rye init will dump a .gitignore into the directory but the project isn't initialized with git.

Over in my project I implemented init to default to initializing with git and provide --no-vcs to opt-out.

Sync fails with requires-python = ">= 3.11"

Steps to Reproduce

rye init -p 3.11 test1
cd test1
rye add flask
rye sync

Expected Result

should work

Actual Result

$ rye init -p 3.11 test1
success: Initialized project in /Users/s/tmp/FFKn/test1
$ cd test1
$ rye pin [email protected]
pinned 3.11.1 in /Users/s/tmp/FFKn/test1/.python-version
$ rye add flask
Added flask~=2.3.2 as regular dependency
$ rye sync
Downloading [email protected]
success: Downloaded [email protected]
Initializing new virtualenv in /Users/s/tmp/FFKn/test1/.venv
Python version: [email protected]
Generating production lockfile: /Users/s/tmp/FFKn/test1/requirements.lock
Traceback (most recent call last):
  File "/Users/s/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
  File "/Users/s/.rye/self/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 439, in resolve
    raise ResolutionImpossible(self.state.backtrack_causes)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=RequiresPythonRequirement('>=3.11'), parent=EditableCandidate('file:///.'))]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/s/.rye/self/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/Users/s/.rye/self/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/piptools/scripts/compile.py", line 592, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/Users/s/.rye/self/lib/python3.10/site-packages/piptools/resolver.py", line 593, in resolve
    is_resolved = self._do_resolve(
  File "/Users/s/.rye/self/lib/python3.10/site-packages/piptools/resolver.py", line 625, in _do_resolve
    resolver.resolve(
  File "/Users/s/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 101, in resolve
    raise error from e
pip._internal.exceptions.UnsupportedPythonVersion: Package 'test1' requires a different Python: 3.10.9 not in '>=3.11'
Error: could not write production lockfile for project

Caused by:
    failed to generate lockfile

Version Info

rye 0.1.0
commit: unknown (d31b4853a 2023-05-01)
platform: macos (aarch64)
self-python: [email protected]

Stacktrace

No response

`rye shell`, like `poetry shell`

poetry has shell subcommand to spawn a shell within the virtual environment.
The same thing can be achieved by simply running source .venv/bin/activate, but what about having rye shell?

Shim launches rye

I don't use the shims, but I just noticed that they're all pointing to the rye binary.

➜ ls -l ~/.rye/shims/
total 0
lrwxrwxrwx 1 abou_zeid hiwi 30 Apr 23 20:43 python -> /home/abou_zeid/.cargo/bin/rye*
lrwxrwxrwx 1 abou_zeid hiwi 30 Apr 23 20:43 python3 -> /home/abou_zeid/.cargo/bin/rye*

Adding dependency by version control system

Steps to Reproduce

rye add git+ssh://[email protected]/MyProject, or add it as dependency in project.toml

Expected Result

Support of adding dependency via version control system is expected.
https://pip.pypa.io/en/stable/topics/vcs-support/

Actual Result

Expected end or semicolon (after name and no valid version specifier) git+https://...

Version Info

rye 0.1.0
commit: unknown (aa5594994 2023-04-28)
platform: linux (x86_64)
self-python: [email protected]

Stacktrace

No response

Should rye allow project folders with spaces in between?

Related to #37, if the project folder contains spaces, then the project name in pyproject.toml will also contain names, which is not allowed.

Should rye normalize the project name for projects which root folder contains spaces?

➜ rye init
success: Initialized project in /private/tmp/test 1/.
➜ rye sync
Initializing new virtualenv in /private/tmp/test 1/.venv
Python version: [email protected]
Generating production lockfile: /private/tmp/test 1/requirements.lock
    error: subprocess-exited-with-error

    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [20 lines of output]
        Traceback (most recent call last):
          File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
            main()
          File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
            whl_basename = backend.build_wheel(metadata_directory, config_settings)
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/build.py", line 56, in build_wheel
            return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 93, in build
            self.metadata.validate_fields()
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 244, in validate_fields
            self.core.validate_fields()
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 1325, in validate_fields
            getattr(self, attribute)
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 409, in name
            self._name = normalize_project_name(self.raw_name)
          File "/private/var/folders/xn/8rrz2r9s6gb_vbycdvs2t4f00000gn/T/pip-build-env-npq7zyua/overlay/lib/python3.10/site-packages/hatchling/metadata/core.py", line 397, in raw_name
            raise ValueError(message)
        ValueError: Required field `project.name` must only contain ASCII letters/digits, underscores, hyphens, and periods, and must begin and end with ASCII letters/digits.
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
Traceback (most recent call last):
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/operations/build/metadata.py", line 35, in generate_metadata
    distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 713, in prepare_metadata_for_build_wheel
    return super().prepare_metadata_for_build_wheel(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/utils/subprocess.py", line 252, in runner
    call_subprocess(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/utils/subprocess.py", line 224, in call_subprocess
    raise error
pip._internal.exceptions.InstallationSubprocessError: Preparing metadata (pyproject.toml) exited with 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/seba/.rye/self/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/piptools/scripts/compile.py", line 592, in cli
    results = resolver.resolve(max_rounds=max_rounds)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/piptools/resolver.py", line 593, in resolve
    is_resolved = self._do_resolve(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/piptools/resolver.py", line 625, in _do_resolve
    resolver.resolve(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 491, in collect_root_requirements
    req = self._make_requirement_from_install_req(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 453, in _make_requirement_from_install_req
    cand = self._make_candidate_from_link(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 185, in _make_candidate_from_link
    self._editable_candidate_cache[link] = EditableCandidate(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 318, in __init__
    super().__init__(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
    self.dist = self._prepare()
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare
    dist = self._prepare_distribution()
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 328, in _prepare_distribution
    return self._factory.preparer.prepare_editable_requirement(self._ireq)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 687, in prepare_editable_requirement
    dist = _get_prepared_distribution(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py", line 61, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 555, in prepare_metadata
    self.metadata_directory = generate_metadata(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/operations/build/metadata.py", line 37, in generate_metadata
    raise MetadataGenerationFailed(package_details=details) from error
pip._internal.exceptions.MetadataGenerationFailed: metadata generation failed
Error: could not write production lockfile for project

Caused by:
    failed to generate lockfile

pyproject.toml

[project]
name = "test 1"
version = "0.1.0"
description = "Add a short description here"
authors = [
    { name = "sbarrios93", email = "REDACTED" }
]
dependencies = []
readme = "README.md"
requires-python = ">= 3.8"
license = { text = "MIT" }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true

Windows Support

I am opening this issue to investigate Windows support. I will do a test tomorrow to see what is needed and what is missing ?

Thank you for this nice tool

Shell subcommand doesn't bump venv Python in PATH

Is the goal for rye shell to activate a shell with a modified environment that places the venv bin at the top of PATH? If so I'm not sure this is working with SHELL -l.

Using zsh on macos I get the following experience:

With aa55949

test-project on  master [?] is 📦 v0.0.1 via 🐍 
❯ rye run python -c "import sys; print(sys.executable)" 
/Users/chrispryer/github/sandbox/rye/test-project/.venv/bin/python

test-project on  master [?] is 📦 v0.0.1 via 🐍 
❯ rye shell
Spawning virtualenv shell from /Users/chrispryer/github/sandbox/rye/test-project/.venv
Leave shell with 'exit'

test-project on  master [?] is 📦 v0.0.1 via 🐍 (.venv) 
❯ which python
/Users/chrispryer/.pyenv/shims/python

With something like sh --init-file .venv/bin/activate

test-project on  master [?] is 📦 v0.0.1 via 🐍 took 1m9s 
❯ rye run python -c "import sys; print(sys.executable)"
/Users/chrispryer/github/sandbox/rye/test-project/.venv/bin/python

test-project on  master [?] is 📦 v0.0.1 via 🐍 
❯ rye shell                                            
Spawning virtualenv shell from /Users/chrispryer/github/sandbox/rye/test-project/.venv
Leave shell with 'exit'
sh-3.2$ which python
/Users/chrispryer/github/sandbox/rye/test-project/.venv/bin/python

Rye中文文档

虽然目前Rye还处于试验阶段,但是无法阻止我的热情。
现在已经开始把文档翻译成中文,希望能在中文互联网推动Rye的发展。

如果作者允许的话 我们将欢迎更多小伙伴加入并完善文档。

预览可以看 https://www.pyrye.cn

make Virtualenvs optional

I think this should be a minor change and it would be a big improvemnt for people using containers or people that doesn't know how to use Virtualenvs

Add Integration Tests

I never came around writing integration tests, which is something that needs to happen if this were to turn into something.

Bootstrapping rye internals

$ rye pin 3.11
$ rye run python
Bootstrapping rye internals
error: No such file or directory (os error 2)

rye sync fails when directory path contains space character

When starting a new project

➜ rye init
success: Initialized project in /Users/seba/Dropbox/MBA/Spring 2023/pm/hw6/.

but sync fails because of the space character in the directory path.

➜ rye sync
Initializing new virtualenv in /Users/seba/Dropbox/MBA/Spring 2023/pm/hw6/.venv
Python version: [email protected]
Generating production lockfile: /Users/seba/Dropbox/MBA/Spring 2023/pm/hw6/requirements.lock
Traceback (most recent call last):
  File "/Users/seba/.rye/self/bin/pip-compile", line 8, in <module>
    sys.exit(cli())
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/piptools/scripts/compile.py", line 517, in cli
    constraints.extend(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/piptools/_compat/pip_compat.py", line 36, in parse_requirements
    yield install_req_from_parsed_requirement(parsed_req, isolated=isolated)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/req/constructors.py", line 459, in install_req_from_parsed_requirement
    req = install_req_from_editable(
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/req/constructors.py", line 214, in install_req_from_editable
    parts = parse_req_from_editable(editable_req)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/req/constructors.py", line 183, in parse_req_from_editable
    name, url, extras_override = parse_editable(editable_req)
  File "/Users/seba/.rye/self/lib/python3.10/site-packages/pip/_internal/req/constructors.py", line 100, in parse_editable
    raise InstallationError(
pip._internal.exceptions.InstallationError: /Users/seba/Dropbox/MBA/Spring is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
Error: could not write production lockfile for project

Caused by:
    failed to generate lockfile

Adding docs

I know this is still experimental, but IMO an experiment is only as good as the data it can garner. IME I've noticed a lot of people use a user guide of some form. A lot of the README's contents could be refined into a user guide.

I really like what ruff and hatch have for documentation main...cnpryer:rye:docs.

rye install does not fetch

I just installed rye on a Debian bullseye and tested a simple install:

$ rye install platformio
Bootstrapping rye internals
Downloading [email protected]
success: Downloaded [email protected]
Upgrading pip
Installing internal dependencies
FileNotFoundError: [Errno 2] No such file or directory: '/home/ddouard/.rye/py/[email protected]/install/bin/python3'
error: failed to initialize virtualenv

notice the mixup between py 3.11 and py 3.10 here.

PS: Installed rye v0.1.0 (https://github.com/mitsuhiko/rye#eaf12925) using rust 1.67.0 (fc594f156 2023-01-24)
Note that I did not run any other command between the cargo install rye and the command above.
After a rye fetch 3.11, the rye install command does work, but any rye sync or rye run command complains about the lack of a pyproject.toml file (which I don't expect to be necessary to install a python package 'globally').

Thanks!

Editable vs non Editable requirements.txt

Today the assumption rye makes is that you always want editable installs when using lockfiles. That works really well for my uses, but I can see that this is not helping others. I would be quite curious how people are generally dealing with this, particularly when working with monorepos.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.