poetry_test_project_for_me


Namepoetry_test_project_for_me JSON
Version 0.2.6 PyPI version JSON
download
home_pageNone
SummaryA poetry python test projet
upload_time2024-11-06 15:12:15
maintainerNone
docs_urlNone
authorAlex Brightwater
requires_python==3.11.*
licenseGPL-3.0-only
keywords poetry testing_package
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Poetry Test

In this proeject, I will be testing the poetry package manager for python.

Currently the project is capable of downloading a random image via running poetry_test or download_img

## How to Poetry

--> https://python-poetry.org/docs/#installation


### Installing Poetry
Install it via `pipx install poetry`.

_pipx installs packages semi globally, very weird..._


### Setup a poetry project directory

1. Make poetry create a `.venv` dir for you in every project that uses poetry
	 -> `poetry config virtualenvs.in-project true`  (this is a global setting)
1. Run `poetry init` in your project dir
2. Add dependencies with `poetry add <module_name>` or during the init process
3. Run `poetry install` to install your dependencies.
4. Change the python version of your venv to the same as your poetry project via:
	-> `poetry env use /path/to/python3.11`
5. Activate your new venv via `poetry shell` and **DO NOT** `source .venv/bin/activate`

##  Local Packaging

1. Build the package via `poetry build`
3. Install the wheel locally: `pip install dist/your_project.whl`

To actually being able to run your python program, you must include this line in your pyproject.toml:
```toml
[tool.poetry.scripts]
your_command_name = "your_project_name.main:main"
```

**Explanation:**
1. your_command_name = the command you will run to start your project. Should be same as project name if you
only have one.
2. your_project_name = the name of the dir in the src/ folder where your project code is
3. .main = the name of the file you want to execute
4. :main = the name of the function in the file you want to execute
5. _You can actually have multiple commands here_

### Publishing your package to pypi
1. Run: `poetry config pypi-token.pypi <YOUR_PYPI_TOKEN>`
	1. This command stores the API token directly in Poetry's configuration.
	I don't know where since I could not read it via `poetry config --list`.
2. Build and Publish via: `poetry publish --build`

### Publishing to a custom repo (untested):
1. Run `poetry config pypi-token.<repository_name> <YOUR_REPOSITORY_TOKEN>`
2. in your _pyproject.toml_ add:
```toml
[tool.poetry.repositories.<repository_name>]
url = "https://example.com/my-private-repo"
```
3. Build and Publish: `poetry publish --build -r my-private-repo`
### Example File Structure
simple poetry example file structure:
```
poetry-test/
├── pyproject.toml
├── README.md
├── src/
│   └── poetry_test/
│       ├── __init__.py
│       └── main.py
└── tests/
    └── test_example.py
```

advanced poetry example file structure:
```
poetry-test/
├── pyproject.toml            # Poetry configuration file
├── README.md                 # (Optional) Project description and instructions
├── src/                      # Main source directory
│   ├── poetry_test/          # Main package directory ( match project name)
│   │   ├── __init__.py       # Initializes the package
│   │   ├── main.py           # Main module or core logic of the package
│   │   ├── utils/            # Utility funcs or helper modules for reusable code
│   │   │   └── helpers.py    # Example helper function file
│   │   ├── config/           # Configuration files or settings for the project
│   │   │   └── settings.py   # Example settings or configuration file
│   │   └── modules/          # Sub-packages, useful for organizing projects
│   │       ├── module_a.py   # Example module for a specific feature or function
│   │       └── module_b.py   # Another example module
│   ├── scripts/              # Standalone scripts
│   │   └── data_processor.py # Example standalone script for data processing
│   └── data/                 # Data files used by the project
│       └── sample_data.csv   # Example data file used by scripts or tests
└── tests/                    # Directory for test files
    └── test_example.py       # Example test file for unit or integration tests
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "poetry_test_project_for_me",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "==3.11.*",
    "maintainer_email": null,
    "keywords": "poetry, testing_package",
    "author": "Alex Brightwater",
    "author_email": "alexander.brightwater@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/90/48/c2f9f4b389a2286e0f684dd36913c181954217cba909adb39b72151b8436/poetry_test_project_for_me-0.2.6.tar.gz",
    "platform": null,
    "description": "# Poetry Test\n\nIn this proeject, I will be testing the poetry package manager for python.\n\nCurrently the project is capable of downloading a random image via running poetry_test or download_img\n\n## How to Poetry\n\n--> https://python-poetry.org/docs/#installation\n\n\n### Installing Poetry\nInstall it via `pipx install poetry`.\n\n_pipx installs packages semi globally, very weird..._\n\n\n### Setup a poetry project directory\n\n1. Make poetry create a `.venv` dir for you in every project that uses poetry\n\t -> `poetry config virtualenvs.in-project true`  (this is a global setting)\n1. Run `poetry init` in your project dir\n2. Add dependencies with `poetry add <module_name>` or during the init process\n3. Run `poetry install` to install your dependencies.\n4. Change the python version of your venv to the same as your poetry project via:\n\t-> `poetry env use /path/to/python3.11`\n5. Activate your new venv via `poetry shell` and **DO NOT** `source .venv/bin/activate`\n\n##  Local Packaging\n\n1. Build the package via `poetry build`\n3. Install the wheel locally: `pip install dist/your_project.whl`\n\nTo actually being able to run your python program, you must include this line in your pyproject.toml:\n```toml\n[tool.poetry.scripts]\nyour_command_name = \"your_project_name.main:main\"\n```\n\n**Explanation:**\n1. your_command_name = the command you will run to start your project. Should be same as project name if you\nonly have one.\n2. your_project_name = the name of the dir in the src/ folder where your project code is\n3. .main = the name of the file you want to execute\n4. :main = the name of the function in the file you want to execute\n5. _You can actually have multiple commands here_\n\n### Publishing your package to pypi\n1. Run: `poetry config pypi-token.pypi <YOUR_PYPI_TOKEN>`\n\t1. This command stores the API token directly in Poetry's configuration.\n\tI don't know where since I could not read it via `poetry config --list`.\n2. Build and Publish via: `poetry publish --build`\n\n### Publishing to a custom repo (untested):\n1. Run `poetry config pypi-token.<repository_name> <YOUR_REPOSITORY_TOKEN>`\n2. in your _pyproject.toml_ add:\n```toml\n[tool.poetry.repositories.<repository_name>]\nurl = \"https://example.com/my-private-repo\"\n```\n3. Build and Publish: `poetry publish --build -r my-private-repo`\n### Example File Structure\nsimple poetry example file structure:\n```\npoetry-test/\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 src/\n\u2502   \u2514\u2500\u2500 poetry_test/\n\u2502       \u251c\u2500\u2500 __init__.py\n\u2502       \u2514\u2500\u2500 main.py\n\u2514\u2500\u2500 tests/\n    \u2514\u2500\u2500 test_example.py\n```\n\nadvanced poetry example file structure:\n```\npoetry-test/\n\u251c\u2500\u2500 pyproject.toml            # Poetry configuration file\n\u251c\u2500\u2500 README.md                 # (Optional) Project description and instructions\n\u251c\u2500\u2500 src/                      # Main source directory\n\u2502   \u251c\u2500\u2500 poetry_test/          # Main package directory ( match project name)\n\u2502   \u2502   \u251c\u2500\u2500 __init__.py       # Initializes the package\n\u2502   \u2502   \u251c\u2500\u2500 main.py           # Main module or core logic of the package\n\u2502   \u2502   \u251c\u2500\u2500 utils/            # Utility funcs or helper modules for reusable code\n\u2502   \u2502   \u2502   \u2514\u2500\u2500 helpers.py    # Example helper function file\n\u2502   \u2502   \u251c\u2500\u2500 config/           # Configuration files or settings for the project\n\u2502   \u2502   \u2502   \u2514\u2500\u2500 settings.py   # Example settings or configuration file\n\u2502   \u2502   \u2514\u2500\u2500 modules/          # Sub-packages, useful for organizing projects\n\u2502   \u2502       \u251c\u2500\u2500 module_a.py   # Example module for a specific feature or function\n\u2502   \u2502       \u2514\u2500\u2500 module_b.py   # Another example module\n\u2502   \u251c\u2500\u2500 scripts/              # Standalone scripts\n\u2502   \u2502   \u2514\u2500\u2500 data_processor.py # Example standalone script for data processing\n\u2502   \u2514\u2500\u2500 data/                 # Data files used by the project\n\u2502       \u2514\u2500\u2500 sample_data.csv   # Example data file used by scripts or tests\n\u2514\u2500\u2500 tests/                    # Directory for test files\n    \u2514\u2500\u2500 test_example.py       # Example test file for unit or integration tests\n```\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "A poetry python test projet",
    "version": "0.2.6",
    "project_urls": null,
    "split_keywords": [
        "poetry",
        " testing_package"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "296de39675dba8ecfa5861ca896ab9fc485b5efb5812b3d434ae0b25328ab8ad",
                "md5": "77b3a023074762d7d58b44a69edab7ae",
                "sha256": "23b541d2cd4fb4f806369a60baa6b4cf351de6145942ed929e38fbb7f1a5878f"
            },
            "downloads": -1,
            "filename": "poetry_test_project_for_me-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77b3a023074762d7d58b44a69edab7ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "==3.11.*",
            "size": 3718,
            "upload_time": "2024-11-06T15:12:13",
            "upload_time_iso_8601": "2024-11-06T15:12:13.948017Z",
            "url": "https://files.pythonhosted.org/packages/29/6d/e39675dba8ecfa5861ca896ab9fc485b5efb5812b3d434ae0b25328ab8ad/poetry_test_project_for_me-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9048c2f9f4b389a2286e0f684dd36913c181954217cba909adb39b72151b8436",
                "md5": "3f5343734ad9347efae7b7151f4d69c6",
                "sha256": "94e1451e8a103e7564c5301e71eb9b71e745907eb144c3164fc03d3663c9d201"
            },
            "downloads": -1,
            "filename": "poetry_test_project_for_me-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "3f5343734ad9347efae7b7151f4d69c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "==3.11.*",
            "size": 2792,
            "upload_time": "2024-11-06T15:12:15",
            "upload_time_iso_8601": "2024-11-06T15:12:15.217829Z",
            "url": "https://files.pythonhosted.org/packages/90/48/c2f9f4b389a2286e0f684dd36913c181954217cba909adb39b72151b8436/poetry_test_project_for_me-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-06 15:12:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "poetry_test_project_for_me"
}
        
Elapsed time: 0.57799s