-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support pyproject.toml and poetry.lock for Python packages #469
Comments
Actually, this feature request could also include support for pdm and pyflow. They are both very similar to Poetry, but bring support for PEP 582: a The three tools (poetry, pdm, pyflow) use the TOML format for their lock file and |
|
Although people are still working out that syntax, as you can see in https://www.python.org/dev/peps/pep-0621/#how-to-specify-dependencies . |
Something like this? def self.parse_pyproject(file_contents)
manifest = TomlRB.parse(file_contents)
map_dependencies(manifest['dependencies'], 'runtime') + map_dependencies(manifest['optional-dependencies'], 'develop')
end
def self.parse_pyproject_poetry(file_contents)
manifest = TomlRB.parse(file_contents)
map_dependencies(manifest['tool']['poetry']['dependencies'], 'runtime') + map_dependencies(manifest['tool']['poetry']['dev-dependencies'], 'develop')
end
def self.parse_pyproject_pdm(file_contents)
manifest = TomlRB.parse(file_contents)
map_dependencies(manifest['tool']['pdm']['dependencies'], 'runtime') + map_dependencies(manifest['tool']['pdm']['dev-dependencies'], 'develop')
end
def self.parse_pyproject_pyflow(file_contents)
manifest = TomlRB.parse(file_contents)
map_dependencies(manifest['tool']['pyflow']['dependencies'], 'runtime') + map_dependencies(manifest['tool']['pyflow']['dev-dependencies'], 'develop')
end
def self.parse_poetry_lock(file_contents)
manifest = TomlRB.parse(file_contents)
deps = []
manifest['package'].each do |info|
group = 'runtime' if info['category'] == 'main' else 'develop'
deps << {
name: info['name'],
requirement: map_requirements(info),
type: group
}
end
deps
end And add these to mappings: match_filename("poetry.lock") => {
kind: 'lockfile',
parser: :parse_poetry_lock
},
match_filename("pdm.lock") => {
kind: 'lockfile',
parser: :parse_poetry_lock
},
match_filename("pyflow.lock") => {
kind: 'lockfile',
parser: :parse_poetry_lock
},
match_filename("pyproject.toml") => {
kind: 'manifest',
parser: :parse_pyproject_poetry
} Not sure how to parse both Poetry/PDM/PyFlow and native dependencies in pyproject.toml. |
@tyrelsouza implemented in #477 |
Awesome! Thank you! |
Any idea on when this will be available on libraries.io 🙂 ? Or if this is already deployed, when/how the data will start being updated? |
A bit surprised not to see this feature request already opened 😄
More and more projects are using Poetry to manage their dependencies. It could be great if Libraries.io could parse these dependencies in the
pyproject.toml
andpoetry.lock
files.Example
pyproject.toml
:Example
poetry.lock
The text was updated successfully, but these errors were encountered: