ddedalus / poetry-auto-export Goto Github PK
View Code? Open in Web Editor NEWAutomatically create requirements.txt on every poetry lock
License: MIT License
Automatically create requirements.txt on every poetry lock
License: MIT License
requirements.txt file was not being auto-generated when running poetry lock
after installing the plugin
[[tool.poetry-auto-export.exports]]
output = "requirements-dev.txt"
without_hashes = true
[[tool.poetry-auto-export.exports]]
output = "requirements.txt"
without = ["dev"]
without_hashes = true
Installed the plugin via pipx inject poetry poetry-auto-export
Checked that the plugin was installed using poetry self show plugins
Was not getting the requirements.txt and requirements-dev.txt files being generated when running poetry lock
When I commented out the following lines in the plugin, it worked fine. I'm not sure why that check exists.
PS - thank you so much for creating this plugin - I'd finally gotten fed up after forgetting to update this way too many times when working with docker and your plugin magically showed up when I did a search for something like this.
I started to use this plugin midway in my previous project and it worked very well.
But when I tried to create a new project, an error poped up.
Poetry could not find a pyproject.toml file in <CURRENT DIRECTORY> or its parents
Before installing the plugin, this only occorred when I typed somthing like poetry version
where pyproject.toml
was necessary.
In this case I simply typed the poetry
command, just to see the help messages.
-vvv
): Stack trace:
8 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
7 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/console/application.py:188 in _run
186│ self._disable_cache = io.input.has_parameter_option("--no-cache")
187│
→ 188│ self._load_plugins(io)
189│
190│ exit_code: int = super()._run(io)
6 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/console/application.py:355 in _load_plugins
353│ manager = PluginManager(ApplicationPlugin.group)
354│ manager.load_plugins()
→ 355│ manager.activate(self)
356│
357│ # We have to override the command from poetry-plugin-export
5 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/plugins/plugin_manager.py:71 in activate
69│ def activate(self, *args: Any, **kwargs: Any) -> None:
70│ for plugin in self._plugins:
→ 71│ plugin.activate(*args, **kwargs)
72│
73│ def _load_plugin_entry_point(self, ep: metadata.EntryPoint) -> None:
4 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry_auto_export/plugin.py:22 in activate
20│ if not application.event_dispatcher:
21│ return
→ 22│ self.configs = self._parse_pyproject(application.poetry.pyproject.data)
23│ application.event_dispatcher.add_listener(TERMINATE, self.run_exports)
24│ return super().activate(application)
3 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/console/application.py:129 in poetry
127│ project_path = self._io.input.option("directory")
128│
→ 129│ self._poetry = Factory().create_poetry(
130│ cwd=project_path,
131│ io=self._io,
2 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/factory.py:58 in create_poetry
56│ io = NullIO()
57│
→ 58│ base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
59│
60│ poetry_file = base_poetry.pyproject_path
1 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/core/factory.py:50 in create_poetry
48│ from poetry.core.pyproject.toml import PyProjectTOML
49│
→ 50│ poetry_file = self.locate(cwd)
51│ local_config = PyProjectTOML(path=poetry_file).poetry_config
52│
RuntimeError
Poetry could not find a pyproject.toml file in <CURRENT DIRECTORY> or its parents
at ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/core/factory.py:507 in locate
503│ if poetry_file.exists():
504│ return poetry_file
505│
506│ else:
→ 507│ raise RuntimeError(
508│ f"Poetry could not find a pyproject.toml file in {cwd} or its parents"
509│ )
510│
It seem like the problem is related to parsing the config in activate()
If the parsing of config is delayed (ex: parse the config in run_exports
), the problem sould be solved :)
Hi, first of all, thanks for this plugin, I have been long waiting for this. I would suggest to add multiple export configurations. In our case, we have different requirements for regular building (no dev dependencies) and for testing (that includes dev dependencies).
This is our current structure, that could be similar to other projects:
.
├── README.md
├── poetry.lock
├── pyproject.toml
├── src
│ ├── my_package
│ │ ├── __init__.py
│ │ ├── package_1
│ │ │ ├── __init__.py
│ │ │ └── app.py
│ └── requirements.txt
└── tests
├── requirements-dev.txt
└── unit
└── test_1.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.